1.

Solve : MySQL won't add to database?

Answer»

I have the select_db and connections and stuff done.. But this won't ADD anything..

Code: [SELECT]$q = mysql_query("INSERT INTO users (id, username, password, email, description, bucks)
VALUES ($id, $user, $pass, $email, '', 15) ");try this, just like this '15' and ;

$q = mysql_query("INSERT INTO users (id, username, password, email, description, bucks)
VALUES ($id, $user, $pass, $email, '', '15'); "); Quote

try this, just like this '15' and ;
DEPENDING on the data type of the SQL field. If it's an INT, then you'll want no QUOTES, if it's, for example TEXT, CHAR, VARCHAR, and so on, then you'll want quotes around it.

Quote from: Bannana97 on August 01, 2009, 01:53:40 PM
I have the select_db and connections and stuff done.. But this won't add anything..

Code: [Select]$q = mysql_query("INSERT INTO users (id, username, password, email, description, bucks)
VALUES ($id, $user, $pass, $email, '', 15) ");
This is one of those things that people get mixed up with. When inserting/updating database fields, you still have to use quotes around PHP variables for it to work.


Discussion

No Comment Found