...

View Full Version : Displaying mysql query results



simbarashe
03-18-2007, 06:18 PM
Hie

I am trying to display query results by looping through them but i am getting an error written :bool(false) and I dont know what it means. My code is as below and could someone help me:

<?php
session_start();
require_once('dbFunction.php');
dbconnect();
$id = $_GET['id'];
$array = getJobInformation($id);
$requestID = $array[11];
$follUpInfo = mysql_query("SELECT time_assigned,date_assinged,staffID,
assStaffID FROM FOLLOW_UP WHERE
FOLLOW_UP.requestID= '$requestID' ")or die (mysql_error());

$results = mysql_fetch_array($follUpInfo);
$assTime= $results[0];
$assDate = $results[1];
$staffID = $results[2];
$assStaffID= $results[3];
?>

Them some html...

<table border="0" width="98%" cellpadding="5" cellspacing="0">
<?php
while ($results = mysql_fetch_array($follUpInfo))
{
?>
<tr>
<td width="7%" align="center" class="hour" bgcolor="#EFEFEF"><?php $i=1;
echo 'Visit'.$i;
$i++; ?> </td>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="5">
<tr class="task">
<td class="tableBottom">Time: <?php echo $results[0]; ?></td>
</tr>
<tr class="task">
<td class="tableBottom">Date : <?php echo $results[1]; ?></td>
</tr>
<tr class="task">
<td class="tableBottom">Assigned to: <?php echo $results[3]; ?></td>
</tr>
<tr class="task">
<td class="tableBottom">Assigned by:<?php echo $results[2]; ?></td>
</tr>
</table>

It wont allow me to use the while loop though if i take it out everything works fine. Could someone please tell me where I'm getting it wrong or if i am complicating things

thank you

Forsaken
03-18-2007, 07:32 PM
Just something to point out thats not really of importance but I recommend instead of having it in html and php I would just incorporate the html into the php.

try...

$follUpInfo = mysql_query("SELECT `time_assigned`, `date_assinged`, `staffID`, `assStaffID` FROM `FOLLOW_UP` WHERE
`FOLLOW_UP.requestID` = '$requestID'")

shouldn't make a difference but, try it and make sure everything is properly typed as databae its case sensitive. Such as FOLLOW_UP.requestID may have a problem... the onl reason while wouldn't work would be because of the query from what I see..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum