I get the following errors:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/trances.php on line 23
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
& instead of loading any part of the file, the whole thing is blank after that.
Here`s the coding, can anyone figure out what is wrong with it & know how to fix it:
$lev=$_SESSION['level2'];
$res = mysql_query("SELECT id, name, gallNum, URL, rating, numRates, description, views, cat, addDate, feature, literature FROM image WHERE id=$id");
if ($rows = mysql_fetch_row($res)) {
return $rows;
} else {
print (mysql_error());
}
if($submit){
$s = $sub." by ".$name;
$b= emote($bod);
mysql_query("INSERT INTO comment (imageID,subject,content,date,sender) VALUES ( '$id', '$s', '$b', NOW(),$send)")or die ( mysql_error());
mysql_query("INSERT INTO messagedata (recBoxID, sendBoxID, content, subject, isNew, date) VALUES ($rows[2], '7', 'You have a new comment on one of your trances that you have submitted.
Click here to read the comment.
This is automated message please do not reply.', 'New Comment Received', 1, NOW() )");
}
if($policy && ($lev>6)){
mysql_query("UPDATE userdata SET violations=SUM(violations,1) WHERE login='$name'");
}
$res = mysql_query("SELECT login FROM userdata WHERE id='$rows[2]'");
if ($by = mysql_fetch_row($res)) {
return $by;
} else {
print (mysql_error());
}
$res = mysql_query("SELECT icon FROM userdata WHERE id='$rows[2]'");
if ($icon = mysql_fetch_row($res)) {
return $icon;
} else {
print (mysql_error());
}
$res = mysql_query("SELECT name, id FROM imagecats WHERE id=$rows[8]");
if ($catName = mysql_fetch_row($res)) {
return $catName;
} else {
print (mysql_error());
}
$res = mysql_query("SELECT COUNT(*) FROM comment WHERE imageID='$id'");
if ($numCom = mysql_fetch_row($res)) {
return $numCom;
} else {
print (mysql_error());
}
$res = mysql_query("SELECT COUNT(*) FROM userdata WHERE imageFav='%$id%'");
if ($numFavs = mysql_fetch_row($res)) {
return $numFavs;
} else {
print (mysql_error());
}
//Update unique pageview counter
if( !$_SESSION["sess_$id"] ){
$_SESSION["sess_$id"] = "visited";
$v = $rows[7] + 1;
mysql_query("UPDATE image SET views=$v WHERE id='$id'");
}