getting sql records
Posted
by
droidus
on Stack Overflow
See other posts from Stack Overflow
or by droidus
Published on 2012-04-13T17:23:02Z
Indexed on
2012/04/13
17:29 UTC
Read the original article
Hit count: 223
when i run this code, it returns the topic fine...
$query = mysql_query("SELECT topic
FROM question
WHERE id = '$id'");
if(mysql_num_rows($query) > 0) {
$row = mysql_fetch_array($query) or die(mysql_error());
$topic = $row['topic'];
}
but when I change it to this, it doesn't run at all. why is this happening?
$query = mysql_query("SELECT topic, lock
FROM question
WHERE id = '$id'");
if(mysql_num_rows($query) > 0) {
$row = mysql_fetch_array($query) or die(mysql_error());
$topic = $row['topic'];
$lockedThread = $row['lock'];
echo "here: " . $lockedThread;
}
© Stack Overflow or respective owner