why the data can't dispaly in the form???(error-mysql_fetch_array():)

Posted by shimaTun on Stack Overflow See other posts from Stack Overflow or by shimaTun
Published on 2010-03-18T21:07:11Z Indexed on 2010/03/18 21:11 UTC
Read the original article Hit count: 480

Filed under:

I've created a code to view the data. Now it seem contain an error. When I run this page this error display:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userView.php on line 93

the code :

<?php //======================================================================================================================= PROCESS DATA ======================================================= START. 
include "connectioncomplaint.php";
?>

<?php
$subject = $_GET['type'];
$comment = $_GET['id'];

//echo 'test : ' . $name;
//Tarik data dari sini 
$queryDetail = " SELECT * FROM campuscomplaint " . " WHERE subject = '" . $subject . "' AND comment = '" . $comment . "' ";
//echo 'QUERY DETAIL :' . $queryDetail . '<br>' ;

$resulDetail = mysql_query($queryDetail);
//echo 'RESULT DETAIL :' . $resultDetail + 0 . '<br>' ;

$detail = mysql_fetch_array($resultDetail);

//echo $detail . '<br>';
//echo 'detail subject is : ' . $detail['subject'] . '<br>';
//echo 'detail comment is : ' . $detail['comment'] . '<br>';
//echo $detail[$x] . '<br>';

?>

code for form:

<tr>
                  <td bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5">From:</td>
                  <td bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5"><input type="text" name="to" 
size="40" maxlength="80" value="<?php echo $detail['userid']; ?>"/></td>
                </tr>
                <tr>
                  <td width="38%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5">Subject:</td>
                  <td width="62%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5"><input type="text" name="subject" size="40" maxlength="80" value="<?php echo $detail['subject']; ?>"/></td>
                </tr>
                <tr>
                  <td bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5">Comment:</td>
                  <td bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5"><textarea name="comment" rows="5" cols="40"><?php echo $detail['message']; ?></textarea></td>
                </tr>
                <tr>
                  <td bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5"><p>&nbsp;</p>
                      <p>&nbsp;</p></td>
                  <td bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register style5"><input type="submit" name="submit" value="Submit Comment" onClick="return OnButton1();"/></td>
                </tr>

© Stack Overflow or respective owner

Related posts about php