Re: an An error in SQL syntax
|
Boney Fairholm |
|
5/12/2008 12:20:26 AM |
FUNCTION is not a mysql command
what are you trying to do? Post Comments |
|
My shopping cart Post Comments |
|
Re: You cannot do it that way
|
Boney Fairholm |
|
5/12/2008 12:27:21 AM |
Okay, you cannot do it that way Post Comments |
|
Re: You can help me with it
|
Nirmal Pandey |
|
5/12/2008 12:28:43 AM |
So maybe you can help me with that Post Comments |
|
Re: an An error in SQL syntax
|
Cindrella Schreiber |
|
5/12/2008 12:20:56 AM |
looks like PHP to me.. so I'll move it to the PHP forum to diagnose what is going wrong will require the preceeding lines (just the immediae 2..or 3 lines, not the whole script)
on the face of it the code you have posted has nothign whatsoever to do with SQL, its merely assiging the values of the Session object to the variable $cart
I suspect that what you actaully have is an SQL statement that is not terminated in php, so yyou have wrapped up the function declaration into a SQL statement, and not surprisiginly when you do execute the SQL statement its whinging about PHP inside SQL.
I'd reccomend that durign development you make extensive use of the PHP "or die" function
$ProductsListsr=@mysql_query($sql, $cnn) or die (echo ("LISTALLPRODUCTS", "<an error number>eg E:77654.1 - Failed to open rs:sqlr ".mysql_errno().": ".mysql_error()." <BR>The SQL was:".$sql));
that helps for several reasons one you will know which SQL line threw the error if your error number is unique accross the project it will rpeort the MySQL error number and text formt he server but it will also show you what the SQL you actaully sent to the server was in the first place (assuming th at $sql ios your SQL string, $cnn is the current valid connection) Post Comments |
|
Re: an An error in SQL syntax
|
Nirmal Pandey |
|
5/12/2008 12:25:11 AM |
Error SQL query:
FUNCTION writeShoppingCart(
) {$cart = $_SESSION[ 'cart'];
MySQL said:
#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 'function writeShoppingCart() { $cart = $_SESSION['cart']' at line 1
please help i am a newbie so i just need some help and some tips Post Comments |
|