Jump to content

BachirDarawish

New Members
  • Posts

    2
  • Joined

  • Last visited

BachirDarawish's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yeah but this is to select and retrieve the data of the specific student ID but what abt the displays one? what is the query because mine don't seem to work it keep display all the data for all student but I just want for 1 student id?
  2. Hi I need some help with this code. I have been trying to execute this query by clicking on the search button. The query should select a the data on the web page but only the for the id entered. but I can't seem to make to button execute the query. Can somebody help me? <table border="1" align="center" cellpadding="2" cellspacing="0"> <tr> <td colspan="4"> <div align="center"> <input type="button" name="Student ID" value="Search ID" onclick="f()" /> <input type="text" name="StudentID"> <?php function f(){ $StudentID=$_POST['StudentID']; // Connect to the database $dbLink = new mysqli('', '', '', ''); if(mysqli_connect_errno()) { die("MySQL connection failed: ". mysqli_connect_error()); } // Query for a list of all existing files $sql = 'SELECT `MeetingRef`, `StudentID`, `Created`, `Progress`,`Problems` FROM `Meeting` WHERE StudentID StudentID'; $result = $dbLink->query($sql); // Check if it was successfull if($result) { // Make sure there are some files in there if($result->num_rows == 0) { echo '<p>There are no dat saved for this student in the database</p>'; } else { // Print the top of a table echo '<table width="100px"> <tr> <td align ="center"><b>Meeting Ref</td> <td align ="center"><b>Student ID</td> <td align ="center"><b>Created</b></td> <td align ="center"><b>Progress</b></td> <td align ="center"><b>Problems</b></td> </tr>'; // Print each file while($row = $result->fetch_assoc()) { echo " <tr> <td>{$row['MeetingRef']}</td> <td>{$row['StudentID']}</td> <td>{$row['Created']}</td> <td>{$row['Progress']}</td> <td>{$row['Problems']}</td> </tr>"; } // Close table echo '</table>'; } // Free the result $result->free(); } else { echo 'Error! SQL query failed:'; echo "<pre>{$dbLink->error}</pre>"; } // Close the mysql connection $dbLink->close(); } ?> </div></td> </tr> </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.