Re: if (isset(x)) problem

by "Srinivasan Ramakrishnan" <srinivar(at)md3.vsnl.net.in>

 Date:  Thu, 8 Mar 2001 18:59:35 +0530
 To:  =?iso-8859-1?Q?Martin_Skj=F6ldebrand?= <chimbis(at)skjoldebrand.org>,
<hwg-languages(at)hwg.org>
 References:  telia
  todo: View Thread, Original
The PHP code looks fine, but I'm bothered about the SQL, check the value of
$mysql_result

$mysql_result = mysql_query($query, $mysql_link) or die("Error");

if($mysql_result){
    // your output stuff here...
}

One more thing there is a function called mysql_result(), so avoid naming
variables like $mysql_result, this may cause some confusion to people who
read your code.

-Srini



----- Original Message -----
From: "Martin Skj�ldebrand" <chimbis(at)skjoldebrand.org>
To: <hwg-languages(at)hwg.org>
Sent: Thursday, March 08, 2001 10:06 AM
Subject: PHP: if (isset(x)) problem


: I'm going completely bonkers over this. Any suggestions appreciated.
: I'm a newbie at PHP/MySQL so I'm not sure what I'm doing wrong here. Below
is
: the end of a routine I'm hacking which will modify client info (I've
managed
: ADD and REMOVE and displaying data in the form below works). Clicking the
: submit button (name cmdFinish) doesn't make the routine go on to update
the
: database, it just moves back to the start of Modify Client without
updating
: the database.
:
: What am I missing?
:
: 8< -------------- code --------------------->8
:
: <tr>
:           <td width="50%" valign=center align=right>
:             <font size=3>Email:</font>
:           </td>
:           <td width="50%">
:             <input type=text name="txtEmail" size=20 value = "<?echo
: $cl_email?>">
:           </td>
:         </tr>
:       </table>
:     <p align=center>
:       <center>
:       <input type="submit" value="Modify client" name="cmdFinish">
:       </td>
:       </center>
:   </tr>
: </table>
: </center>
: </div>
: </form>
:
: <?php    //OK we can commit our changes ...
:   if (isset($cmdFinish)) {
:  $query = "UPDATE client SET ";
:       $query .= "cl_login ='$txtLogin', ";
:       $query .= "cl_firstname ='$txtFirstname', ";
:       $query .= "cl_secondname ='$txtSecondname', ";
:       $query .= "cl_phone = '$txtPhone', ";
:       $query .= "cl_type = '$txtType', ";
:       $query .= "cl_dept = '$txtDept', ";
:       $query .= "cl_compID = '$txtCompID', ";
:       $query .= "cl_email = '$txtEmail' ";
:       $query .= "WHERE cl_login = '$lstModifyClient';";
:       $mysql_result = mysql_query($query, $mysql_link);
: print "<CENTER><BR><BR>\n";
: print "$txtLogin has been successfully modified!<BR><BR></CENTER>\n";
: exit;
:          }
:
: ?>
:

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA