Jump to content

Retrieving Data from MYSQL Table Help


rohan_m

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

Archived

This topic is now archived and is closed to further replies.

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