SQL Syntax error problem

PythonPython Forum LeaderThe Royal RAM
I have got this code:

[PHP] // Last Poster
$sql = "SELECT `author` FROM ".$DBprefix."posts WHERE `forum` = $forum[id]";
$query3 = $DB->Query($sql);
$rows = $DB->FetchRow($query3);
$lastposterid = $rows[0];
// Find the username
echo $rows[0]."<br>"; // just testing to see if value is there
$sql = "SELECT `username` FROM ".$DBprefix."users WHERE `userid` = $rows[0] LIMIT 1";
$query3 = $DB->Query($sql);
$rows = $DB->FetchRow($query3);
$forumlastposter = $rows[0];[/PHP]

But the problem is that I get this error:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1

I cant figure it out...

Am I doing something wrong?
Thanks

The Royal Ram

Comments

Sign In or Register to comment.