selecting one item at a time from mysql
| From: | Richard Kurth | Date: | Sun, 17 Sep 2000 21:09:28 +0000 |
| Subject: | selecting one item at a time from mysql | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17098@lists.php.net to get a copy of this message | ||
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.
NorthWestHost
Your web host provider
www.northwesthost.com