Re: selecting one item at a time from mysql
| From: | Jason Lavigne | Date: | Thu, 28 Sep 2000 06:18:09 +0000 |
| Subject: | Re: selecting one item at a time from mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-17943@lists.php.net to get a copy of this message | ||
$query1 = "SELECT * FROM ipaddress LIMIT 1";
or something like the above, then delete if after.
Jay
"Richard Kurth" <rkurth@pacifier.com> wrote in message
news:58245434383.20000917140928@pacifier.com...
> 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.
>