Gallery code not working

i connect to the database fine, and this is the code to pull the links from the db and put them into tables with captions.

database looks like
link namez

[php]<?php
include(“connect.php”);
$counter=0;
$number_of_thumbs_in_row = 2;
$result=mysql_query(“select * from links”);
$nr = mysql_num_rows( $result );

while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = “".$row[2]."”;
}
foreach($result_array as $thumbnail_link)
{
if($counter == $number_of_thumbs_in_row)
{
$counter = 1;
$result_final .= “\n\n

\n”;
}
else
$counter++;
			$result_final .= "\t<td>".$thumbnail_link."</td>\n";
		}

		if($number_of_photos_in_row-$counter) {
		$result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'>&nbsp;</td>\n";


			$result_final .= "</tr>";
		}

		
	?>[/php]

can’t seem to get it to work…i’m pretty new so i’m assuming i’m making some horrible mistake i can’t see >.<

help pleasee thanks!

I can not see the error in this code, but it is best to use reference by field names rather than numeric index. So instead of $row[1] try using $row[‘link’] , and instead of $row[2] use $row[‘namez’]
(sure you need to use correct field names in your ‘links’ table.

Sponsor our Newsletter | Privacy Policy | Terms of Service