Re: Empty Database Variables
| From: | Jason Wong | Date: | Fri, 07 Mar 2003 09:55:01 +0000 |
| Subject: | Re: Empty Database Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138596@lists.php.net to get a copy of this message | ||
On Friday 07 March 2003 05:52, Stephen wrote:
> For some reason, whenevr I try and access the database contents, it turns
> up empty. What I do is randomly select an ID (the lowest being 1 and the
> highest being however many IDs are in the database [this section of
> accessing the database works]). After I select the ID, I get an ad
> according to the ID the script randomly chose. For this particular site I'm
> working on, the ID is always 6 which I want it to be. The problem lies in
> getting th einformation from the database according to this ID. There is an
> entry with the ID of 6, but for some reason I variables are empty.
>
> The real twist is that sometimes it works (it automatically refreshes every
> 45 seconds to get a new random ad) and sometimes the variables are empty.
> Can anyone tell me how to fix this? Here's the code I use to asign the
> variables with the database contents:
>
> srand ((double) microtime() * 1000000);
> $rand = rand(1,$id);
> $sql = "select * from ads where id='$rand' and
> zone='".$zone."'";
You say ID should always be 6 but here you are trying to get a random record
from the DB. What gives?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
BE ALERT!!!! (The world needs more lerts...)
*/