i dont know why but sometimes i use the same exact thing ive used on other pages that it has worked for and it just doesnt work on the new page im working on.
i have a table called users. with columns called username password and status why isnt this working:

$var1 = "test1";
$var2 = "no app";
mysql_query("INSERT INTO users(`username`, `password`, `status`) VALUES('$var1', '$var2', '$var2')");

it also does not work if i take out the ` marks and when i add a $this = mysql....

i dont know why but sometimes i use the same exact thing ive used on other pages that it has worked for and it just doesnt work on the new page im working on.
i have a table called users. with columns called username password and status why isnt this working:

$var1 = "test1";
$var2 = "no app";
mysql_query("INSERT INTO users(`username`, `password`, `status`) VALUES('$var1', '$var2', '$var2')");

it also does not work if i take out the ` marks and when i add a $this = mysql....

try this

mysql_query("INSERT INTO users(`username`, `password`, `status`) VALUES('".$var1."', '".$var2."', '".$var2."')");

its still NOT WORKING. i dont know why ive used my previous code on every single thing basically that ive made so far. i just dont understand why it doesnt work sometimes....

its still NOT WORKING. i dont know why ive used my previous code on every single thing basically that ive made so far. i just dont understand why it doesnt work sometimes....

could u tell me the error message?

theres NO error message. i just keep checking the table everytime i go to the page and theres no row.. omgawd. i forgot to conect to the database. oppseis.
anyways thanks for helping. but i have another question. do u know how i can insert straight text into the database. instead of using variables cause just having like

VALUES('THETEXT', 'TEXTMORE'

doesnt work for me

theres NO error message. i just keep checking the table everytime i go to the page and theres no row.. omgawd. i forgot to conect to the database. oppseis.
anyways thanks for helping. but i have another question. do u know how i can insert straight text into the database. instead of using variables cause just having like

VALUES('THETEXT', 'TEXTMORE'

doesnt work for me

dont see any reason y u cant. but what so practical about it. or as Simon would say "wots the dream 'ere?" :D

dont see any reason y u cant. but what so practical about it. or as Simon would say "wots the dream 'ere?" :D

huh?

huh?

hehe, i meant that it shud work. and I asked y would u want to do that in the first place.

for example in ur case,

mysql_query("INSERT INTO users(`username`, `password`, `status`) VALUES('myusername', 'mypass', 'hehe')");

would work just fine.

oh man thanks a lut

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.