Forum Moderators: coopster

Message Too Old, No Replies

Directory link to full description

         

scottb

10:34 pm on Jun 11, 2008 (gmt 0)

10+ Year Member Top Contributors Of The Month



I'm fairly new to php and mysql. I would like to create a simple directory in a browse view. One of the fields has a link that passes the ID to a full description of the record. I am not getting any sql error messages, but the resulting page is blank.

After reading dozens of postings and tutorials and not finding an answer, I'm hoping someone has a suggestion. The first file is browse.php and displays the right data without a problem:

$query = "SELECT * FROM table_name WHERE field_name='xyz'";

$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "{$row['id']} " .
"<a href=\"view_record.php?id={$row['id']}\">{$row['description1']} ";
}

The id is passed to view_record.php:

if (isset($_GET['id'])) {
$id = (int) $_GET['id'];
}

require_once ('config.inc');

$query = "SELECT id, description2 FROM table_name WHERE field_name='xyz'";
$result = mysql_query($query);

if (mysql_num_rows($result) == 1)
{

$row = mysql_fetch_array($result, MYSQL_ASSOC);

echo "ID: {$row['id']} " .
"Description: {$row['description2']} ";
}

This page is blank. Any ideas?

eelixduppy

1:08 am on Jun 12, 2008 (gmt 0)



Hello and Welcome to WebmasterWorld!

>> This page is blank. Any ideas?

A blank page either means nothing is being echoed to the browser OR you are having a fatal error of doom and you need to check your error logs to see if something's up. Let's assume the latter and see what's in those logs.

scottb

9:27 pm on Jun 12, 2008 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hello and thanks for the welcome. You're right, it turns out that nothing was being echoed to the browser because I was supposed to have id=$id in the query statement on the second file. Thanks for the response!

eelixduppy

10:59 pm on Jun 12, 2008 (gmt 0)



Glad you resolved your issue :)