|
worldbest (m)
|
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)
|
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)
|
2cent said it all
|
|
|
|
|
|
worldbest (m)
|
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)
|
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)
|
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)
|
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.
|
|
|
|
|
|
|
|
worldbest (m)
|
Ok.Thank u very much.Am goin to use it that way.
|
|
|
|
|
|