Re: selecting one item at a time from mysql
| From: | Jim Sheetz | Date: | Thu, 28 Sep 2000 18:16:13 +0000 |
| Subject: | Re: selecting one item at a time from mysql | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17940@lists.php.net to get a copy of this message | ||
Just a different perspective... Why not count how many users you have at the
beginning of the script, and do *one* datbase query using LIMIT for the
number you need, then stuff the result into an array, and assign them at
will?
Jim.
"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.
>
>
>
>
>
>
>
>
>
>
>
> NorthWestHost
> Your web host provider
> www.northwesthost.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>