Log in

View Full Version : HELP! Problem with a simple line. HELP!


snyx
10-24-2001, 04:14 AM
HELP! Here is the orignal code

$pop1 = $DB_site->query('SELECT title,threadid,views FROM thread ORDER BY views DESC LIMIT 1');

Im trying to block out all replys from showing up from forum 41
this is what I tried, but its not working

$pop1 = $DB_site->query('SELECT title,threadid,views FROM thread WHERE forumid<>41 ORDER BY views DESC LIMIT 1');

so what else can I do?

snyx

FWC
10-24-2001, 04:22 AM
Try:

$pop1 = $DB_site->query("SELECT title,threadid,views FROM thread WHERE forumid<>'41' ORDER BY views DESC LIMIT 1");

I have an almost identical query with the quotes like that and it works. It's worth a try.

BradC
10-24-2001, 02:43 PM
The sad thing is that is exactly what I told him.. which we tried a few times.. with no success.. then I just erased the line.. and started over... uploaded and refreshed and it worked..

now I have NO clue what space, character that was there or no there... that was messing it up.. but geeze.. took me an hour just to figure it out..

cause I was actually working on something similar to this yesterday and had to use almost the same query.. just with different info.. lol

thanks FWC.. :)

thought I was loosing my mind.. :)

Neo
10-24-2001, 03:14 PM
$pop1 = $DB_site->query("SELECT title,threadid,lastpost,lastposter,views FROM thread WHERE forumid<>'41' AND forumid<>'41' AND forumid<>'41' ORDER BY
views DESC LIMIT 1");

hmm... you can laugh at me later;)

I tryed this and it wored for me.

FWC
10-25-2001, 03:40 AM
Originally posted by BradC
The sad thing is that is exactly what I told him.. which we tried a few times.. with no success.. then I just erased the line.. and started over... uploaded and refreshed and it worked..I hate that when that happens. You're happy because it works and going nuts because you don't know why. :D

almighty one
10-25-2001, 03:46 AM
Originally posted by snyx
HELP! Here is the orignal code

$pop1 = $DB_site->query('SELECT title,threadid,views FROM thread ORDER BY views DESC LIMIT 1');

Im trying to block out all replys from showing up from forum 41
this is what I tried, but its not working

$pop1 = $DB_site->query('SELECT title,threadid,views FROM thread WHERE forumid<>41 ORDER BY views DESC LIMIT 1');

so what else can I do?

snyx
try a = in the query use equal sign and the ' ' around number as follows should work fine

$pop1 = $DB_site->query('SELECT title,threadid,views FROM thread WHERE forumid<>='41' ORDER BY views DESC LIMIT 1');