Jump to content

june_c21

Members
  • Posts

    280
  • Joined

  • Last visited

    Never

Everything posted by june_c21

  1. i got this error Parse error: syntax error, unexpected $end in /var/www/Web/RCA/rca.php on line 75 where it is a blank line . can someone tell me why and it is my code is wrong? i am new with php , please guide me. thanks in advance <style type="text/css"> <!-- .style2 { font-family: Times News Roman; font-size: 11px; } body { background-color: #CCFFFF; } .style6 { font-family: Arial; font-size: 14px; font-weight: bold; color: #FF0000; } .style5 { font-family: Arial; font-size: 12px; font-weight: bold; color: #000099; } .style10 {font-family: Times News Roman; font-size: 12px; } --> </style> <body> <form id="form1" name="form1" method="post" action="logout.php"> <label><div align="center"> <p class="style6">Root Cause Analysis </p> <p class="style2"><a href="logout.php">Logout</a></p> <p align="center" class="style10"><a href="home1.html">Home</a></p> </div> <div align="center"></div> </form> <?php $host = "localhost"; $user = "root"; $password = "admin"; $dbase = "rca"; $GF = $_POST ['GF']; $Year = $_POST ['Year']; if ($GF =='1' && $Year== '2006') { $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); echo "<table border=3 align=center width=100%>"; echo "<tr><td align=center><span class=style5>Reg ID.</td></span> <td align=center><span class=style5>Title</td></span> <td align=center><span class=style5>Incident Date</td></span> <td align=center><span class=style5>Fault Report ID</td></span> <td align=center><span class=style5>Report Received </td></span> <td align=center colspan=><span class=style5>Status </td></span> </tr>"; $query = "SELECT reg_no,title1,incident_date,fault_rep_id,secr_recd,status from report where unit='1' || unit='2' "; $result = mysql_query($query, $dblink); while($myrow = mysql_fetch_row($result)) { echo "<tr><td align=center><span class=style2>" . $myrow[0] . "</span</td><td align=center><span class=style2>" . $myrow[1] . "</span</td><td align=center><span class=style2>" . $myrow[2] . "</td></span><td><span class=style2>" . $myrow[3] . "</span></td><td align=center><span class=style2>" . $myrow[4] . "</span></td><td align=center><span class=style2>" . $myrow[5] . "</span></td></tr>"; } } else { echo "HELLO"; } echo "</table>"; ?>
  2. thanks barand. topic solved!!!!!
  3. now i redo the html file again <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="checking2.php"> <label>Name <input name="staff_no" type="text" id="staff_no" /> </label> <p> <label> <input type="submit" name="Submit" value="Submit" /> </label> </p> </form> </body> </html> php file <?php // echo " New Entry <a href=add.html>click here</a><br></br>"; $host = "localhost"; $user = "root"; $password = ""; $dbase = "claim"; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $staff_no = $_POST['staff_no']; echo "<table border=3 align=center width=90%>"; echo "<tr><td width=12% align=center><span class=style5>ID</td></span>"; echo "<td width=12% align=center><span class=style5>Month</td></span>"; echo "<td width=12% align=center><span class=style5>Start Date </td></span>"; echo "<td width=12% align=center><span class=style5>End Date</td></span>"; echo "<td align=center><span class=style5>Name</td></span>"; echo "<td align=center><span class=style5>Staff No</td></span>"; echo "<td align=center><span class=style5>Details</td></span>"; echo "<td align=center><span class=style5>Amount</td></span>"; echo "<td align=center><span class=style5>GL code</td></span>"; echo "<td width=12% align=center><span class=style5>Bank </td></span>"; echo "<td align=center ><span class=style5>Account No. </td></span>"; echo "<td align=center ><span class=style5>Total </td></span>"; echo "<td align=center colspan=3><span class=style5>Action </td></span></tr>"; $query = "SELECT report1.id, month, start_date, end_date, user.name, report1.staff_no,details,amount,gl_code,user.bank,user.acc_no FROM user,report1 WHERE report1.staff_no = '$staff_no'"; $result = mysql_query($query, $dblink); while($myrow = mysql_fetch_row($result)) { echo "<tr><td><span class=style2>" . $myrow[0] . "</span</td>"; echo "<td><span class=style2>" . $myrow[1] . "</span</td>"; echo "<td><span class=style2>" . $myrow[2] . "</span</td>"; echo "<td><span class=style2>" . $myrow[3] . "</td></span>"; echo "<td><span class=style2>" . $myrow[4] . "</span></td>"; echo "<td><span class=style2>" . $myrow[5] . "</span></td>"; echo "<td><span class=style2>" . $myrow[6] . "</span></td>"; echo "<td><span class=style2>" . $myrow[7] . "</span></td>"; echo "<td><span class=style2>" . $myrow[8] . "</span></td>"; echo "<td><span class=style2>" . $myrow[9] . "</span></td>"; echo "<td><span class=style2>" . $myrow[10] . "</span></td>"; $query1 = "SELECT SUM(amount) FROM report1 where staff_no = '$myrow[5]'"; $result1 = mysql_query($query1, $dblink); while ($myrow1 = mysql_fetch_row($result1)) { echo "<td><span class=style2>" .$myrow1[0]. "</span></td>"; } } echo "</table>"; ?> why when i input one particular staff_no, it display blank when i click on submit button
  4. <?php //$id=$_GET["id"]; $staff_no = $_POST['staff_no']; $host = 'localhost'; $user = 'root'; $password = ''; $dbase = 'claim'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $sql="SELECT report1.staff_no, user.name FROM report1 JOIN user ON report1.staff_no = user.staff_no WHERE report1.staff_no = '.$staff_no.'"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>Staff No</th> <th>Name</th> </tr>"; while($row = mysql_fetch_array($result)) { $report1_staffno = $row['report1.staff_no']; $username = $row['user.name']; echo "<tr>"; echo "<td>$report1_staffno</td>"; echo "<td>$username</td>"; echo "</tr>"; } echo "</table>"; ?> this is the user input code <html> <head> <script src="selectuser.js"></script> </head> <body><form id="form1" name="form1" method="post" action="checking.php"> <p><strong>KEV Tool Store - Loan Transaction Page</strong></p> <table width="497" border="0"> <tr> <td width="284">Choose</td> <td width="203"><select name="staff_no" onChange="showUser(this.value)"> <?php $host = 'localhost'; $user = 'root'; $password = ''; $dbase = 'claim'; $dblink = mysql_connect($host, $user, $password); mysql_select_db($dbase, $dblink); $query = "SELECT staff_no FROM user ORDER BY staff_no "; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $staffno = $row['staff_no']; echo "<option value=\"$staffno\">$staffno</option>"; } ?> </select></td> </tr> <tr> <td colspan="2"><p> <div id="txtHint"><b>info will be listed here.</b></div> </p> </td> </tr> </table> <p> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form></body> </html> this whole code just can't get me the name and staff no when user input their staff_no . why? i been trying for 3 days....
  5. barand, why it came out blank instead of showing the staff_no and name? anything i miss out?
  6. report1 is a table name user is another table name i need to match report1.staff_no (databse) with user input staff_no and then based on both table got staff_no, i will take the name from user table that match with the user input staff_no
  7. ok, i test and this code got error SELECT report1.staff_no, user.name FROM report1,user WHERE report1.staff_no = '$staff_no' when i replace sk200023 into $staff_no all the name in the database will came out and they auto change their staff_no into sk200023. why?
  8. sorry .. is still doesn't work. it came out blank only
  9. why my code can't execute? when i execute, it output all the staff_no, name instead of specific staff_no only <?php //$id=$_GET["id"]; $staff_no = $_POST['staff_no']; $host = 'localhost'; $user = 'root'; $password = ''; $dbase = 'claim'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $sql="SELECT report1.staff_no, user.name FROM report1,user WHERE report1.staff_no = '".$staff_no."'"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>Staff No</th> <th>Name</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[0] . "</td>"; echo "<td>" . $row[1] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  10. what do you mean? sorry... i don't understand.
  11. hi, can someone tell me what is the error of this code. i try it many times but in the drop down menu there is no data that i select from the database . Select a User: <select name="staff no " onChange="showUser(this.value)"> <?php $host = 'localhost'; $user = 'root'; $password = ''; $dbase = 'claim'; $dblink = mysql_connect($host, $user, $password); mysql_select_db($dbase, $dblink); $query = "SELECT staff_no FROM user ORDER BY staff_no "; $result = mysql_query($query); while($myrow = mysql_fetch_row($result)) { echo "<option value=\"" . $myrow[0] . "\">" ; echo "</option>";}
  12. no .. it still doesnt work. please help and guide me more. i am new. thanks in advances
  13. but that haven't solve my problem. i need to output the user that have the same staff no not all the user. i wrote SELECT report1.id, month, start_date, end_date, user.name, report1.staff_no, details, amount, gl_code, user.bank, user.acc_no FROM user, report1 WHERE report1.staff_no = '$name' but it output all the staff.
  14. it came out all the username from database and changed their stuff_no into same staff_no. (250 records)
  15. the result still the same.... can someone please help me..... brian, thanks for your code... but it doesn't work..
  16. ok, first this is my html coding where user can chose the staff_no and click on submit. once submit, it will find in the database the same staff_no that match the one user select. if it is yes, it will display the records base on the staff_no . <html> <head> <script src="selectuser.js"></script> </head> <body><form id="form1" name="form1" method="post" action="checking.php"> <p><strong>KEV Claim</strong></p> <table width="497" border="0"> <tr> <td width="284">Claim</td> <td width="203"><select name="name" id="name" onChange="showUser(this.value)"> <?php $host = 'localhost'; $user = 'root'; $password = 'admin'; $dbase = 'claim'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $query = "SELECT staff_no, name from user order by name "; $result = mysql_query($query); while($myrow = mysql_fetch_row($result)) { echo "<OPTION VALUE=\"" . $myrow[0] . "\">" . $myrow[1]."</OPTION>"; } ?> </select></td> </tr> </table> <p> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form></body> </html> <?php $host = "localhost"; $user = "root"; $password = "admin"; $dbase = "claim"; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); echo "<table border=3 align=center width=90%>"; echo "<tr><td>ID</td>"; echo "<td>Month</td>"; echo "<td>Start Date </td>"; echo "<td>End Date</td>"; echo "<td>Name</td>"; echo "<td>Staff No</td>"; echo "<td>Details</td>"; echo "<td>Amount</td>"; echo "<td>GL code</td>"; echo "<td>Bank </td>"; echo "<td>Account No. </td><tr>"; $name = $_POST['name']; $query = "SELECT report1.id, month, start_date, end_date, user.name, report1.staff_no, details, amount, gl_code, user.bank, user.acc_no FROM user, report1 WHERE report1.staff_no = '$name'"; $result = mysql_query($query, $dblink); while($myrow = mysql_fetch_array($result)) { echo "<tr><td>" . $myrow[0] . "</td>"; echo "<td>" . $myrow[1] . "</td>"; echo "<td>" . $myrow[2] . "</td>"; echo "<td>" . $myrow[3] . "</td>"; echo "<td>" . $myrow[4] . "</td>"; echo "<td>" . $myrow[5] . "</td>"; echo "<td>" . $myrow[6] . "</td>"; echo "<td>" . $myrow[7] . "</td>"; echo "<td>" . $myrow[8] . "</td>"; echo "<td>" . $myrow[9] . "</td>"; echo "<td>" . $myrow[10] . "</td></tr>"; } echo "</table>"; ?>
  17. Brian, the result still the same. all data came out when i click on submit button.
  18. it still the same. all the data will come out instead of match report1.staff_no = '$name' only. why?
  19. now there is no error. thanks for all the help . but why when i wrote $name = $_POST['name']; $query = "SELECT report1.id,month,start_date,end_date,user.name,report1.staff_no,details,amount,gl_code,user.bank,user.acc_no FROM user,report1 WHERE report1.staff_no = '$name' "; $result = mysql_query($query, $dblink); while($myrow = mysql_fetch_row($result)) { echo "<tr><td>" . $myrow[0] . "</td>"; echo "<td>" . $myrow[1] . "</td>"; echo "<td>" . $myrow[2] . "</td>"; echo "<td>" . $myrow[3] . "</td>"; echo "<td>" . $myrow[4] . "</td>"; echo "<td>" . $myrow[5] . "</td>"; echo "<td>" . $myrow[6] . "</td>"; echo "<td>" . $myrow[7] . "</td>"; echo "<td>" . $myrow[8] . "</td>"; echo "<td>" . $myrow[9] . "</td>"; echo "<td>" . $myrow[10] . "</td></tr>"; } it came out all the data instead of where the staff_no = $name only?
  20. thanks rohan but now the parse error: syntax error, unexpected T_VARIABLE is at line 26 which is this line $query = "SELECT report1.id, month, start_date, end_date, user.name, report1.staff_no,details,amount,gl_code,user.bank,user.acc_no FROM user,report1 WHERE user.name = "$name"";
  21. can someone tell me what wrong with my wrong code? i get this error "Parse error: syntax error, unexpected T_VARIABLE line 2" <? php $host = 'localhost'; $user = 'root'; $password = 'admin'; $dbase = 'claim'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); echo "<table border=3 align=center width=90%>"; echo "<tr><td>ID</td>"; echo "<td>Month</td>"; echo "<td>Start Date </td>"; echo "<td>End Date</td>"; echo "<td>Name</td>"; echo "<td>Staff No</td>"; echo "<td>Details</td>"; echo "<td>Amount</td>"; echo "<td>GL code</td>"; echo "<td>Bank </td>"; echo "<td>Account No. </td><tr>"; $name = $_GET['name']; $query = "SELECT report1.id, month, start_date, end_date, user.name, report1.staff_no,details,amount,gl_code,user.bank,user.acc_no FROM user,report1 WHERE user.name = "$name"; $result = mysql_query($query, $dblink); while($myrow = mysql_fetch_row($result)) { echo "<tr><td>" . $myrow[0] . "</td>"; echo "<td>" . $myrow[1] . "</td>"; echo "<td>" . $myrow[2] . "</td>"; echo "<td>" . $myrow[3] . "</td>"; echo "<td>" . $myrow[4] . "</td>"; echo "<td>" . $myrow[5] . "</td>"; echo "<td>" . $myrow[6] . "</td>"; echo "<td>" . $myrow[7] . "</td>"; echo "<td>" . $myrow[8] . "</td>"; echo "<td>" . $myrow[9] . "</td>"; echo "<td>" . $myrow[10] . "</td></tr>"; } echo "</table>"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.