Web Hosting Talk







View Full Version : MySQL Syntax


livepvp
09-09-2007, 02:02 PM
SELECT id, title, gameid, gamename, catid, catname, filesize, num_stream, num_view, rank_overall, rank_game, rank_category, avg_score, vid_picurl MATCH (title,keywords) AGAINST ('$search') AS score FROM pvp_files WHERE MATCH (title,keywords) AGAINST ('$search') AND gameid='$gameid' AND status!='1' ORDER BY score LIMIT 30


Gives me an error, I used this syntax from hte MySQL.com website. Title and Keyword are fulltext fields.

debiannerd
09-09-2007, 04:36 PM
SELECT id, title, gameid, gamename, catid, catname, filesize, num_stream, num_view, rank_overall, rank_game, rank_category, avg_score, vid_picurl MATCH (title,keywords) AGAINST ('$search') AS score FROM pvp_files WHERE MATCH (title,keywords) AGAINST ('$search') AND gameid='$gameid' AND status!='1' ORDER BY score LIMIT 30
Gives me an error, I used this syntax from hte MySQL.com website. Title and Keyword are fulltext fields.

Give error

Give full implemented script, at least so we know if it is syntaxt error in php codes...

cheers

livepvp
09-09-2007, 06:00 PM
1064 - 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 'MATCH (title,keywords) AGAINST ('textxt') AS score FROM pvp_files WHERE MATCH (t' at line 1



echo"<table width='600' class='class1'><tr><th>Title</th><th>Game/Category</th><th>Filesize</th><th>Views</th><th>Rank</th><th>Reviews</th></tr>";
$sql_query = mysql_query("SELECT id, title, gameid, gamename, catid, catname, filesize, num_stream, num_view, rank_overall, rank_game, rank_category, avg_score, vid_picurl MATCH (title,keywords) AGAINST ('$search') AS score FROM pvp_files WHERE MATCH (title,keywords) AGAINST ('$search') AND gameid='$gameid' AND status!='1' ORDER BY score LIMIT 30");
while ($array_query = mysql_fetch_array($sql_query)) {
$views = $array_query[num_stream] + $array_query[num_views];
if ($array_query[vid_picurl] == "") {
$vid_picurl = "images/default.jpg";
} else {
$vid_picurl = $array_query[vid_picurl];
}
$filesize = get_filesize($array_query[filesize]);
echo"<tr><td><center><a href='index.php?p=viewfiles&username=$array_query[username]&fileid=$array_query[id]'><img src='$vid_picurl' width='100' height='100' border='0' alt='$array_query[title]'><br><b>$array_query[title]</b></a></center></td><td><a href='index.php?p=viewfiles&gameid=$array_query[gameid]'>$array_query[gamename] - $array_query[catname]</a></td><td>$filesize</td><td>$views</td><td><b>O</b>: $array_query[rank_overall]<br /><b>G</b>: $array_query[rank_game]<br /><b>C</b>: $array_query[rank_category]</td><td>$array_query[avg_score]/10</td></tr>";
}
echo"</table>";

RBBOT
09-16-2007, 06:05 AM
You have a comma missing before MATCH