View Single Post
Old 05-22-2009, 09:53 PM   #9 (permalink)
CoryMathews
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

I could not find where you were using $id, $name and $website.

You should change the Selet * to Select col1, col2... however for most smaller sites it really does not matter unless you have a ton of extra columns. There is no need for the extra variables, and a switch would probably be better but it really does not matter on that either. You only need 1 echo to print all the junk instead of the multiples. so something like this would be a bit better.

PHP Code:
<?                    
$result 
mysql_query("SELECT * FROM Portfolio ORDER BY id DESC");

while(
$row mysql_fetch_array($result)) {
$id $row['id'];
$name $row['name'];
$website $row['website'];

echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p1'].'"   class="option" id="thumb" title="'.$row['p1d'].'" ><img src="'.$row['thumb'].'" / class="thumbs"></a> ';

if(
$row['p2'] >= "1")
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p2'].'" class="hidden" title="'.$row['p2d'].'" ></a>';

if(
$row['p3'] >= "1"
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p3'].'" class="hidden" title="'.$row['p3d'].'" ></a>';

if(
$row['p4'] >= "1"
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p4'].'" class="hidden" title="'.$row['p4d'].'" ></a>';

if(
$row['p5'] >= "1"
  echo 
'<a rel="sxadowbox['.$row['p1'].'];" href="'.$row['p5'].'" class="hidden" title="'.$row['p5d'].'" ></a>';

if(
$row['p6'] >= "1"
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p6'].'" class="hidden" title="'.$row['p6d'].'" ></a>';

if(
$row['p7'] >= "1"
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p7'].'" class="hidden" title="'.$row['p7d'].'" ></a>';

if(
$row['p8'] >= "1"
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p8'].'" class="hidden" title="'.$row['p8d'].'" ></a>';

if(
$row['p9'] >= "1")
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p9'].'" class="hidden" title="'.$row['p9d'].'" ></a>';

if(
$row['p10'] >= "1")
  echo 
'<a rel="shadowbox['.$row['p1'].'];" href="'.$row['p10'].'" class="hidden" title="'.$row['p10d'].'" ></a>';                                                                   

}

?>
CoryMathews is offline  
Reply With Quote