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 :)
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?
Link to comment
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.