MySQL with PHP plz help..

They have: 71 posts

Joined: Aug 2001

a very simple question i think but i dont know how to do it..

in php you have to use commands like mysql_query etc what is that command if u want to insert into the database?

thanks
adam.

----

ugh, sorry it works with mysql_query i had a typo lol Smiling

sersun's picture

They have: 32 posts

Joined: Aug 2001

I assume you already are connected to the database, using
mysql_connect() and mysql_select_db()

For simplicity, first create your SQL statement as a separate variable, then run the query:

$sql = "INSERT INTO tablename (apples, oranges) " .
"VALUES('$apples', '$oranges')";

mysql_query($sql);

Hope that helps Smiling

sersun

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.