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>



    <td width="100%" height="115"><html>


<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%"


      <td width="25%"><font size="4">User Name:</font></td>

      <td width="25%">

      <p><input name = "uname" type = "text" size="20"></p>


      <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"> 

                                         <option value = "BCS"> BCS</option>

                                         <option value = "B.Sc"> B.Sc</option>

                                         <option value = "MBA"> MBA</option>

                                         <option value = "MBA-IT"> 

                                         <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. .......



$db= mysql_connect("localhost","root","masood");

         $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"];

this give me error no 13, with uname,upasswd undefined, please help me out,

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?

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to