Hello user,

ill take a look only into this....

udi>   // UPDATE THE DATABASE
udi>   $sql = "UPDATE fantasytoo SET o1 = \"$o1\",w1 = \"$w1\",c1 = 
udi> \"$c1\",o2 = \"$o2\",w2 = \"$w2\",c2 = \"$c2\",en = \"$en\",wc = 
udi> \"$wc\",ot = \"$ot\" WHERE realname = \"$realname\" ";
udi> }

well here u use first $sql......i cant see no mysql_query....like this
one..:
$result = mysql_query($sql) or die "Cannot update database...";

udi> if ($realname) {
udi> // query the database
udi> $sql = "select * from fantasytoo where realname = \"$realname\" and 
udi> email = \"$email\"";
udi> $result = mysql_query($sql);
udi> while ($myrow = mysql_fetch_array($result)) {
udi> printf($result);

here is another $sql....after execution of first UPDATE thing you set
$sql to UPDATE bla bla.....then here u set it to SELECT * from bla
bla...i recommend using for each sql string in one script various
variables like $sql1 = "UPDATE bla bla"; and $sql2 = "SELECT bla bla";
for better reading....

-- 
Best regards,
 Martin                            mailto:corwin@;corwin.sk

Monday, October 28, 2002, 5:09:22 PM, you wrote:

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

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

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