Jump to content

Displaying only certain data from MySQL DB


cameeob2003

Recommended Posts

I am trying to diplay data on my webpage using php. I only want certain fields which have the correct value to display in the area I choose. I am fairly new to php and was not sure what this set of commands to do this would be called or how I would preform it. Any help is great. Explinations are better :)
I understand all of that... I assume my question was not clear enough. I was using the following to display information from my database before:

[code]$sql = "SELECT * FROM `news` order by `id` DESC";
$result = mysql_query($sql) or die(mysql_error());
while ($text = mysql_Fetch_array($result)) {
$id = $text['id'];
$title = $text['title'];
$date = $text['date'];
$author = $text['author'];[/code]

I want to do something similar but only display the values in the db marked to 1,2,3 ect...

So I would be using something like this

[code]echo'<table>
<tr>
<td>'. $myvariable .'</td>
<td>'. $myvariable2 .'</td>
</tr>
</table>[/code]

but it would only display the rows that have a value of 1,2,3.. in the access section
I don't understand the significance of the comment "but it would only display the rows that have a value of 1,2,3.. in the access section".  You obviously have code that can retrieve data and code that can display it.  So what's the 'access section' all about?

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.