Jump to content

Alanp

New Members
  • Posts

    1
  • Joined

  • Last visited

Alanp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello! every one. I have my php-mysql codes bellow which gives the error "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\jopasy_community_2.2\includes\view.php on line 28" bellow are the codes <?php include 'connection.php'; $con = mysql_connect($host,$user,$pwd); $db = mysql_select_db($database); include 'create_tables.php'; $sql = 'SELECT name, qntitle, question FROM questions'; $retval = mysql_query( $sql, $con ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { $qnabout=$row['qntitle']; echo "<b>Question: </b>{$row['question']} <br>". "<b>Asked by : </b> {$row['name']} <br> ". "<b>Question about: </b> {$row['qntitle']} <br><br> ". "<b>Answers</b> <br><br> ". $getanswer = ("SELECT answerdby, answer FROM answers WHERE qntitle ='".$qnabout."';"); $answer = mysql_query( $getanswer, $con ); while($ans = mysql_fetch_array($answer, MYSQL_ASSOC)) // THIS IS THE LINE WITH ERROR { echo "Answer : {$ans['answer']} <br> ". "<b>Answered by : </b> {$ans['answerdby']} <br> ". "--------------------------------<br><br><br><hr>"; } } mysql_close($con); ?> I dont know how to solve it. i need help plz
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.