Aesop Posted January 27, 2005 Share Posted January 27, 2005 Hello! This is my first real attempt at writing php to work with mysql and I am a DW user. Now when i test this page on apache, the form accepts all the data input, press submit, and I recieve no errors on screen. I check the db, and theres nothing there. Below I will supply the form and then the php file thats used for action: the form: <form name="updatebldg" method="post" action="bldgupdate.php"> <table width="105%" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <tr> <td colspan="5" bordercolor="#990000" bgcolor="#FFFFFF"><div align="center"><strong>Update Building Record </strong></div></td> </tr> <tr> <td width="18%" bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">TMK:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="tmk" type="text" value="" size="20" maxlength="20"> </div></td> <td width="2%" bgcolor="#FFFFFF"> </td> <td width="24%" bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Owner:</div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="owner" type="text" id="owner" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Address:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="address" type="text" id="strnum4" size="20" maxlength="8"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Land Area: </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="landarea" type="text" id="landarea" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Property:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="propname" type="text" id="propname" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Living Area: </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="bldgarea" type="text" id="bldgarea" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Neighborhood:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="neighborhood" type="text" id="neigh6" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Assessed Land Value: </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="landvalue" type="text" id="landvalue" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">City:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="city" type="text" id="city" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Assessed Building Value:</div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="bldgvalue" type="text" id="bldgvalue" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Zip Code: </div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="zip" type="text" id="zip" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Number of Bldgs on Prop. </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="bldgsonprop" type="text" id="bldgsonprop" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Tenure:</div></td> <td bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="tenure" type="text" value="" size="20" maxlength="10"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Pitt:</div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="pitt" type="text" id="pitt2" size="20" maxlength="20"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Zoning:</div></td> <td bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="zoning" type="text" id="zoning2" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#FF0000" bgcolor="#FFF7E6"><div align="right"><strong>UPDATED DATE: </strong></div></td> <td bordercolor="#FF0000"><div align="left"> <input name="date" type="text" id="zoning3" size="20" maxlength="20"> </div></td> </tr> <tr> <td height="15" colspan="5"><div align="center"><input type="Submit" value="Update Record"></div></td> </tr> </table> </form> Now for the php file that supplies the action: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]<html> <body> [span style=\"color:#0000BB\"]<?php mysql_connect [/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"localhost\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"*****\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"*****\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]mysql_select_db [/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"chaneybrooks\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]mysql_query [/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"INSERT INTO bldgs (tmk, owner, address, landarea, propname, bldgarea, neighborhood, landvalue, city, bldgvalue, zip, bldgsonprop, pitt, tenure, zoning, date) VALUES (\'{$_POST[\'tmk\']}\', \'{$_POST[\'owner\']}\', \'{$_POST[\'address\']}\', \'{$_POST[\'landarea\']}\', \'{$_POST[\'propname\']}\', \'{$_POST[\'bldgarea\']}\', \'{$_POST[\'neighborhood\']}\', \'{$_POST[\'landvalue\']}\', \'{$_POST[\'city\']}\', \'{$_POST[\'bldgvalue\']}\', \'{$_POST[\'zip\']}\', \'{$_POST[\'bldgsonprop\']}\', \'{$_POST[\'pitt\']}\', \'{$_POST[\'tenure\']}\', \'{$_POST[\'zoning\']}\', \'{$_POST[\'date\']}\'\"[/span][span style=\"color:#007700\"]); print ([/span][span style=\"color:#DD0000\"]\"Building record updated.\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> [/span]</body> </html> [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Quote Link to comment Share on other sites More sharing options...
cx409 Posted February 1, 2005 Share Posted February 1, 2005 try inputting your mysql_connect(); as a variable and use it after both the after database selection and insert strings. if all else fails, use the die(mysql_error()); or simply mysql_error(); functions to find out what's wrong...however, these errors are usually impossible to understand, but you can always post back here! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.