Re[2]: [PHP] selecting one item at a time from mysql
| From: | Richard Kurth | Date: | Sun, 17 Sep 2000 21:36:22 +0000 |
| Subject: | Re[2]: [PHP] selecting one item at a time from mysql | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-17100@lists.php.net to get a copy of this message | ||
Hello SoNix,
Sunday, September 17, 2000, 3:05:39 PM, you wrote:
SH> Hummm
SH> Why not use
>> $query1 = "SELECT * FROM ipaddress WHERE ip_address='$REMOTE_ADDR'"
SH> No ???
The address are all new and just stored in the database there is
nothing to reference them to. I just want to get one at a time out of
the database for use in the script. Maybe I am making a bigger deal out of
this than there is.
>> I have a table that just has unused ip address's in it. What I what to
>> do is pull one address out of the database at a time so that I can use
>> it in the script that adds new customers to a hosting sit. After I use
>> that ip address it will be deleted from the table.
>> I am using something like this
>>
>> $query1 = "SELECT * FROM ipaddress";
>> $result1 = mysql_query ($query1) or
>> die("Error in query");
>> while($myrow1 = mysql_fetch_array($result1))
>> {
>> $ipaddress = $myrow1["ip"];
>>
>> 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. Do I make any sense.
--
Best regards,
Richard mailto:rkurth@pacifier.com