View Full Version : small...but deadly.
Velocd
06-19-2002, 07:08 AM
I'm trying to figure out why I keep getting an error message for this simple query, could anybody give me an answer why?
$person=$DB_site->query_first("SELECT userid,posts FROM user WHERE $idlog == userid LIMIT 1");
Here is the error message:
Parse error: parse error in c:\apache\htdocs\index.php on line 83
Thnx,
Velocd
Logician
06-19-2002, 08:25 AM
Try:
$person=$DB_site->query_first("SELECT userid,posts FROM user WHERE userid='$idlog' LIMIT 1");
Xenon
06-19-2002, 12:32 PM
logician is right, no == in SQL queries.
but shouldn't that produce an mysql error?
parse errors are something different normally.
when you applied logicians solution and it doesn' work also, pleas coppy some lines above line 83 perhaps there is an error and php shows the wrong line (which happends mostly if you forget an ' " } or something
Logician
06-19-2002, 12:41 PM
yep nice catch by Xenon.. :glasses:
Your line was wrong but this does not produce parse error. If line 83 is this line you posted here, check one line above and see if it ends with ; or not.
After correcting the parse error your still need to correct your SQL query..
Velocd
06-19-2002, 07:31 PM
Ah, just brilliant. Thanks ;)
Velocd
06-19-2002, 08:14 PM
Another quick question:
The following code is for the member of the day hack, and I'm trying to apply alittle more features to it.
Wouldn't the following code be acceptable to displayfield5, field6, and field7 of the member of the day?
$newmember=$DB_site->query_first("SELECT userid,username
FROM user
WHERE userid<>$daybits[1]
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1");
$newtemplate=$thisdate.'||vb||'.$newmember['userid'].'||vb||'.$newmember['username'];
$DB_site->query("UPDATE template
SET template='".addslashes($newtemplate)."'
WHERE templatesetid=-2
AND title='memberoftheday'");
$memberoftheday['userid']=$newmember['userid'];
$memberoftheday['username']=$newmember['username'];
$newmember2=$DB_site->query_first("SELECT field5,field6,field7
FROM userfield
LINE 85: WHERE userid='$memberoftheday['userid']' LIMIT 1");
$memberoftheday['interests']=$newmember2['field5'];
$memberoftheday['anime']=$newmember2['field6'];
$memberoftheday['quote']=$newmember2['field7'];
This code gives me the following error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\apache\htdocs\index.php on line 85
Line 85 is marked.
Logician
06-19-2002, 08:29 PM
$newmember2=$DB_site->query_first("SELECT field5,field6,field7
FROM userfield
WHERE userid='".$memberoftheday['userid']."' LIMIT 1");
Velocd
06-19-2002, 10:30 PM
Thanks again! That defiantly cleared my error, but the small hack still doesn't want to work, and I cant figure out for the life of me what the problem is..it seems totally logical.....
This code is located in my vbhome index file, and I'm displaying the member of the day on my home page, along with their interests, favorite anime, and personal quote. its just when using $memberoftheday[quote] in the template nothing appears....:(
Ps: and yes, they do have a quote ;)
Xenon
06-20-2002, 04:07 AM
perhaps field7 isn't the qoute field ;)
if it is, recheck your spellings :)
Velocd
06-20-2002, 07:26 AM
No, I have rechecked my spelling and to see if the fields are correct a million times, and that doesn't seem to be the problem (as much as I wish it were) :(
It must be in the code, but I can't figure out where........ :dead:
Logician
06-20-2002, 09:46 AM
it doesnt work but what does it happen exactly?
To debug, cast some echo commands around to see which part of your code is parsed and what are the variable values when code runs. This will help you to trace the line that has the problem..
Velocd
06-20-2002, 06:49 PM
I'll try some more troubleshooting in just a bit, but its basically suppose to let me know the member of the day, and then below tell me his/her favorite anime, interests, and personal quote (field5,field6,field7).
Atttached is a picture of the output I'm getting. You can't see it, but below the members name is suppose to be those fields, but its not picking up :(
Velocd
06-20-2002, 09:03 PM
Score! I figured the problem out ;)
It was a problem in the nesting of the if-statements in the Member of the Day hack itself, that I didn't notice.
Here is a screenshot of what it looks like, its pretty cool:
Xenon
06-21-2002, 04:38 PM
congratz ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.