thunderbox Posted November 30, 2006 Share Posted November 30, 2006 hey guys.. im having a little trouble getting data from my database to the script... i realy dont know how to do it..im making a very simple blog site, which is more like a bulletin site in which people can leave comments but only after they registeri have been successful in getting both the user to register and getting the blog they post into the database, but i don't know how to display the database on the main page..how would i do this?btw. my database has 4 fields that need displayingusername, date, title and content.. and im not sure if i should put the unique ID in there.. so if someone could figure out how to put those details into variables.i had a small idea of how to do this but im not sure on how to do it for every post, i think it is done through looping but i am not sure.thanks for your help, im a complete newbie (4 days of programming) Quote Link to comment https://forums.phpfreaks.com/topic/28969-retrieving-data-from-mysql-table/ Share on other sites More sharing options...
kid_drew Posted November 30, 2006 Share Posted November 30, 2006 You can do this in a couple of ways. I would probably issue a select command "select * from blog_entries where..." and then loop through the entries in php:$query = "select * from blog_entries where...";$result = mysql_query($query) or die(mysql_error());while($row = mysql_fetch_assoc($result)){ //html format code here}Anyone have a more eloquent solution? Quote Link to comment https://forums.phpfreaks.com/topic/28969-retrieving-data-from-mysql-table/#findComment-132777 Share on other sites More sharing options...
thunderbox Posted December 1, 2006 Author Share Posted December 1, 2006 what do i put in the "where..." or does that just stay there?i hvae no idea about the code that you just put up.. lol.. im having trouble understanding it Quote Link to comment https://forums.phpfreaks.com/topic/28969-retrieving-data-from-mysql-table/#findComment-133298 Share on other sites More sharing options...
fenway Posted December 3, 2006 Share Posted December 3, 2006 Well, which entries do you want? Quote Link to comment https://forums.phpfreaks.com/topic/28969-retrieving-data-from-mysql-table/#findComment-134483 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.