fejl i syntax

Tags:    php

Når jeg oploader min index.php til browseren giver den mig følgende besked:


Database query failed: 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 'BY position ASC' at line 2


Ved du hvordan jeg finder den rette syntax i mysql.



du er nød til at give os din sql for at vi kan hjælpe ;)



har du husket at skrive ORDER eller GROUP foran BY?



Indlæg senest redigeret d. 23.09.2008 18:10 af Bruger #5620
$data = mysql_query("SELECT * FROM table_name ORDER BY column_name ASC")

sådan noget ?

Ellers er w3schools et ok sted at kigge.



Indlæg senest redigeret d. 23.09.2008 20:37 af Bruger #14100
$data = mysql_query("SELECT * FROM table_name ORDER BY column_name ASC")

sådan noget ?

Ellers er w3schools et ok sted at kigge.





selve functionen hedder:


function get_pages_for_subject($subject_id, $public = true) {
global $connection;
$query = "SELECT *
FROM pages ";
$query .= "WHERE subject_id = {$subject_id} ";
if ($public)
{$query .= "AND visible = 1 ";}
$query .= "ORDER BY position ASC";
$page_set = mysql_query($query , $connection);
confirm_query($page_set);
return $page_set;



martin



t