Re: help newbies :)

From: Date: Thu, 23 Dec 2004 16:09:07 +0000
Subject: Re: help newbies :)
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-37823@lists.php.net to get a copy of this message
Nayyar Ahmed wrote:
Hello All, I am developing attendence mangement system, its my first application in PHP, I want to compaire the input text box value with table records the follwing is the code _____________index.htm_______________ .......... <form name = 'loginfrm' method = post action = "index.php" >
  <pre>    	</td>
</tr> <tr>
    <td width="100%" height="115"><html>
<body> <div style="mso-border-alt: solid #AAAAFF .75pt; width: 675; height: 234; border: 1.0pt solid #AAAAFF; padding: 6.0pt; background: #EEEEFF"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
    <tr>
      <td width="25%"><font size="4">User Name:</font></td>
      <td width="25%">
      
      <p><input name = "uname" type = "text" size="20"></p>
      </td>
      <td width="25%"><font size="4">&nbsp;&nbsp;&nbsp;&nbsp; Class:</font></td>
      <td width="25%"> <select name= "class">
      					 <option value = "BBA"> BBA</option>
      					 <option value = "BBA-IT"> BBA-IT</option>
      					 <option value = "BCS"> BCS</option>
      					 <option value = "B.Sc"> B.Sc</option>
      					 <option value = "MBA"> MBA</option>
      					 <option value = "MBA-IT"> MBA-IT</option>
      					 <option value = "MS-IT"> MS-IT</option>
      					 <option value = "MS-CS"> MS-CS</option>
      					 <option value = "Admin"> Admin</option>
      					</select> </td>
      <td width="25%"><font size="4">Password:</font></td>
      <td width="25%"><input name ="passwd" type = "password" size="20"> </td>
etc. etc. ....... _____________________________________________________ _________index.php_____________ <?php $db= mysql_connect("localhost","root","masood"); mysql_select_db("attendence",$db); $result= mysql_query("select uname,upasswd from user",$db); while ($myrow = mysql_fetch_array($result)) { if(($uname == $myrow["uname"]) && ($upasswd == $myrow["uname"]));
firstly the preceeding line should probably be: if(($uname == $myrow["uname"]) && ($upasswd == $myrow["upasswd"]));
{ echo $myrow["uname"]; echo $myrow["upasswd"]; } } ?> </body> </html> this give me error no 13, with uname,upasswd undefined, please help me out, TIA
get familiar with the var_dump() and print_r() functions. for instance what does the following output: $result= mysql_query("select * from user",$db); while ($myrow = mysql_fetch_array($result)) { print_r( $myrow ); } are the indexes 'uname' and 'upasswd' defined in each dumped array?


« previous php.db (#37823) next »