affordit Posted February 24, 2008 Share Posted February 24, 2008 This is suppose to display all the questions that have not been answered yet but its broke can someone tell me why? [<?php session_start(); include"client_info3.php"; include"top_mid_nav.inc"; include("sharons_dbinfo.inc.php"); mysql_connect(mysql,$name,$password); mysql_select_db(mydatabase) or die( "Unable to select database"); $query = "Select * from faq Where answer = ' '"; $results = mysql_query($query) or die(mysql_error()."<br /><br />".$query); $info = mysql_fetch_array($results); $i = 0; while ($info = mysql_fetch_array($results)) { print "<td width='150' ALIGN='CENTER'><font size = '+1'>"; echo $info['id']; echo "</font><br>"; echo $info['question']; echo "<BR>"; echo $info['answer']; echo"<BR></td>"; $i++; if($i % 5 == 0){ echo "</tr><tr>"; } } ?>/code] Quote Link to comment Share on other sites More sharing options...
graham23s Posted February 24, 2008 Share Posted February 24, 2008 Hi Mate, it might be easier to set "answer" to an ENUM (Y or N) then you could do: $query = "SELECT * FROM faq WHERE answer = 'N'"; then if they have been answered set the "answer" to Y. Graham Quote Link to comment Share on other sites More sharing options...
affordit Posted February 24, 2008 Author Share Posted February 24, 2008 Tried that I still don't get back what I know is in the database Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 24, 2008 Share Posted February 24, 2008 <?php $answer=$_POST['answer']; $query = "Select * from faq Where answer = $answer"; if($answer=="no") { //dostuff } elseif($answer=="yes"){//dostuff }?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.