I'm having a problem getting my PHP script to talk to my database. I'm attempting to use UPDATE with a PHP form to change records already in the database. I'm able to pull the record with no problem and the script is sending the confirmation e-mail without a problem on submit but for some reason the MySQL query isn't being made. I've even tried "dummy" queries just to see if the connection was being made, but it's not. I'd appreciate any help. Following is the code:

<?php
// CONNECT TO DATABASE
$db = mysql_connect("localhost", "webmstr");
mysql_select_db("test",$db);
if ($submit) {
// SEND INFO IN EMAIL
mail("$email", "Picks", "Your entry has been changed.\nFirst Set Opener: $o1 \nFirst Set Wildcard: $w1 \nFirst Set Closer: $c1 \nSecond Set Opener: $o2 \nSecond Set Wildcard: $w2 \nSecond Set Closer: $c2 \nEncore: $en \nAcoustic Song: $ac \nWildcard: $wc \nOne Time Played: $ot \nFirst Time Played: $nw \n\nGood Luck!\nhttp://www.otherones.net";, "From: [EMAIL PROTECTED]");
// UPDATE THE DATABASE
$sql = "UPDATE fantasytoo SET o1 = \"$o1\",w1 = \"$w1\",c1 = \"$c1\",o2 = \"$o2\",w2 = \"$w2\",c2 = \"$c2\",en = \"$en\",wc = \"$wc\",ot = \"$ot\" WHERE realname = \"$realname\" ";
}
if ($realname) {
// query the database
$sql = "select * from fantasytoo where realname = \"$realname\" and email = \"$email\"";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result)) {
printf($result);
?>
<form method="post" action="edit.php?realname=<?php echo $myrow["realname"]?>&email=<?php echo $myrow["email"]?>">
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> <td valign="middle">
<div align="center"><font face="Comic Sans MS, Arial, sans-serif" size="3">
Fantasy TOO - Fall 2002 Signups</font> <br>
<font color="white">.</font></div>
</td>
</tr>
</table>
<table border="0" width="600" cellspacing="0" cellpadding="0" align="center">
<tr> <input type=hidden name="realname" value="<?php echo $myrow["realname"]?>">
<input type=hidden name="email" value="<?php echo $myrow["email"]?>">

<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> Name: </strong></font></td>
<td width="450"><font face="Arial" size="2"><?php echo $myrow["realname"]?></font></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong>E-mail
Address: </strong></font></td>
<td width="450"><font face="Arial" size="2"><?php echo $myrow["email"]?></font></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong>1st
Set Opener (8): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="o1"><option selected><?php echo $myrow["o1"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_o1.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> 1st
Set Wildcard (4): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="w1"><option selected><?php echo $myrow["w1"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_w1.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> 1st
Set Closer (6): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="c1"><option selected><?php echo $myrow["c1"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_c1.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> 2nd
Set Opener (8): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="o2"><option selected><?php echo $myrow["o2"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_o2.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> 2nd
Set Wildcard (4): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="w2"><option selected><?php echo $myrow["w2"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_w2.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> 2nd
Set Closer (6): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="c2"><option selected><?php echo $myrow["c2"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_c2.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> Encore
(5): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="en"><option selected><?php echo $myrow["en"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_en.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> Wildcard
(2): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="wc"><option selected><?php echo $myrow["wc"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_wc.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150"><font color="#FF0000" face="Arial" size="2"><strong> One
Time Played (15): </strong></font></td>
<td width="450"><strong><font face="Arial" size="2">
<select name="ot"><option selected><?php echo $myrow["ot"]?></option>
<?php include ('c.php3');
?>
</select>
<font size="1">[<a href="javascript:pop('this_ot.html')">What's This?</a>]</font></font></strong></td>
</tr>
<tr>
<td width="150" valign="top">
<div align="left">
<p>&nbsp;
</div>
</td>
<td width="450">
<div align="center">
<center>
<p><font face="Arial" size="2">
<input type="Submit" name="submit" value="Submit Entry">


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to