I just pulled out my last strand of hair

admin

Administrator
Staff member
Hey fellow phpers,

I'm getting quite frustrated over a script problem. The script I'm about to paste below doesn't return anything in the while loop. I even put a test value in the middle of the loop (echo "1";) and that doesn't even get displayed.

I've been working on this for quite a while and need another brain to help me out. (btw, I did check the database and it is NOT empty).

So if anyone can ease my crazy mind, I'd appreciate it.

Thanks :)

Here's the URL where the data is supposed to go:

<!-- m --><a class="postlink" href="http://www.geology.ohio-state.edu/test/rfatest/rfadisplay.php">http://www.geology.ohio-state.edu/test/ ... isplay.php</a><!-- m -->

Here's the script:



<head>
<title>RFA DISPLAY</title>
</head>

<body bgcolor="white">

<table width="90%" border="1" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="#CCCC99">
<td width="13%"><font face="Arial, Helvetica, sans-serif" size="1">RFA#</font></td>
<td width="13%"><font face="Arial, Helvetica, sans-serif" size="1"><b>Name</b></font></td>
<td width="14%"><font face="Arial, Helvetica, sans-serif" size="1"><b>Type
of Request</b></font></td>
<td width="15%"><font face="Arial, Helvetica, sans-serif" size="1"><b>Request</b></font></td>
<td width="14%"><font face="Arial, Helvetica, sans-serif" size="1"><b>Status</b></font></td>
<td width="17%"><font face="Arial, Helvetica, sans-serif" size="1"><b>Last
Action </b></font></td>
<td width="27%"><font face="Arial, Helvetica, sans-serif" size="1"><b>Date
Added </b></font></td>
</tr>
<?php

//database variables

$dbhost='localhost';
$username='root';
$pass='trek14';

//connect to the database
$link_id=mysql_connect ($db, $username, $pass) or DIE ("Unable to connect to database server!");

//select database to use
$db=mysql_select_db("rfa",$link_id) or DIE("Unable to select database!");

//begin query
$query="SELECT request.id, request.date, request.type, request.status, faculty.f_name, faculty.l_name, action.id, faculty.id FROM request, faculty, action WHERE request.requested_by=faculty.id AND action.request_id=request.id";

$result=mysql_query($query);

//trap errors
if (!$result=mysql_query($query))
{
echo mysql_error()."<BR>\n$query<BR>\n";
};

//begin while loop to grab all needed data out of the database
while ($query_data=mysql_fetch_array($result)) {

//set up variables to echo the data
$rfaid=$query_data["id"];
$date=$query_data["date"];
$type=$query_data["type"];
$status=$query_data["status"];
$firstname=$query_data["f_name"];
$lastname=$query_data["_lname"];
$actionid=$query_data["id"];
$facultyid=$query_data["id"];

//alternate the table colors
if ($color=="#99CCFF")
{
$color="#CCCCCC";
}
else
{
$color="#99CCFF";
};

echo "<tr bgcolor=$color>\n";
echo "<td width=\"13%\">$rfaid</td>\n";
echo "<td width=\"13%\"><a href=http://www.phpbuilder.com/board/archive/index.php/\"facultyinfo.php?facultyid=$facultyid\">click here</a></td>\n";
echo "<td width=\"14%\">$type</td>\n";
echo "1"; //test value
echo "<td width=\"15%\"><a href=\"rfainfo.php?rfaid=$rfaid\">click here</a></td>\n";
//determine status of request
if (status=="0")
{
echo "<td width=\"14%\">Open</td>\n";
}
elseif (status=="1")
{
echo "<td width=\"14%\">Closed</td>\n";
}
else
{
echo "<td width=\"14%\">In-Progress</td>\n";
}
echo "<td width=\"15%\"><a href=\"actioninf.php?actionid=$action\">click here</a></td>\n";
echo "<td with=\"27%\">$date</td>\n";
echo "</tr>\n";

}

//Checking to see if variables are being filled
echo $rfaid;
echo $date;
echo $type;
echo $status;
echo $firstname;
echo $lastname;
echo $actionid;
echo $facultyid;
echo "1"; //test value

?>

</table>
</body>
 
Back
Top