Hiya i'm doing a trying to get my update to work propperly and have looked over the code for a couple days trying to figure out why its not working mysql_error() shows query is empty .. though i can't figure out why that is. could some one please have a look at the code for me and offer some suggestions as why i get this?
Thanks peter
if ($submit){
//connect to the mysql server and database
$db = mysql_pconnect("localhost","root","password");
mysql_select_db("rentdb",$db);
// insert into the data base
$rs = mysql_query("INSERT INTO app (id,name,company,address,suburb,state,post,areacode,phone,faxareacode,fax,email) VALUES ('$id','$name','$company','$address','$suburb','$state','$post','$areacode','$phone','$faxareacode','$fax','$email')");
//if name then update the data base
if($name){
$rs = mysql_query("UPDATE app SET name='$name',company='$company',address='$address',suburb='$suburb',state='$state',post='$post',areacode='$areacode',phone='$phone',faxareacode='$faxareacode',fax='$fax',email='$email' WHERE name=$name");
$result = mysql_query($rs);
echo "<p><p>";
echo "<TABLE BORDER=0 WIDTH=800 >";
echo "<tr><td>";
?>
<table border="0" width="650" align="center">
<tr>
<td>
<font face="Helvetica, sans-serif" size="3" color="#00499C"> Please Check your information, and change any details that are not correct, then click update.<br>
if this information is correct <a href="thankyou.html">click here</a>.</font><p>
</td>
</tr>
</table>
<form name=check method="POST" action="">
<?
echo "<input type=hidden name=id value='$id'>\n";
echo "<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=1 WIDTH=500 BGCOLOR=#990033 ALIGN=CENTER>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td colspan=2 bgcolor=#006699><div align=center>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF><b>The information you entered is:</b></font>\n";
echo "</div></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF><b>Your Name:</b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=name value='$name'></font></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFF><b>Company:</b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=company value='$company'></font></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF width=180><b>Address:<b></b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=address value='$address'></font></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo"<font face=Helvetica, sans-serif size=3 color=#FFFFFF width=180><b>Suburb:<b></b></font></td>\n";
echo"<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=suburb value='$suburb'></font></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF width=180><b>State:<b></b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=state value='$state'></font></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>";
echo "<td bgcolor=#006699 width=122>";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF width=180><b>Post Code:<b></b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=post value='$post'></font></td></tr>\n\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF width=180><b>Phone:<b></b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=areacode SIZE=2 MAXLENGTH=2 value='$areacode'><input type=text name=phone value='$phone'></font></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF width=180><b>Fax:<b></b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=faxareacode SIZE=2 MAXLENGTH=2 value='$faxareacode'><input type=text name=fax value='$fax'></font></td></tr>\n";
echo "<tr BGCOLOR=#CCCCCC>\n";
echo "<td bgcolor=#006699 width=122>\n";
echo "<font face=Helvetica, sans-serif size=3 color=#FFFFFF width=180><b>Email Address:<b></b></font></td>\n";
echo "<td><div align=center><font face=Helvetica, sans-serif size=3 color=#000000><input type=text name=email value='$email'></font></td></tr>\n";
echo "<tr><td colspan=2 bgcolor=#CCCCCC><div align=center><input type=submit name=submit value=update></div></td>\n</tr>\n</table>\n</form><p>\n";
?>
<font face="Helvetica, sans-serif" size="3" color="#00499C"><b>* Please Include your area code with your phone & fax number.</b></font>
<?
echo "</td></tr></table>\n";
}
} else {
?> <table width="800" border="0"> <tr> <td height="485"> <form method="post" action="" name="app"><br><input type="hidden" name="id" value="<?$id?>">
<blockquote>
<table width="700" border="0">
<tr>
<td width="64" height="2"><font face="Helvetica, sans-serif" size="3" color="#00499C">Name:</td><td width="626" height="2">
<input type="text" name="name">
</td>
</tr>
<tr>
<td width="64" height="2"><font face="Helvetica, sans-serif" size="3" color="#00499C">Company:</td>
<td width="626" height="2">
<input type="text" name="company">
</td>
</tr>
<tr> <td width="64" height="2"><font face="Helvetica, sans-serif" size="3" color="#00499C">Address:</td>
<td width="626" height="2">
<input type="text" name="address" size="35"><font face="Helvetica, sans-serif" size="3" color="#00499C">Suburb: <input type="text" name="suburb">
<tr><td></td><td><font face="Helvetica, sans-serif" size="3" color="#00499C"> State:
<select name="state" size="1">
<option value="Canberra">ACT</option>
<option value="New South Wales">NSW</option>
<option value="Northern Territory">NT</option> <option value="Queensland">QLD</option>
<option value="South Australia">SA</option>
<option value="Tasmania">TAS</option>
<option value="Victoria">VIC</option>
<option value="Western Australia">WA</option>
</select>
<font face="Helvetica, sans-serif" size="3" color="#00499C"> Post Code: <input type="text" name="post" size="4"> </td></tr>
<tr><td width="64" height="2"><font face="Helvetica, sans-serif" size="3" color="#00499C">Phone:</td>
<td width="626" height="2">
<SELECT NAME="areacode">
<OPTION VALUE="02">02</OPTION>
<OPTION VALUE="03">03</OPTION>
<OPTION VALUE="07">07</OPTION>
<OPTION VALUE="08">08</OPTION>
</SELECT>
<input type="text" name="phone" size="10" maxlength="9">
</td></tr> <tr> <td width="64" height="2"><font face="Helvetica, sans-serif" size="3" color="#00499C">Fax:</td><td width="626" height="2">
<SELECT NAME="faxareacode">
<OPTION VALUE="02">02</OPTION>
<OPTION VALUE="03">03</OPTION>
<OPTION VALUE="07">07</OPTION>
<OPTION VALUE="08">08</OPTION>
</SELECT>
<input type="text" name="fax"> </td></tr>
<tr> <td width="64" height="2"><font face="Helvetica, sans-serif" size="3" color="#00499C">Email:</td><td width="626" height="2">
<input type="text" name="email"> </td></tr> <tr>
<td width="64" height="2"> </td><td width="626" height="2">
<input type="submit" name="submit" value="Submit"> <input type="reset" name="submit2" value="Clear">
<p>
<font face="Helvetica, sans-serif" size="3" color="#00499C"><b>* Please Include your area code with your phone & fax number.</b></font>
</td>
</tr>
</table>
</blockquote>
</form>
<?
}
echo mysql_error();
?>