PDA

View Full Version : Too strange, I starting to give up


Koutaru
03-29-2005, 07:54 AM
This is the strangest thing I've ever seen. A .php which was working earlier now doesn't work and backups won't help either.

Basically, the file won't open. There is no 404 error, it simply won't display and eventually, timeout.

If I change the code

$getstocks = $DB_site->query("SELECT stockname,symbol FROM ".TABLE_PREFIX."stocks WHERE active=1 ORDER BY symbol");


to (very small change, get rid of the _first)


$getstocks = $DB_site->query_first("SELECT stockname,symbol FROM ".TABLE_PREFIX."stocks WHERE active=1 ORDER BY symbol");


The file actually opens. However, the next line fails to work:


while ($stock = $DB_site->fetch_array($getstocks))
{
#MORE CODE HERE
}


Even though it looks perfectly fine. This exact code appears again exactly in another DO request and works fine but this one....

I'm starting to think it's server related but why this would happen on the server is beyond me. It's really puzzling and sinve I've spent hours over this, I'm at my wit's end.

Help?

Deaths
03-29-2005, 08:02 AM
If you use while, you can't use query_first ;)

Now, since you're gonna use while, the ORDER BY can be dumped, we can re-apply that later.

So, try this:

$getstocks = $DB_site->query("SELECT * FROM ".TABLE_PREFIX."stocks WHERE active=1");

That should do, tell me if not.

Koutaru
03-29-2005, 08:06 AM
:) thanks for telling me. That makes sense. The only thing is, if I do just query, the file won't load period and it'll eventually time out (I've tried the above code too).

[slumps] It only will load with query_first. Very, very odd.

Marco van Herwaarden
03-29-2005, 08:23 AM
Could you post the table definition.

Guest190829
03-29-2005, 08:32 AM
Is this from AN-net's Stock Hack?

tnguy3n
03-29-2005, 08:58 AM
if you use'
$getstocks = $DB_site->query_first("SELECT stockname,symbol FROM ".TABLE_PREFIX."stocks WHERE active=1 ORDER BY symbol");
then,
while ($getstocks)
{
#MORE CODE HERE
}

Koutaru
03-29-2005, 09:23 AM
Is this from AN-net's Stock Hack?
Unfortunately, that also sends it into a timeout

And yes, it is from AN-net's stock hack

I've also tried inserting just another query_first infront of the regular query to see if query_first is required but that fails as well.

However, when used, the query works fine, that's not an issue.