Hello, I am trying to clean up my code and eliminate some extra code.
What I have is this:
$id = $_POST['id'];
$date = $_POST['date'];
mysql_query("INSERT INTO `BILLING` (id, date) VALUES ('$id', ' $date')") or die(mysql_error());
In this example I only added $id and $date but that mysql table has about 100 columns and therefore this mysql query is very long and there are about 100 lines like the first two...
In other words the first two lines (and all the others in the real life script) are the ones I am trying to get rid of but I can't figure out how to put the $_POST variables inside the query.
Obviously the following does not work:
mysql_query("INSERT INTO `BILLING` (id, date) VALUES ('$_POST['id']', '$_POST['date']')") or die(mysql_error());
I tried several combinations of escaping quotes and several combinations of quotes (single, double etc) but I can't seem to find a way to write everything in one line.
Can somebody help me figure it out? Or must I have those 100 $var = $_POST['var'] lines before the query line?
Thanks