Php Problem: Retrieving Images And Display In Horizontally Format.

Welcome. Please Login, Register, Or Activate! 
type your username and password to login
Date: November 22, 2009, 04:02 PM
430814 members and 297939 Topics
Latest Member: maromarx2
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Webmasters (Moderators: OmniPotens, yawa-ti-de)  |  Php Problem: Retrieving Images And Display In Horizontally Format.
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Php Problem: Retrieving Images And Display In Horizontally Format.  (Read 1275 views)
worldbest (m)
Php Problem: Retrieving Images And Display In Horizontally Format.
« on: April 01, 2008, 10:08 AM »

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
my2cents (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #1 on: April 01, 2008, 11:59 AM »

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.
smartsoft (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #2 on: April 01, 2008, 03:30 PM »

2cent said it all
worldbest (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #3 on: April 01, 2008, 04:04 PM »

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.
worldbest (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #4 on: April 01, 2008, 04:05 PM »

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.
worldbest (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #5 on: April 01, 2008, 04:06 PM »

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.
my2cents (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #6 on: April 01, 2008, 04:14 PM »

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.
kazey (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #7 on: April 01, 2008, 04:24 PM »

@my2cents
 You love maths dont u? Well I can see that . hehehe

http://www.nairaland.com/nigeria/topic-76867.0.html I solved similar problem using pagination.
worldbest (m)
Re: Php Problem: Retrieving Images And Display In Horizontally Format.
« #8 on: April 01, 2008, 07:25 PM »

Ok.Thank u very much.Am goin to use it that way.
 Cost Of Building A Website For A Record Label  Using *Dreamweaver* (webdesign)  Starting Up A Forum  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 


Sections: Autos/Cars (2) Jobs/Vacancies (2) (3) Career Talk Education General(2) Politics Romance Computers Phones Travel
Sports Fashion Health Religion Celebrities TV/Movies (2) Music/Radio (2) Books Webmasters Programming

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa. See also: Nairalist Classified Ads
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.