Need some help with my MySQL syntax.
Posted: Fri Oct 31, 2008 5:56 pm
What this code is supposed to do, is search a database entry called userviews from the row specified in $_GET[id], that's formatted like this: "Username Username2 Username3 Username4" for the current session username, and if it's not in that entry, add it to the end, proceeded by a single space.
I'm SURE I screwed up the syntax somewhere.
I'm SURE I screwed up the syntax somewhere.
Code: Select all
//record that the user has read the post
$check = mysql_query("SELECT COUNT '$_SESSION[username]' FROM replies WHERE userviews = '$_GET[id]'");
$uV = mysql_fetch_array($check);
if($uV["COUNT(*)"] == 1){
NULL;
} else {
$previousUV = mysql_query("SELECT * FROM replies WHERE userviews = '$_GET[id]'");
$userv = $previousUV . " " . $_SESSION[username];
mysql_query("UPDATE replies SET uservies = '$userv' WHERE id='$id'");
}