Forum Moderators: coopster
i have a feeling its this line:
WHERE tid=' . $urltid . '") or die(mysql_error());
$urltid = $_GET['tid'];
// Only Gets the row with where the tid from url and the tid are equal
$tidcheck = mysql_query("SELECT * FROM ".TABLE_PREFIX."threads
WHERE tid=' . $urltid . '") or die(mysql_error());
while($tid = mysql_fetch_array( $tidcheck )){
echo $tid['firstpost'];
}
?>
[edited by: jatar_k at 8:09 pm (utc) on July 28, 2007]
[edit reason] no urls thanks [/edit]
is tid in database CHAR or ant type of text field or INT or other numeric?
with code you have shown (i think that) you are trying to read character value due to presence of ' around $urltid (i.e you are trying to read 'somevalue'). If tid is numberic you don't need ' around somevalue.
what is TABLE_PREFIX - a variable (if so it needs $ )?
also it looks like you have issue with quotes. strat with this and see what happens:
$sql_q = "SELECT * FROM ".$TABLE_PREFIX."threads WHERE tid='" . $urltid . "')";
$tidcheck = mysql_query($sql_q)
or die ('I cannot get data from db because: ' . mysql_error());
table prefix is something to do with mybb, im getting the info loaded from mybb forums thats why
and tid is a int
i tried what you said and this is what came out
I cannot get data from db because: 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 ')' at line 1.
obviously theres a problem with the sql syntax i just dont know what.