> ***
> function write_string(count) {
>
> for ($x = 0; $x < $count; $x++) {
>
> echo " Row $x";
>
> }
>
> }
>
> $my_string = write_string(5);
>
> echo $my_string;
> ***
8<-Untested Code-8<-
f
> Does anyone know of an intelligent way to establish a user's location
> (roughly) from either IP address or some other variable
> available to the
> server from the browser? (Other than polling the user)
Not really - the problems you face are:
1. Processing Delays - if you need to do who
> Right now, it's logging the client's IP, the page that
> they're viewing,
> the page that they came from, the time of the visit, and their system
> and browser info.
Ummm, you do understand that, for Apache at least, all of this
information can be made available through it's logging? You a
> as a general rule of thumb, try to do as much
> checking as you can with
> JavaScript. For those checks such as "is the field a valid
> date", "is
> the field numeric" and so on, it is much faster to check on
> the client,
> than to send the data back to the server and check
> I have a string in this format:
> 2003-02-15 13:19:02
>
> I want to display it in a more readable format like
> Staurday, 11 Februardy,
> 2003, 13:19:02. How can I achieve that. I tried date()
> function but could
> not get what I wanted.
The date format above is a standard mysql date/t
> What I want to do is have the registration form, on submit, check the
> data validity right then, if there is an error, redisplay
> the form with an * next to the field that is incorrect.
This is the code logic rather than the actual working code:
---Start of PHP Page---
1. Check for form h
> i've written a secure PHP login script which will allow
> users to login to a
> directory such as this:
>
> smezone.com/members/index.php
>
> however, how do I restrict people from accessing HTML files in that
> directory (which they can easily do so by typing the URL into their
> brows
> Can anybody help me with file uploading, again...
Have you tried using the fairly simple example that is given at
http://www.php.net/manual/en/features.file-upload.php yet? I've found
that starting with this example and then adding all the extras tends to
work well when you've got problems.
Karl,
> what is a winmail.dat file?
Is it too much to ask that you do some of this sort of thing for
yourself?
Here, I'll help you...
1. Connect to the Internet (if necessary)
2. Load a web browser
3. Navigate to http://www.google.com/
4. Type "what is a winmail.dat file" into the search b
> echo("| %s | %s | %s | %s | %s |", $array[id],
> $array[username],
> $array[password], $array[status], $array[notes]);
If you look at http://www.php.net/echo you'll see that echo
does not support this syntax. If you want to use this syntax
then you should probably be using some form of print
> i am having a problem using tags by using current
> values kept in a mysql table. how do you get the values out of the
table and
> into a form so they show as the value= part of the tag?
Start by making a basic test:
";
?>
or you could try this:
Either should work.
Rinse and repe
> i want to set up a form that will load values from a table
> and make them the
> "value" of the edit box... then when people press an update
> button then all
> of the stuff that changes from the record already in the table gets
> changed... anybody know how to make it where you can get th
> I have a conditional:
> if (a == b)
>
> a is the number 0, but b is a string "Friday August 22".
>
> The condition is evaluating as true, which is not what I want.
> What am I misunderstanding?
You're comparing a string to a number perhaps?
I tried this:
-8<-
$a = 0;
$b = "Frid
G'day Scott
> Just curious, is there a PHP function that will break up the
> string for us?
I'm not specifically having a go at you but more observing that some
people use this list as a first line of question rather than doing some
work themselves.
Assuming that I didn't already know what fu
Hi Karl
First up, would you mind posting your messages in plain text instead of
html format? It's just a courtesy to the rest of us.
> does anyone have the code to where i can have the time
> printed on my home page like for example
>
> Monday, January 19, 2003
Sure, check out the date() fu
> On another note, I have found that if I include (and use)
> the submit button
> everything works perfectly, HOWEVER if I just enter data and
> hit return then it messes up.
You could try including a hidden submit field like this:
For name="submit" change that to whatever name your norm
> You could rely somewhat of the time zone codes as you refer
> to them, the
> only issue is in some parts of the world
> this would include 10 countries at a time.
But what time zone are you getting? The time zone of the browser? The
time zone of the proxy cache that's in a possibly differ
> Is there a way to get to know from which country a user is
> calling the webside with my php-script?
Probably only if you're going to ask them to tell you what country they
are in.
You can look at the resolved domain that they are coming from and it's
country code - this might be indicative
G'day CJ
> This is really a html more than a php question.
Yep, it probably is...
> Is it possible to have two buttons and have different
> actions for each button in the same form?
Yep, you can.
When you process your form in php you'll find that you have either
$first_submit_act
> My question is this: is it possible to use
> autoincrement to generate
> the id's and still keep them sequential when I delete say,
> item 3 of 5.
Generally speaking, an auto-increment column will not fill gaps and keep
sequential orders. Your choice, basically, is to write your code
> How do I create a drop down list that automatically
> generates a list of months for the next 12 months upto and including
this month
This would do it...
$month_name\n";
} else {
echo " $month_name\n";
}
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubs
> $mysql query1
> result
> array[cityid][cityname]
>
> mysql query2
> result
> array[cityid][cityname]
>
> now what i want to do is kick out any doubles in my array
> and resort them alphebetically by cityname ?!
It's difficult to answer this question without knowing more about the
cont
> @MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'"); // this
> query doesn't work
Personally, I'd call it bad programming practice to do a database update
and not check to see if it worked or not. In this case, how are you
determining that the query did not work? Are you manually checkin
> So, there is something in the new security of XP and Win 2K
> SP 3 that
> does not let the dll load and run. Ever since I loaded SP 3
> I have had
> problems - like many others!
Don't know about Win2k as I haven't tried it but Apache/PHP/MySQL is
working perfectly well on my Win XP laptop
G'day Peter
> I have a form with several date fields. I want to be able to
> set these by selecting from a calendar display. Does anyone
> know of any php function or code which would let me do this?
If you mean having some sort of pop-up calendar display that the user
can select a date from
Hi All
This is probably off-topic here and my only real excuse is that after
having searched google as well as both php and mysql sites/manuals I'm
no closer to an answer for something I'd like to get solved this
morning...
I have two database tables (mysql). One contains information about
image
> Does anybody know of a SELECT QUERY that will select every
> other record of a
> table ? I want to do this so that I can display my products
> in 2 columns (I
> will also be using arrays of course).
Don't know of a select that'll do it, but then I don't really understand
why you'd want
> My OS is Windows XP Pro but the computer with admin
> privaliges is Windows
> 98. It's not software, it's hardware. It's built into the
> HUB of the LAN.
> There is some software to open ports but I'm not sure what
> it is or anything
> like that. Thanks for the help so far.
No offence
> To those of you that helped me with this problem I have spent time
> eliminating lines of code.. the problem was in the following line:
> if ($_SESSION["first_name"])
>
> the line should be like this
> if (ISSET($_SESSION["first_name"]))
The change that would induce this error is likely
G'day David
> > My problem is that files uploaded through a form are
> > increasing in size.
> Doesn't that look like the EOL characters are being
> translated after the fashion of ftp ascii transfers?
> Maybe have a look at the two versions in a
> hex viewer and see if that is the cas
Hi All
I'll start by saying that I've checked the online manual (and comments)
as well as having done a Google search on this with no success.
My problem is that files uploaded through a form are increasing in size.
For example, I upload an image that is 7658 bytes and the uploaded
version is 768
> Just wanted to let everyone know:
>
> PHP version is 4.2.1
> Apache is 1.3.24
>
> Running WindowsXP Pro
Oh, yeah, that.
My dev environment is almost exactly the same.
CYA, Dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
> For all those who don't know my question from yesterday, I
> have a form where I can upload up to 9 files at a time.
> Unfortunately, only the first 5 of those files are being
> uploaded at any given time.
I haven't specifically checked your program logic but I believe that
this is wher
> I'm currently working on a big photo album tool, and I want
> to provide user
> the ability to upload a lot of jpeg files in one time...
> The big problem with form is it's too slow...
>
> Does anyone know how to by-pass this ( with java or other
> tools )?
It's primarly slow bec
> post_max_size = 10M
> upload_max_filesize = 8M
> memory_limit = 8M
>
> As I said before, however.. even without throwing files
> there, my loop
> test code only spits out '01234', meaning that its only
> looping 5 times
> through the code before exiting... Does file handling only
> Using PHP and a MySQL database, I want to grab the highest
> number in a particular column.
As is usual for questions like this, the answer is most likely that you
should do it in your sql query. In this case, something like this would
probably do it:
SELECT MAX(some_column) FROM some_tab
> Indeed, another problem I have is that if a single is on an
> album, which track it is on the album.
Off hand, I'd say that if you need this information as well (ie. You
want to recreate the "songs on album" list in the correct order) then
you need to extend one of your tables to include th
> >Song Table:
> >Song_id
> >A_id
> >Type
> >Name
> >Length
> >Lyrics
> >...
> >
> >That's my ideas on how to do it. There are many ways to do
> it, though.
> >
> Totally agree with what John says. If the lyrics are long
> (as I assume
> they will be) then I'd probably hive the
> I am at my wits end at the moment. I am pulling a
> datetimestamp out of a database and attempting to
> get the year month and day out of it.
Do it in your sql query. Check out chapter 6 of the MySQL manual for
ways to manipulate dates.
Eg. $query = "select DATE_FORMAT(DTStamp, '%e %b
> if (is_readable("owner.php"))
> echo "READABLE";
> else
> echo "UNREADABLE";
> include ("owner.php");
> ?>
According to the manual, the results of is_readable() is cached. So, if
you've been testing this and have both readable and unreadable you may
have the wrong one c
> I have no interest in getting into a Win2K/Linux debate. There are
> strengths and reasons for using both systems.
Good for you, I was about to post something similar. For the record my
dev environment is a laptop with a Celeron 1.2/256MB/WinXP Pro and it's
running Apache, MySQL and PHP j
> I send hidden variables from a form to a php. In the php
> I have the following code to convert the global vars sent:
>
> If (isset($_GET['foo']))
> $foo = $_GET['foo']
> else
> $foo = 0;
>
> But this only works using the "GET" method!
If you're sending the
> I need a where clause in following situation:
>
> Say I want to query two tables: A and B. In table A there is field
> Afn, while in table B there are 3 fields: Bfn1, Bfn2 and
> Bfn3. I want
> to do a query, in which the where clause must do these things:
>
> if A.Afn=1, then che
> I am the webmaster of the site, i pay for the server space,
> is that what you mean?
First up Simon, I deleted over a hundred lines of no longer relevant
content from your message including things like signatures. You should
probably trim messages down when you reply to them...
Next up, w
> I have 2 identical tables called "tmp_data" and "data". (on
> the same mysql database).
> What would be the simple and more convenient way to update
> table "data" with a row from table "tmp_data".
What about getting rid of "tmp_data" completely and adding an extra
column to your "data"
> Thats a Nice feaure you have, How do you do that?
I have a cron event on my server that grabs the relevant page from the
web site soon after it is updated (around 20 past each hour) using "lynx
-dump url" which then pipes the resulting page dump through grep to grab
just the line of data that
> I am having trouble with a PHP script. I am not the one who
> made this and my knowledge on php is very little.
> I came across this php script
> www.canberra-wx.com/bomonster/bomonster01.php
Tried loading this and had too many page errors to figure out what you
are doing.
> www.canber
Doing stuff with || is always a good way to stuff up. In the case of
your example it will always evaluate to true.
> if ($A != $C || $B != $C) {
>
> I think, but im fairly new
This would work if you did this:
If (!($A == $C || $B == $C)) {
> > In perl, I would do this:
> >
> > unless (
> ex. SELECT feild1, field2, COUNT(*) FROM tables GROUP BY
> category, format.
Try this instead:
SELECT field1, field2, COUNT(*) AS field3 FROM TABLS GROUP BY
category,format
Now you'll find your count is available as 'field3'.
CYA, Dave
--
PHP General Mailing List (http://www.php.n
If you've typed your code in accurately then...
> $detailqry = "SELECT id, parentitemid, itemtypeid, itemstatusid,
[etc]
> $result = mysql_query($detailqry) or die("Failed finding
> task details");
somewhere in about here you want to have something like:
$sqldata = mysql_fetch_array($res
> How do you alternate colors of the rows in a table inside a
> while statement
> when dealing with the output of data from a DB. I am sure
> it's something
> simple but I keep getting into some really long math thing...
For two alternating colours I normally do something like this:
$use
> Ok so how do I sum up an entire column in my db?
> For example if one row is : 1 , the next is 2, and the next
> is 1 - I need to
> have a total of 4 and the be able to divide by the num_rows
>
> The problem I ma having is the "inside" row addition
If you're doing it on values from a d
> I have, in my database, a bunch of dates stored like this:
> -M. Month is obviously the number of the month (5), not
> the name (May).
>
> I want to convert the format to MMM, (ex: May, 2002),
Do the conversion in MySQL - it'll save you grief in the long run...
SELECT DATE_F
> And here is the error I get:
> -
> Warning: Unable to create
> '/home/thehobby/public_html/php/phpforums/uploads/': Is a
Does this directory exist? Does the user that your web server is
running as have permission to write files in this directory?
>
> >SELECT COUNT(x) FROM table;
> >
> >Make 'x' equal to any column name in the table and add WHERE to the
> >clause as needed.
>
> err...all very well, but how do i retrieve the
> value afterwards?
> $sqlcom="select count(codigo) from comments where
> codigo=$id";
> I've got a php form, that gathers certain information, and
> then passes that info on to a couple of shell scripts to
> move files around, create links, import data into some mysql
> databases via sql files, etc.
>
> The two shell scripts work fine when I'm logged in as root
> via t
> I keep getting "Undefined variable: PHP_SELF" when using the
> following:
>
>
>
> Global variables are off... What am I doing wrong?
In current versions of PHP, $PHP_SELF is available if globals are on.
You'll need $_SERVER['PHP_SELF'] instead if you're keeping globals off.
CYA, Dav
> while (list ($key, $val) = each ($info))
> {
>do stuff
> }
$count = 0;
$last = sizeof($info);
While (list($key, $val) = each($info))
{
if ($count == 0)
{
// first time through
}
if ($count == $last)
{
// last time through
}
// do stuff
$count++;
}
--
P
> I'd like to implement on my web site an "whois" to know the
> information about a domain name (.com, org, )
There's an article about doing exactly this on devshed
(www.devshed.com/Server_Side/PHP/) that you could have a look at. Looked
like a pretty complete solution when I went looking
> How do you make a link in MySQL?
>
> I tried following code were the field "geluid" contains a
> link to a mp3
> while ($row=mysql_fetch_array($result))
> {
> echo "";
> echo $row[woord_nl]. ""
> . $row[woord_ost]. ""
> . $row[betekenis_nl]. ""
> . $row[geluid];
> echo "";
> }
> I've tried that, but as usual rtfm doesn't help me. I need
> concise examples
> :(
>
> How would I write this basic select query to get the date in
> my format
> (Saturday, August 10th, 2002)?
> SELECT datum FROM news_items
> (where "datum" is the date-stamp in "-MM-DD" format)
> In my MySQL db I have a date-field on every entry looking like this :
> 2002-08-10
> When presented on a PHP page, I want it converted to
> "Saturday, Augusth
> 10th, 2002".
>
> How do I achieve that? I've been playing around with the
> date-command and
> strtotime-command but haven
I know I shouldn't do more to keep this going but I'll make this one,
and only, post.
> this all started when rasmus had a problem with the "click"
> in my original post
>From what I read, Rasmus made a correction to your opinion. You are
entitled to your opinion, but perhaps you should lear
> I just upgraded to PHP 4.2.2 and am trying to make my sites work with
> register_globals turned OFF. I notice, however, that with
> register_globals turned off any variables I pass via the URL don't
seem to be
> recognized by the script it was passed to.
> I thought register_globals onl
> is there some other easyer way to do in one line than this?:
>
> $fullname = $session["f_name"];
> $fullname .= " ";
> $fullname .= $session["l_name"];
$fullname = $session["f_name"] . " " . $session["l_name"];
CYA, Dave
--
PHP General Mailing List (http://www.php.net/)
To unsub
> Mmm.. think you misinterpreted my question...
>
>
> http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
>
> PASSWORD(str)
> how do you unPASSWORD(str) in PHP?
Basically, you don't.
Instead, what you do is use the password that was provided as user
input. You create a suitable
> What i want to do is delete the entire IDs and
> generate them again so that they are in one single
> order like 1,2,3,4,5... .like this.
I suspect that if your table, as you use it, needs this ordering then
you've got something wrong. It really shouldn't matter much what the
internal IDs
> Yes, I am afraid that regarding GPL I have to agree with
> Microsoft when they say it is a cancer. The problem is that if you
want to
> distribute something that incorporates GPL licensed components, your
> software also needs to be distributed as GPL and so it gets
contaminated.
> Thi
> When I issue this command to remove any commas at end of string:
>
> $query = rtrim($query, ",");
>
> PHP give me an error saying "Wrong parameter count for
> rtrim()". How can
> this be? The online manual shows rtrim can accept two
> parameters. Shouldn't
> this work? I have PH
> Do you charge by the page, script or by the hour (that would
> be nice).
We do this sort of thing in, basically, one of three ways...
1. Client gives us a budget and we give them a clear idea of what that
budget will get them.
2. Client gives us a good idea of what they want to achieve
> I have a datetime field in one of my mysql tables...when
> displaying some of
> my records I want to display the date in the aforementioned
> datetime field,
> but if the date is today I want to display "today" instead.
> If the date is
> yesterday I want it to display that so I
> what doesn't work is after they login to Page 1, the
> redirect sends them to
> Page 2 and right back to Page 1 because the global session
> isn't staying
> registered.
Are you putting session_start() at the top of each page where you want
to be able to use the session stuff you've set
> > Failed opening '/var/www/html/BOOKS/newbooks.php' for inclusion
> > (include_path='.:/php/includes:/usr/share/php') in Unknown
> on line 0
> >
> > I am getting the following error, when the file
> newbooks.php is invoked.
> > The first lines in this entire file starts with the tag,
> When you say,
> Order by RAND()
> I would think the "Order by" construct expects a column name.
> In your case, it gets a decimal value.
> How does "Order by" treat decimal values?
> Oh, I just checked the manual:
> In MySQL Version 3.23, you can, however, do: SELECT * FROM
> table_n
> can you teach me how to retrieve random data from my
> database? like for example...i have a list of names on my
> database and i'd like to retrieve only one name at a
> time..randomly. how do i go about this?
This is really a database question rather than a php question and you
haven't
> can I use limit to show the 2nd record on without knowing
> how many more records there might be?
>
> also, what happens if I set the limit in a mysql statement
> (LIMIT 5,10), but there are only 3 results? 7 results?
My answer would tend to be that you should try it for yourself and
s
> Which method is the best way to store date/time in MySQL and
> then which PHP
> command is the best to use to convert that date to something
> useful?
Get comfortable with MySQL's date functionality and you'll find that you
don't often need to do the date comparisons and manipulation in
> Greetings, this may be simple, but it's late and my brain
> needs a hand.
>
> I have a string such as "first,second,third,fourth"
>
> I need a way to take each one of the items separated by the
> comma to be an item in an array.
Check out explode() and I think you'll find what you n
> The problem I have is with a page I build dynamically. The
> whole page is encased in tags. In between these tags
there
> are sections echoed as a result of a databasse query. Each of these
> sections is a form.
>
>
>
>
>
> dynamic content
>
>
> dynamic content
>
> id 3 from the database. What I really want is to state width
> is 100 and height is 100 for example so I do not have to downlaod the
entire
> picture and specify the width and height as part of the image:
>
> Do not want
>
>
> WHat I want
>
>
>
> Yep, I was using the DATE() function in PHP to convert a
> TIMESTAMP from a MySQL DB query. I was getting a year of
> 2038 because MySQL and PHP use different TIMESTAMP formats.
> $getmyTime = mysql_query("SELECT UNIX_TIMESTAMP(timestamp_col)
AS yournamehere FROM
> myDBnamehere WH
> I am trying to write a program that is very modular in
> nature & one of the
> features I need the user to be able to do is install/uninstall or
> enable/disable the module though the interface.
I have, in the past, stored such information in a database. In projects
that have need of suc
> My apologies if this has been asked a thousand times. I've
> just joined the list.
I has, but you get that...
> I can't find any information on passing JavaScript variables
> to PHP on the same page (i.e. not through the POST information of a
> submitted form). Is this because it's no
> >>Wouldn't you ultimately be better off moving most of this sort of
> > thing
> >>into style sheets and then have the designers play with the style
> > sheets instead?
> > What if your designer wants to change from a two column
> table to a four column table. Or change the menu from a v
> I've got Windows XP Pro OS. I installed and am running
> mySQL on that.
> However, PHP is not getting configured with Apache on
> it. I got the latest Apache, 1.3.24 or something, not
> the Version 2. Anyway, Apache runs perfectly on it.
> However, when i put in the required PHP lines i
>
> $siteTitle
>
> $colBg = "#FF";
> $colText = "#FFCC99";
> $colLink = "#EE";
> $colComplimentary = "#CC6600";
>
>
> $fontHeading = " size=\"3\">";
Wouldn't you ultimately be better off moving most of this sort of thing
into style sheets and then have the designers play w
> I want to set up a site at home to play with php
>
> I have windows xp pro, dreamweaver MX and mysql
>
> Do I need anything to view live application data locally in
> my browser
You'll need to install a web server that supports php and php itself. I
did this recently on my XP Pro lapt
> I've tried to include a simple javascript in a .php file,
> but couldn't get it to work.
>
> Actually not even the php code worked at all...
>
> Is there any specific configuration flag that needs to be
> set up in the Apache server so that the javascripts work
> correctly?
Not part
> I know this might be a bit easy for all you experts out
> there. I have multiple checkboxes and text areas in a form. In the
> confirmation email sent to the user I manage to get the text areas to
display
> in the email. How would I get the results of the checkboxes to to
display as w
> function cleandate($indate) {
> str_replace("-", "/", $indate);
> return date("F j, Y", strtotime($indate));
> }
I suspect that you actually need something like this:
function cleandate($indate) {
$indate = str_replace("-", "/", $indate);
return date("F j, Y", strtotime
> Okay, let's say I want to send a user to a certain webpage...
>
> usually I would use...
>
> include("website.php");
>
> but, if i want to send a user to a website along with a
> variable like...
>
> $temp = "website.php?var=".$var;
> include($temp);
>
> ...this doesn't work.
> user input, which is not always reliable, has to be in the correct
format.
What I've done for things like this is to have three separate select
form elements. The first for selecting a day of the month. The second
for selecting a month and the third for selecting a year. I usually set
the
> $query = "select count(*) from users where "
You are asking for a count() in your query. This will always give you
one row returned with a count. If you really want to do this you should
probably have:
$query = "select count(*) as usercount from users where"
Then you can do your te
> echo "i = $i";
> for($c=1;$c<=$i;$c++){
> echo "team_number $team_number_$c";
> echo "sub1_$c = $sub1_$c";
> echo "sub2_$c = $sub2_$c";
> echo "sub3_$c = $sub3_$c";
> echo "sub4_$c = $sub4_$c";
> echo "sub5_$c = $sub5_$c";
> }
> }
Perhaps this:
Ech
> I have a string something like "10.2.3"
> I want to be able to use the "." as a delimiter to reference
> the elements (10, 2, and 3).
> My thought was to create an array, using "." as the
> delimiter. Is there a function that will create an array out
> of a string, using a delimiter y
> I have a JavaScript function that onChange of a list box,
> takes the value of an option and grabs data from a MySQL
> table. My problem is how do I use the JavaScript var in my
> sql statement?
Javascript is client-side, php is server-side. The only way to get
something that happens i
> It has just occured to me though that if I'm to list maybe
> 100 news items with descriptions it means alot of memory
> right because i have 100 items containing:
> date
> title
> text (could be any length)
>
> I will use su
> I would like to have a column returned in a query that tells
> you which record I'm looking at? Sort of like an
> auto_increment? IOW, the query results would look like:
>
> record first last
>
> 1 johndoe
> 2 joe blow
> 3 carol fisher
>
> Th
> I have a db field, type varchar, that is actually a 'date'
> string formatted as dd-mm-. I used type 'varchar' (rather than
> type 'date') since I had to accomplish other things with it.
> Now, however, I do need to extract the Year (the last four
> digits in the array).
Ummm, are
> What Im trying to do here is not inside PHP nor MySQL books
> I have. I need to query the DB to look the max result in a
> column. That is, if I have affiliate members with ID going
> from 1 to 10, get the query to know that the last member
> added was 10 so I can add member 11 witho
1 - 100 of 202 matches
Mail list logo