Jump to content

PHP not displaying records from database, no error given


ramonred

Recommended Posts

Hi,

 

I am having trouble with a php script that I've used successfully before. I know it is getting as far as connecting to the database, but it won't display any records.

 

Here is the code:

 

<?php connectDB();

 

if (isset($reg))

{

displayItems($reg);

}

else

{

  //do nothing

    }

function connectDB() {

$dbcnx = @mysql_connect("localhost", "redfrogp_misa", "********");

  if (!$dbcnx) {

      echo( "<P>Unable to connect to the " .

            "database server at this time.</P>" );

      exit();

  }

 

    // Select the contacts database

  if (! @mysql_select_db("redfrogp_misa") ) {

      echo( "<P>Unable to locate the" .

            "database at this time.</P>" );

      exit();

  }

return true;

}

function displayItems($r) {

 

    $result = mysql_query("select * from items");

 

    if (!$result) {

      echo("<P>Error performing query: " .

          mysql_error() . "</P>");

      exit();

    }

 

 

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

 

$row["desc"];

 

    }

}

?>

 

I've checked my bracketing very carefully. I don't see what the issue is, any help would be appreciated. Thanks.

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.