This little script is very useful for having a set width of a table and displaying several rows organized in that table.
It is easy to just display a table full of rows for all the data in a mysql table. Something like this:
[code lang=”php”]
0){
echo “
“.$row[“col1″].” |
“;
}
?>
[/code]
This will grab all content of the mysql table and put the data from column 1 as a table column in this table.
Let’s say we have some images we want to display. The table is 500 pixels wide. So if your images are no larger than 100 pixels, you would want to display 5 columns per row in your table. This will give it good organization and flow in your webpage.
[code lang=”php”]
0){
echo “
“;
}
?>
[/code]
The two codes will appear like so:
Before Column Limit:
Image 1 | Image 2 | Image 3 | Image 4 | Image 5 | Image 6 | Image 7 | Image 8 | Image 9 | Image 10 |
After Column Limit:
Image 1 | Image 2 | Image 3 | Image 4 | Image 5 |
Image 6 | Image 7 | Image 8 | Image 9 | Image 10 |
[…] width of a table and displaying several rows organized in that table. Originally posted here: PHP Display Mysql Rows with Column Limit « bgallz.org | Templates … Share and […]
P thanks to your ideas , i’d adore to adhere to your weblog as usually as i can.possess a good day
My English is not good, but to see the article you write a good feel of your
i really thanks to u
it is very simple code for this
i use it and its working very well
Hey – nice blog, just looking around some blogs, seems a pretty nice platform you are using. I’m currently using WordPress for a few of my sites but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.
This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work.
I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
Great post, thanks. Like your blog design too.
Thanks for this great website. I am trying to read some more posts but I cant get your website to display properly in my Opera Browser. Thanks again.
A topic close to my heart thanks. A good quick read.
You made some Good points there. I did a search on the topic and found most people will agree.
Making use of article directories makes for an excellent way to get more visitors to your website. I know that article writing is very tiring, it ultimately is worth your time which you put into it.
Hey – great blog, just looking around some blogs, seems a really nice platform you are using. I’m currently using WordPress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?
Excellent blog! I really love how it’s easy on my eyes as well as the facts are well written. I am wondering how I can be notified whenever a new post has been made. I have subscribed to your rss feed which must do the trick! Have a nice day!
interesting post, pretty much covered it all for me, thanks.
I wasn’t aware of some of the information that you mentioned so I want to just say thank you.
Awesome article! thanks for the good read!
Hey – nice blog, just looking around some blogs, seems a pretty nice platform you are using. I’m currently using WordPress for a few of my sites but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?
Will it be acceptable to use your RSS feed?
Fascinating article with A number of useful advises. Thank you very much, I?l Begin Examining your blog.
Nice post, cool site, keep it up.
information to my Company 😉 Please keep it up. I look for your Articles on my iphone rss feed every day.
Data to my Company 😉 Please Maintain it up. I look for your Articles on my iph1 rss feed every Day time.
Nice blog. It’s everything here exactly what I need to know.
The blog was absolutely fantastic! Lots of great information and inspiration, both of which we all need!
I do agree with all the ideas you have presented in your post. They are very convincing and will definitely work. Thanks for the post.
Great post, I concur completely and appreciate the time you took to write it. Cheers!
I like to require breaks during the day and browse by means of some blogs to see what others are saying. This weblog appeared in my searches and I could not help but clicking on it. I’m happy I did because it was a very enjoyable read.
thanks !! quite helpful post!
Excellent summary, bookmarked the site with hopes to read more!
Pretty useful post. I’m doing research on this vocation right now and this helped. Thanks for your unique take on this topic.
A thoughtful insight and ideas I will use on my blog. You’ve obviously spent a lot of time on this. Congratulations!
Dude, I absolutely liked reading this post. You have convinced me to subscribe to your blog, but where can I find the RSS feed?
Good blog post! I love your weblog, is it okay to try it for Rss or atom?
This is the simplest code to select and display records from MySQL database table and display in PHP.
$cn=mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());.
mysql_select_db($db_name,$cn) or die(mysql_error());.
$sql = “SELECT field_name FROM table_name”;.
$rs = mysql_query($sql) or die(mysql_error());.
while($row = mysql_fetch_array($rs)){.
echo $field_name = $row["field_name"];.
echo “</br>”;
}
mysql_free_result($rs);
Source:
<a href="http://phphelp.co/2012/04/26/how-to-select-and-display-mysql-records-data-in-php/">http://phphelp.co/2012/04/26/how-to-select-and-display-mysql-records-data-in-php/</a>
OR
<a href="http://addr.pk/acfd">http://addr.pk/acfd</a>
Wow, been looking for this. Thanks.
Thank you for this very good tutorial