cameeob2003 Posted August 1, 2006 Share Posted August 1, 2006 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 :) Quote Link to comment Share on other sites More sharing options...
Caesar Posted August 1, 2006 Share Posted August 1, 2006 Please show a sample of your code and maybe we can take it from there. Otherwise, I suggest you go learn the basics before coding a page.http://www.php.net Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 1, 2006 Share Posted August 1, 2006 i also recomend readingup on mysql or the database your useing as php is the programing lanuage but the database is another story.good luck. Quote Link to comment Share on other sites More sharing options...
cameeob2003 Posted August 1, 2006 Author Share Posted August 1, 2006 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 Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 1, 2006 Share Posted August 1, 2006 like i say you read the mysql manualexample only[code]$sql = "SELECT * FROM `news` where whatever='1' AND order by `id` DESC ";[/code]ect ect ect .... Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 1, 2006 Share Posted August 1, 2006 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.