Date: 09/18/00
- Next message: Alexander Köb: "[PHP] date/time in php_error_log"
- Previous message: Ohlson Stefan: "[PHP] header()"
- In reply to: Richard Kurth: "[PHP] selecting one item at a time from mysql"
- Next in thread: Jim Sheetz: "Re: [PHP] selecting one item at a time from mysql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Richard,
Just put this query in the WHILE loop of the previous query:
$query0 = "Select * FROM newcustomers";
$result0 = " mysql_query($query0) or die("query0 failed");
while($myrow0 = mysql_fetch_array($result0))
{
> $query1 = "SELECT * FROM ipaddress LIMIT 1";
> $result1 = mysql_query ($query1) or
> die("Error in query");
> while($myrow1 = mysql_fetch_array($result1))
> {
> $ipaddress = $myrow1["ip"];
}
Your outer query runs only once, then the inner query runs once for
each instance that meets your "assign an IP" criteria. It pulls
exactly one IP consistently, no matter how many customer records
are part of the batch.
> It works just fine if I don't have more than one person signing up at a
> time. I could use the LIMIT switch to just get the first record but then
> if I have a second person that is in the database to be signed up I would
> have to run the query again. (The program is run by cron and looks in a
> database to see if there are any new subscribers if there are it grabs
> them and runs all of them thru the script each one needs a different ip
> address) All I what to do is grab another IP address each time the program
> comes to a new subscriber without having to run the script over again.
Sounds great - what else do you have the script doing?
J!M
ps: 8-),
Do > I make any sense.
Do > I make any sense.
Do > I make any sense.
Do > I make any sense.
Do > I make a ny sense.
Do > Im a keanys ense.
Do > I may kane seens.
Do > yes man kenseI.
Do > ay make Insense.
Do > many uke a sensei.
NOTICE: unknown nonrecursive error in nonsense loop line 303, at
position 19.
>
>
>
>
>
>
>
>
>
>
>
> Hello and welcome to FAR DOWN THE PAGE. Thank you for
visiting. ;)) J!M
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Alexander Köb: "[PHP] date/time in php_error_log"
- Previous message: Ohlson Stefan: "[PHP] header()"
- In reply to: Richard Kurth: "[PHP] selecting one item at a time from mysql"
- Next in thread: Jim Sheetz: "Re: [PHP] selecting one item at a time from mysql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

