Jump to content

not vaild mysql result resource problem can you help


cdog1912

Recommended Posts

here's the code im trying to retrive image which have their paths stored in a mysql database.

 

The code:

<?php

include'config.php';

include'opendb.php';

$row_count = 0;

$row_ttl = 4;      // this is used to make your rows scalable

 

echo "<table width='100%'><tr align='center'>";

 

$result = mysql_query("SELECT id, path FROM gallery1");

while ($row = mysql_fetch_array($result)) {

  $img_id = $row["id"];

  $img_path = $row["path"];

 

  echo "<td><a herf='$img_path'><img src='$img_path' width='150' height='250'></a></td>";

  $row_count++;

 

  if ($row_count == $row_ttl) {

    echo "</tr><tr align='center'>";

    $row_count -= $row_ttl;  // cheesy way of resetting the counter

  }

}

 

echo "</tr></table>";

include'closedb.php';

?>

 

any help would be great

not vaild mysql result resource problem

Usually means the mysql connection didn't work, or the query failed.

 

Test your query: mysql_query("SELECT id, path FROM gallery1");  in your mysql console/phpmyadmin

 

Then test your database connection in these files:

include'config.php';

include'opendb.php';

 

Let us know.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.