Friday 15 March 2013

mysql - mysql_query: Unknown error -


I'm trying to file a new one in my database! But I'm getting the error in the mysql_query part!

That code is

  & lt; Php $ link = mysql_connect ('localhost', 'user', 'pass', 'data'); If (! $ Link) died ('Could not connect:' Mysql_error ()); $ Sql ​​= "Insert in content (` id`, `author`,` title`, `subject`] values ​​(zero, '11 ',' 22 ',' 33 ')"; if (! Mysql_query $ Link, $ sql) dead ('invalid query:'. Mysql_error ()); "added 1 record" echo; mysql_close ($ link);? & Gt;   

when If I run this page, then I

  invalid question:   

and an empty reason

any thoughts?

You have your parameters for the backward.

It should be mysql_query ( $ Sql, $ link) .

You do not even need to pass $ link You can simply mysql_query ($ sql) PHP mysql_connect . < / Div> will use the last link opened through.

No comments:

Post a Comment