I am low to medium skilled with MySQL and PHP... I am trying to write a simple script to handle an INSERT command into my database. The script should be simple, even though there are a lot of data fields. I have examined my code closely and I think it all looks correct, unless there have been some recent changes in the syntax. The PHP version on my hosting server is 5.3.27. Can anyone tell me why this does not insert any data from the html form I'm using? If you need the form code, I can post that, but I think it is probably something wrong here:
<?
//Rob's CompanyDataInsert handler
//DB CONNECTION INFO
mysql_connect("192.168.2.7", "user",
"pwd") or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ("nmlta_agents");
//Insert data into 'company' table
$insertData ="INSERT INTO company (id, company, comp_uw, comp_street, comp_po, comp_csz, comp_tf, comp_ph, comp_fx, comp_email, comp_web, comp_county, comp_type, contact1, cont1_title, cont1_email, contact2, cont2_title, cont2_email, contact3, cont3_title, cont3_email, contact4, cont4_title, cont4_email, contact5, cont5_title, cont5_email, contact6, cont6_title, cont6_email, contact7, cont7_title, cont7_email, contact8, cont8_title, cont8_email, contact9, cont9_title, cont9_email, contact10, cont10_title, cont10_email, branch1, br1_street, br1_csz, br1_ph, br1_fx, br1_cont1, br1_cont1_title, br1_cont1_email, br1_cont2, br1_cont2_title, br1_cont2_email, br1_cont3, br1_cont3_title, br1_cont3_email, branch2, br2_street, br2_csz, br2_ph, br2_fx, br2_cont1, br2_cont1_title, br2_cont1_email, br2_cont2, br2_cont2_title, br2_cont2_email, br2_cont3, br2_cont3_title, br2_cont3_email, branch3, br3_street, br3_csz, br3_ph, br3_fx, br3_cont1, br3_cont1_title, br3_cont1_email, br3_cont2, br3_cont2_title, br3_cont2_email, br3_cont3, br3_cont3_title, br3_cont3_email, branch4, br4_street, br4_csz, br4_ph, br4_fx, br4_cont1, br4_cont1_title, br4_cont1_email, br4_cont2, br4_cont2_title, br4_cont2_email, br4_cont3, br4_cont3_title, br4_cont3_email, branch5, br5_street, br5_csz, br5_ph, br5_fx, br5_cont1, br5_cont1_title, br5_cont1_email, br5_cont2, br5_cont2_title, br5_cont2_email, br5_cont3, br5_cont3_title, br5_cont3_email) VALUES ('', '".$_POST['company']."', '".$_POST['comp_uw']."', '".$_POST['comp_street']."', '".$_POST['comp_po']."', '".$_POST['comp_csz']."', '".$_POST['comp_tf']."', '".$_POST['comp_ph']."', '".$_POST['comp_fx']."', '".$_POST['comp_email']."', '".$_POST['comp_web']."', '".$_POST['comp_county']."', '".$_POST['comp_type']."', '".$_POST['contact1']."')", '".$_POST['cont1_title']."')", '".$_POST['cont1_email']."', '".$_POST['contact2']."', '".$_POST['cont2_title']."', '".$_POST['cont2_email']."', '".$_POST['contact3']."', '".$_POST['cont3_title']."', '".$_POST['cont3_email']."', '".$_POST['contact4']."', '".$_POST['cont4_title']."', '".$_POST['cont4_email']."', '".$_POST['contact5']."', '".$_POST['cont5_title']."', '".$_POST['cont5_email']."', '".$_POST['contact6']."', '".$_POST['cont6_title']."', '".$_POST['cont6_email']."', '".$_POST['contact7']."', '".$_POST['cont7_title']."', '".$_POST['cont7_email']."', '".$_POST['contact8']."', '".$_POST['cont8_title']."', '".$_POST['cont8_email']."', '".$_POST['contact9']."', '".$_POST['cont9_title']."', '".$_POST['cont9_email']."', '".$_POST['contact10']."', '".$_POST['cont10_title']."', '".$_POST['cont10_email']."', '".$_POST['branch1']."', '".$_POST['br1_street']."', '".$_POST['br1_csz']."', '".$_POST['br1_ph']."', '".$_POST['br1_fx']."', '".$_POST['br1_cont1']."', '".$_POST['br1_cont1_title']."', '".$_POST['br1_cont1_email']."', '".$_POST['br1_cont2']."', '".$_POST['br1_cont2_title']."', '".$_POST['br1_cont2_email']."', '".$_POST['br1_cont3']."', '".$_POST['br1_cont3_title']."', '".$_POST['br1_cont3_email']."', '".$_POST['branch2']."', '".$_POST['br2_street']."', '".$_POST['br2_csz']."', '".$_POST['br2_ph']."', '".$_POST['br2_fx']."', '".$_POST['br2_cont1']."', '".$_POST['br2_cont1_title']."', '".$_POST['br2_cont1_email']."', '".$_POST['br2_cont2']."', '".$_POST['br2_cont2_title']."', '".$_POST['br2_cont2_email']."', '".$_POST['br2_cont3']."', '".$_POST['br2_cont3_title']."', '".$_POST['br2_cont3_email']."', '".$_POST['branch3']."', '".$_POST['br3_street']."', '".$_POST['br3_csz']."', '".$_POST['br3_ph']."', '".$_POST['br3_fx']."', '".$_POST['br3_cont1']."', '".$_POST['br3_cont1_title']."', '".$_POST['br3_cont1_email']."', '".$_POST['br3_cont2']."', '".$_POST['br3_cont2_title']."', '".$_POST['br3_cont2_email']."', '".$_POST['br3_cont3']."', '".$_POST['br3_cont3_title']."', '".$_POST['br3_cont3_email']."', '".$_POST['branch4']."', '".$_POST['br4_street']."', '".$_POST['br4_csz']."', '".$_POST['br4_ph']."', '".$_POST['br4_fx']."', '".$_POST['br4_cont1']."', '".$_POST['br4_cont1_title']."', '".$_POST['br4_cont1_email']."', '".$_POST['br4_cont2']."', '".$_POST['br4_cont2_title']."', '".$_POST['br4_cont2_email']."', '".$_POST['br4_cont3']."', '".$_POST['br4_cont3_title']."', '".$_POST['br4_cont3_email']."', '".$_POST['branch5']."', '".$_POST['br5_street']."', '".$_POST['br5_csz']."', '".$_POST['br5_ph']."', '".$_POST['br5_fx']."', '".$_POST['br5_cont1']."', '".$_POST['br5_cont1_title']."', '".$_POST['br5_cont1_email']."', '".$_POST['br5_cont2']."', '".$_POST['br5_cont2_title']."', '".$_POST['br5_cont2_email']."', '".$_POST['br5_cont3']."', '".$_POST['br5_cont3_title']."', '".$_POST['br5_cont3_email']."')";
$insert = mysql_query($insertData);
if(!$insert){
echo "\nPDO::errorInfo():\n";
}
else {
echo "Database Updated Successfully!";
}
?>
The data does not get inserted into my database, and there is absolutely no error message to give me any clue. Any help will be appreciated - Thanks.