very fast question (mysql query/php getting result)
Posted: Wed Oct 29, 2008 7:36 pm
Code: Select all
$result = mysql_query("
SET @counter = 0;
SELECT `static_id`,
IF (`static_position`=@counter, @counter:=@counter+1, @counter:=@counter+1) as `static_new_position`
FROM `gcms_static` ORDER BY `static_new_position`, `static_id`") or die(mysql_error());Code: Select all
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 '; SELECT `static_id`, IF (`static_position`=@counter, @counter:=' at line 1