Jump to content

Recommended Posts

I would like to read data from a MYSQL database, but would only like to display the data that has a specific column value. Look at what I have in my table:

http://i51.tinypic.com/vio6me.png

I would like user 1 to only see the member_id value of 1 rows, member 2 seeing only 2, etc.

 

My current code displays all of the data for every user. Here is my current code:

<?php 
// Connects to your Database 
mysql_connect("mysql11.000webhost.com", "a7196206_data", "1994love") or die(mysql_error()); 
mysql_select_db("a7196206_data") or die(mysql_error()); 
$data = mysql_query("SELECT * FROM Teachers") 
or die(mysql_error()); 
Print "<table border cellpadding=3 width=750px>"; 
while($info = mysql_fetch_array( $data )) 
{ 
Print "</table>";
Print "<br />";
Print "<table border cellpadding=3 width=750px>";
Print "<tr>"; 
Print "<th width=150px>Teacher Name:</th> <td>".$info['Teacher'] . "</td></tr> ";
Print "<tr>";
Print "<th width=150px>Homework Page:</th> <td>".$info['Homework'] . " </td></tr>";
Print "<tr>";
Print "<th width=150px>Subject:</th> <td>".$info['Subject'] . "</td></tr> ";  
} 
Print "</table>"; 
?> 

 

 

If someone could lead me in the right direction as to how this could be accomplished, I would appreciate it very much. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/237074-retrieving-data-from-mysql-table-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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