Jump to content

Blank Results Page


gokhul

Recommended Posts

Hi,

 

Can you tell me why am I getting a blank results page even though I am giving the record that is in the database as the search term.

 

The following is my code.

<br><br>
<?PHP

$hostname = "localhost";
$username = "gkkilaru";
$password = "gkkilaru";
$database = "gkkilaru_db";

     $search = $_POST["txtSearch"];
     $choice = $_POST["txtChoice"];

     MYSQL_CONNECT($hostname, $username, $password) or die ( "<H3>Server unreachable</H3>");
     MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>");

switch ($choice)
{
/////////////////////////////// INITIAL/////////////////////////////////////
case "initial":
	$result=MYSQL_QUERY("SELECT * FROM initial WHERE id='$search'");
/* 	if (mysql_num_rows($result)>0)
		{
				echo "<table cellpadding='1' cellspacing='1' bordercolor="339900" width='800' border='1'>"; 
			echo "<tr align='center'>";
			echo	"<td><b>id</b></td>";
			echo	"<td><b>dateenrolled</b></td>";
			echo	"<td><b>name</b></td>";
			echo	"<td><b>age</b></td>";
			echo	"<td><b>mrn</b></td>";
			echo	"<td><b>compounds</b></td>";
			echo	"<td><b>comments</b></td>";
			echo	"<td><b>doctor</b></td>";
			echo	"<td><b>compensation</b></td>";
			echo	"<td><b>liverbiopsy</b></td>";
			echo	"<td><b>exemption</b></td>";
			echo   "</tr>"; 
		}
	//else
		{
			// echo "<tr align='center'><td>";
			// echo "<p><font size='4' color='339900'>";
			// echo "No Records Found!</p>";
			// echo "</td></tr>";
		} */
	break;


////////////////////////////////////// SIX MONTH ///////////////////////////////
case "six":
	$result=MYSQL_QUERY("SELECT * FROM six WHERE id='$search'");	
/* 	if(mysql_num_rows($result)>0)
		{
			echo "<table cellpadding='1' cellspacing='1' bordercolor="339900" width='800' border='1'>"; 
			echo "<tr align='center'>";
			echo	"<td><b>id</b></td>";
			echo	"<td><b>followup</b></td>";
			echo	"<td><b>datefollowup</b></td>";
			echo	"<td><b>comments</b></td>";
			echo	"<td><b>compensation</b></td>";
			echo	"<td><b>chronic</b></td>";
			echo	"<td><b>narrative</b></td>";
			echo	"<td><b>caseadj</b></td>";
			echo	"<td><b>liverbiopsy</b></td>";	
			echo  "</tr>";
		}
	else
		{
			// echo "<tr align='center'><td>";
			// echo "<p><font size='4' color='339900'>";
			// echo "No Records Found!</p>";
			// echo "</td></tr>";
		} */
	break;


//////////////////////////////// TWELVE MONTH//////////////////////////////////
case "twelve":	
	$result=MYSQL_QUERY("SELECT * FROM twelve WHERE id='$search'");
/* 	if(mysql_num_rows($result)>0)
		{
			echo "<table cellpadding='1' cellspacing='1' bordercolor="339900" width='800' border='1'>"; 
			echo "<tr align='center'>";
			echo	"<td><b>id</b></td>";
			echo	"<td><b>followup</b></td>";
			echo	"<td><b>datecompleted</b></td>";
			echo	"<td><b>comments</b></td>";
			echo	"<td><b>compensation</b></td>";
			echo	"<td><b>narrative</b></td>";
			echo  "</tr>";
		}
	else
		{
			// echo "<tr align='center'><td>";
			// echo "<p><font size='4' color='339900'>";
			// echo "No Records Found!</p>";
			// echo "</td></tr>";
		} */
	break;
}
?> 
	           </table>                                                         	
	          <br>
	          <br>
	        </form>           
	        </div>           
            </td>
          </tr>
        </table></td>
      <td valign="top">  </td>
     </tr>
    </table>
  <table width="648" border="0" cellspacing="0" cellpadding="0">
</table>
<br>
</div>
</body>
</html>

 

EDIT: Please use [code][/code] tags!

Link to comment
Share on other sites

but the id that is given is existing in the database.and one more thing is...i used the same code for another database and it is working. i am uanble to find why the results are not being displayed for this one. except the results...everything is being displayed.

Link to comment
Share on other sites

one more thing...

 

if the user search for something the string must be exact as in the database... but you instead putting the ID table you should make tags of the post or the data given by the user... make the tags as a must...

 

like this(correct if Im wrong at some parts

$result= mysql_query("SELECT * FROM initial");
while ($row = mysql_fetch_array($result)) {
$tags = $row['tags'];
if(preg_match($search, $tags)) {
echo '<a href="/resources.php?id='. $row['id'] .'">'. $row['title'] .'</a>';

} else {
echo 'No Results Found';

}

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.