Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,114 members, 7,818,323 topics. Date: Sunday, 05 May 2024 at 12:40 PM

Php Problem: Retrieving Images And Display In Horizontally Format. - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Php Problem: Retrieving Images And Display In Horizontally Format. (3668 Views)

How To Get Facebook & Twitter Buttons To Line Up Horizontally On Blogger / Can You Solve This PHP Problem?? / Help! How To Pull Data From Database And Display On A Webpage (2) (3) (4)

(1) (Reply) (Go Down)

Php Problem: Retrieving Images And Display In Horizontally Format. by worldbest(m): 10:08am On Apr 01, 2008
Hello guys.I have this little but confusing problem in a search script am workin on,i have a table called users,so when the user searches,i want the results which are images,username,age,location to be displayed in a table horizontally,must complete atleast 3 colunn before movin to a new row.Although i successful coded the script but it doesnt display horizontally,instead a single result stays on a new row and its really messy.Please does anyone knw how i can solve this because i need this method to complete other parts of my site.Also,can someone explain every part of this url 'http://profile.Myspace.Com' what is the difference between that and this one 'http://myspace.Com/profile.Php.Is the first one a subdomain?Is the profile hosted on a subdomain?Forgive me 4 dis particular question
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by my2cents(m): 11:59am On Apr 01, 2008
So I am thinking you need to clarify more.

From your explanation, you want a 3-column table yet there are only 4 fields to display. So which do you want as part of the 3 columns? In other words you could just print "<tr><td>age</td><td>location</td><td>image</td><td>username</td></tr>" in your DB result set loop
(ignore the order here)

I say the above because, if u just print out 3, then the 4th, on another row, will have problems unless you account for a colspan of 3. To avoid this,I would just modify the above to read (for example):
"<tr><td>age</td><td>location</td><td>image</td></tr><tr><td colspan="3">username</td></tr>"

Of course the above are all in pseudo-code so you will have to convert it to PHP.

Now, if you have say, 9 photos, and want to print those in a 3-column table format, thatz another issue. off the top of my head, this is how I would do it (again, in pseudo-code):

1) print (echo) "<table>"

2) print "<tr>"

3) print (in a loop) "<td>image</td>"

3) do a mod(ulus) of 3.

3a)If it equals zero (that means 3 images divided by 3 has no remainder which = zero),
print "</tr><tr>"

3b) If you have reached the end of the loop, print "</tr>"

4) print "</table>"

Again, this is off the top of my head. No testing involved. You could run this on your server to verify, assuming no one else comes up with something better.

As for the 2nd part of your question, I would assume that yes, the profile.myspace part is a subdomain but that one simply redirects to the other on the server side.

I hope this helps.
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by smartsoft(m): 3:30pm On Apr 01, 2008
2cent said it all
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by worldbest(m): 4:04pm On Apr 01, 2008
Thanks alot 2cent.Ok.What am tryin 2 do?those fields retrived will be place in one table column like this(grouping everything as one table data) <table><tr><td>$image,$username,$age,$location</td></tr></table>.Am sure u get the picture like those dating sites.But with this,it ends up generating new rows with one Group in each rows,so if i have 30 results,its goin 2 make things messy,i knw i can paginate but its sort of a waste of space.Dont knw if u understand me.
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by worldbest(m): 4:05pm On Apr 01, 2008
Thanks alot 2cent.Ok.What am tryin 2 do?those fields retrived will be place in one table column like this(grouping everything as one table data) <table><tr><td>$image,$username,$age,$location</td></tr></table>.Am sure u get the picture like those dating sites.But with this,it ends up generating new rows with one Group in each rows,so if i have 30 results,its goin 2 make things messy,i knw i can paginate but its sort of a waste of space.Dont knw if u understand me.
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by worldbest(m): 4:06pm On Apr 01, 2008
Thanks alot 2cent.Ok.What am tryin 2 do?those fields retrived will be place in one table column like this(grouping everything as one table data) <table><tr><td>$image,$username,$age,$location</td></tr></table>.Am sure u get the picture like those dating sites.But with this,it ends up generating new rows with one Group in each rows,so if i have 30 results,its goin 2 make things messy,i knw i can paginate but its sort of a waste of space.Dont knw if u understand me.
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by my2cents(m): 4:14pm On Apr 01, 2008
yeah, i understand you now. You have no choice but to print out the results that way. So you will hv to use pagination.

It is the only way to cleanly display your results.
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by kazey(m): 4:24pm On Apr 01, 2008
@my2cents
You love maths dont u? Well I can see that . hehehe

https://www.nairaland.com/nigeria/topic-76867.0.html I solved similar problem using pagination.
Re: Php Problem: Retrieving Images And Display In Horizontally Format. by worldbest(m): 7:25pm On Apr 01, 2008
Ok.Thank u very much.Am goin to use it that way.

(1) (Reply)

Does Niche Blogging Has Anything To Do With Seo? / Get 100000 Page Views On Your Blog Within 100 Days / 10 Easy Ways To Write A Powerful And Addictive Introduction For Your Blog Post

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.