Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-04-2003, 03:35 AM   #1
psyko514
See sig. Join Epic Cash.
 
Join Date: Oct 2002
Location: Montreal, Quebec. ICQ: 214702014
Posts: 22,366
need some PHP/mysql help please

I have database of a bunch of different galleries. I'm displaying links to these galleries in a table with the following code:
PHP Code:
  $result = @mysql_query("SELECT * FROM $TableName WHERE approved = 'Y'");
  while ( 
$row mysql_fetch_array($result) ) {
    
$i++;
    echo 
"<td><a href=gallery.php?id=$row[id]>$row[name]</a><br>\n";</td>\n";
    if ((
$i % 5) == 0) { echo "</tr><tr>\n" ; } 
i would like the table to have a different layout everytime it's loaded (i want the cells to be switched around)

i've been racking my brain on this, and the only way i can think of is to select a random starting point in the database (which i have no idea how to do, or if it's possible)
unless it's possible to rearrange an array.

any help would be appreciated... just give me a shove in the right direction.
if you want to write the code for me, i'll give you a cookie ;)
thanks

Last edited by psyko514; 01-04-2003 at 03:38 AM..
psyko514 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-04-2003, 03:48 AM   #2
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
im a little tired, but im guessing you just want it random instead of php pulling it with the same format everytime... if so use this:

PHP Code:
$result = @mysql_query("SELECT * FROM $TableName WHERE approved = 'Y' order by rand()");
  while ( 
$row mysql_fetch_array($result) ) {
    
$i++;
    echo 
"<td><a href=gallery.php?id=$row[id]>$row[name]</a>\n";</td>n";
    if ((
$i % 5) == 0) { echo "</tr><tr>n" ; } 
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-04-2003, 03:52 AM   #3
psyko514
See sig. Join Epic Cash.
 
Join Date: Oct 2002
Location: Montreal, Quebec. ICQ: 214702014
Posts: 22,366
perfect! thanks dude!
your cookie is on it's way.
psyko514 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-04-2003, 03:53 AM   #4
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
thanks, i am kinda hungry
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.