last question, i promise, lol

matzomeal

New Member
Messages
4
Reaction score
0
Points
0
PHP:
$sql = "INSERT INTO $dbname.$tblname (name,password,email,user_id) VALUES($username,$pass,$email,NULL)";

that code isn't working. anyone know why?
 
Last edited:

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
unless you're calling

mysql_query($sql);

you need:

PHP:
$sql = mysql_query("INSERT INTO $dbname.$tblname (name,password,email,user_id) VALUES($username,$pass,$email,NULL)");
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
Are all of your variables defined? I.e. $dbname
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Another one: can field user_id be NULL? What's the definition for the user_id column?
 

ichwar

Community Advocate
Community Support
Messages
1,454
Reaction score
7
Points
0
I've got a question, are table names case sensetive? What I mean is: is ichwar going to be different from ICHWAR or IcHwAr?
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
ok, humm, that's not good, oh well. I'll have to find a work around.

php has the function strtolower() to make all letters lowercase and mysql has the function LOWER() which does the same.
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
matzomeal, what do you mean by not working?

If you mean not executing, then try as leafypiggy said.
If you mean that you get a php error stating that a variable is not defined, then define all you variables, as lemon-tree said.
If you are getting a false result from mysql_query, then do a var_dump on the sql variable, and copy the value in PhpMyAdmin. This will point out any error in your query.
 
Top