$result=mysql_query ($query) or die("ERROR: " .mysql_error());;
$query="INSERT INTO meminfo(username,password)
VALUES('Paul', 'Kloos')";
$result=mysql_query($query) or die("ERROR: " .mysql_error());;
$query="SELECT *";
$result=mysql_query($query) or die("ERROR: " .mysql_error());
echo $result;
?>
and the error is
Code:
Server connected!ERROR: 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 'IDENTITY(1,1) NOT NULL, username CHAR(20) NULL, password CHAR(20) NULL)' at line 2
and what i got from my php info from the server i'm on is
Client API version 4.1.7
so, i don't know what to do, i'm just using examples i found on this htmlgoodies
I am not aware of any IDENTITY() attribute for integers in MySQL.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Next we use IDENTITY which tells the DBMS that this is our Primary Key.Now, the (1,1) means that we want to start with the number 1 and we want to increment each new ID number by 1.
Also, I would suggest that username and password should be NOT NULL. Lastly, "password" is a reserved word in MySQL, so you'll need to back-tick it in your queries when being used as a column name.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
well the fact that i'm clueless about this one shows what a noob i am.
PHP Code:
$query="SELECT * FROM meminfo";
this is the code i'm trying. but to stop some of these stupid questions, can someone direct me to a good mysql tutorial because I don't want to bother you guys too much.
Bookmarks