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] Link to comment https://forums.phpfreaks.com/topic/92656-help-what-am-i-doing-wrong-here/ 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 Link to comment https://forums.phpfreaks.com/topic/92656-help-what-am-i-doing-wrong-here/#findComment-474843 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 Link to comment https://forums.phpfreaks.com/topic/92656-help-what-am-i-doing-wrong-here/#findComment-474846 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 }?> Link to comment https://forums.phpfreaks.com/topic/92656-help-what-am-i-doing-wrong-here/#findComment-474848 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.