Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Doesn't he have to use the <code>$row = mysql_fetch_assoc($result)</code> to get the results? </p> <pre><code>// Perform Query $result = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the mysql result functions must be used // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while ($row = mysql_fetch_assoc($result)) { echo $row['firstname']; echo $row['lastname']; echo $row['address']; echo $row['age']; } </code></pre> <p><a href="http://php.net/manual/en/function.mysql-query.php" rel="nofollow">http://php.net/manual/en/function.mysql-query.php</a></p> <p>above is just an example.</p> <hr> <p>update:</p> <pre><code>$result=mysql_query("SELECT * FROM tbl_student WHERE s_id=$id"); $row = mysql_fetch_assoc($result); // I think you have to add this line here, don't you? ?&gt; &lt;form method="post" action="update.php"&gt; &lt;input type="hidden" name="s_id" value="&lt;?php echo $id;?&gt;" /&gt; Name:&lt;input type="Text" name="name" value="&lt;?php echo $row['s_name'];?&gt;" /&gt;&lt;br&gt; Contact:&lt;input type="Text" name="contact" value="&lt;?php echo $row['s_contact'];?&gt;" /&gt;&lt;br&gt; Address:&lt;input type="Text" name="address" value="&lt;?php echo $row['s_address'];?&gt;" /&gt;&lt;br&gt; E-mail:&lt;input type="Text" name="email" value="&lt;?php echo $row['s_email'];?&gt;" /&gt;&lt;br&gt; &lt;input type="submit" name="update" value="Update"&gt; &lt;/form&gt; </code></pre> <hr> <p>update 2:</p> <p>when you are going to update, the method up there <code>$id = $_GET['s_id'];</code> is still looking for a param called 's_id' will come via HTTP GET, but it doesn't! </p> <p>a quick workaround may be this, <code>&lt;form method="post" action="update.php?&lt;?php echo $id;?&gt;"&gt;</code></p> <p>and don't forget to add,</p> <p><code>$id= $_POST['s_id'];</code> after <code>$email = $_POST['s_email'];</code>!</p> <hr> <p>update 3:</p> <p>Hmm, You still need this <code>&lt;input type="hidden" name="s_id" value="&lt;?php echo $id;?&gt;" /&gt;</code> and don't forget to add,</p> <p><code>$id= $_POST['s_id'];</code> after <code>$email = $_POST['s_email'];</code>!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload