GreenFanta Posted November 17, 2010 Share Posted November 17, 2010 Hi there reader(s) I've been searching everywhere, and I'm not one to post my issue unless I've searched as hard as I could, I'm not new to PHP, but I am new to MySQL (so go easy on me) and I've got variables all set up, and I've successfully established connection to my Database and my Database's table, but now I cannot find a way to insert the data (variable) into a column of the table. Willing to provide more information! Quote Link to comment https://forums.phpfreaks.com/topic/219004-sql-inserting-into-a-table/ Share on other sites More sharing options...
mikosiko Posted November 17, 2010 Share Posted November 17, 2010 post your code Quote Link to comment https://forums.phpfreaks.com/topic/219004-sql-inserting-into-a-table/#findComment-1135765 Share on other sites More sharing options...
herghost Posted November 17, 2010 Share Posted November 17, 2010 <?php $sql="INSERT INTO tablename (columnname1, columnname2, columnname3) VALUES ('$variable1',''$variable2'',''$variable3'')"; if (mysql_query($sql)) { echo "data added"; } else { add failed } ?> Quote Link to comment https://forums.phpfreaks.com/topic/219004-sql-inserting-into-a-table/#findComment-1135802 Share on other sites More sharing options...
jcbones Posted November 17, 2010 Share Posted November 17, 2010 <?php $sql="INSERT INTO tablename (columnname1, columnname2, columnname3) VALUES ('$variable1','$variable2','$variable3')"; if (mysql_query($sql)) { echo "data added"; } else { echo 'add failed!'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/219004-sql-inserting-into-a-table/#findComment-1135814 Share on other sites More sharing options...
GreenFanta Posted November 19, 2010 Author Share Posted November 19, 2010 Thank you so much! Quote Link to comment https://forums.phpfreaks.com/topic/219004-sql-inserting-into-a-table/#findComment-1136938 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.