Jump to content

Dynamic Insert into SQL


dalton6275

Recommended Posts

I have an 'insert into database' code which i am trying to make the table the information is inserted to dependant on a URL variable i am carrying across from the previous page.

My code is
[code]
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO %s (Monthref, percentage) VALUES (%s, %s)",
                       GetSQLValueString($_POST['sla'], "text"),
                       GetSQLValueString($_POST['month'], "date"),
                       GetSQLValueString($_POST['slapercent'], "int"));
[/code]
but it is not liking the 1st %s code in the 'INSERT INTO %s'

Anyone know how i can remedy this???
Link to comment
https://forums.phpfreaks.com/topic/7117-dynamic-insert-into-sql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.