Hello,
I am trying to create a mysql function for insert and update:
I want to be able to take an array from the form post and create the correct sql syntax.
So lets say I have a database table named "test"
and in that I have these fields:
client_name
tollfree
phone
fax
so when a user fills out the form this is the $_POST array:
Array ( [client_name] => ChrisCorp [tollfree] => 800 [phone] => 503 [fax] => 555 )
So I need to figure out how to take the above array and make it look like this for the update:
$update = "client_name='ChrisCorp', tollfree='800', phone='503', fax='555'";
and look like this for an insert:
$fields = "client_name, tollfree, phone, fax";
$values = "'ChrisCorp','800',503','555'";
Then I could do a update function and an insert function. If this is possible it would prevent having to constantly type sql syntax it would all be done "on the fly"
Any ideas or php functions would be verry helpfull.
Thank You,
Chris Wheat