Jump to content


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


Dynamic Insert into SQL

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
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"));
but it is not liking the 1st %s code in the 'INSERT INTO %s'

Anyone know how i can remedy this???

Share this post

Link to post
Share on other sites


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.