Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Displaying mysql query results

    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

  • #2
    New Coder
    Join Date
    May 2006
    Location
    California
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •