rallokkcaz Posted April 25, 2007 Share Posted April 25, 2007 im wondering how to submit info into a database. i know the code goes something lie $sql = "UPDATE <tablename> set $var = "var" but i know that is wrong and i want to put it in form so on submit it posts it in the database any help? Thanks. Link to comment https://forums.phpfreaks.com/topic/48682-how-to-send-info-to-database-noob-at-this/ Share on other sites More sharing options...
Anzeo Posted April 25, 2007 Share Posted April 25, 2007 UPDATE is used for editting already existing data in your table. When your creating a new record you need to use this $sql = "INSERT INTO tablename (Columnname1,Columnname2,...)"."VALUES ('$value1', '$value2', ...)"; Regards, Anzeo Link to comment https://forums.phpfreaks.com/topic/48682-how-to-send-info-to-database-noob-at-this/#findComment-238458 Share on other sites More sharing options...
Mr. R Posted April 25, 2007 Share Posted April 25, 2007 thats when you want to update a field that already has something in.. you want somehting like.. $sql = "INSERT into $table VALUES ('blah', 'blah')"; Link to comment https://forums.phpfreaks.com/topic/48682-how-to-send-info-to-database-noob-at-this/#findComment-238459 Share on other sites More sharing options...
Mr. R Posted April 25, 2007 Share Posted April 25, 2007 lol beat me to it Link to comment https://forums.phpfreaks.com/topic/48682-how-to-send-info-to-database-noob-at-this/#findComment-238461 Share on other sites More sharing options...
rallokkcaz Posted April 25, 2007 Author Share Posted April 25, 2007 i want to update fields not make a new one. and how exactly would i put that in form? edit: wait, am i looking at this wrong ?? i think i am Link to comment https://forums.phpfreaks.com/topic/48682-how-to-send-info-to-database-noob-at-this/#findComment-238462 Share on other sites More sharing options...
SkyRanger Posted April 25, 2007 Share Posted April 25, 2007 There are alot of excellent tutorials on php mysql. Do a search on google for php mysql tutorial and it will bring up tons. There are also tutorials on the front page of phpfreaks. That is how I learned how to do alot of my php/mysql. for update you would need something like "update table_name set name='$name', name2='name2', etcifmore where id='$id'" Link to comment https://forums.phpfreaks.com/topic/48682-how-to-send-info-to-database-noob-at-this/#findComment-238471 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.