Hi.

I am having problems getting PHP to insert data into a MYSQL data base. I am using the following variations of syntax.

mysql_query("INSERT INTO table member VALUES ('$var1', '$var2', '$var3')")
			or die("couldn't add new user");

and also with session variables as well

mysql_query("INSERT INTO table member VALUES ('$_SESSION[$var1]', '$_SESSION[$var2], '$_SESSION[$var3]')")
			or die("couldn't add new user");

i have put all these through a print statement to make sure the variables ae set and they print in the same block of code so i have no idea what i am doing wrong.?

i dont know/

U need to specify the table structure to solve this.
The above code will work only if all the field types varchar or similar types, i mean those cannot be an int.

if that is not ur problem try specify which each column like

INSERT INTO table member (c1,c2,c3) VALUES ('$var1', '$var2', '$var3')

I am not really sure what i was doing wrong.... All I done is completely re-write that section of code, i can see i missed a ' in my examples bt i was copyig and pasting and they were in my origional code...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.