3 Replies - 767 Views - Last Post: 14 October 2008 - 06:39 PM Rate Topic: -----

#1 fallenOne09   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 09-October 08

Pleas help me I canot seem to get the result!

Post icon  Posted 13 October 2008 - 05:39 AM

Pls help me i have this code result.php and i cannot seem to get the result of this.
<html>
<head><title> IQ TEST </title></head>

<body>

<?php


	$user_name = "root";
	$password = "root";
	$database = "test";
	$server = "127.0.0.1";

$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);

if ($db_found) {

$SQL = "SELECT * FROM cs LIMIT 10";
$result = mysql_query($SQL);

while ($db_field = mysql_fetch_assoc($result)) {



$choices = array ( "answer" => $db_field['Answer'] ,
		 "wanswer1" => $db_field['WAnswer1'] ,
		 "wanswer2" => $db_field['WAnswer2'] ,
		 "wanswer3" => $db_field['WAnswer3']); 

	foreach ($_POST as $field => $value)
	{
	if ($field==$db_field['Answer']){
	print "<h3><center><b>YOU ANSWERED 4/10 QUESTIONS, GO STUDY MORE!</b></center></h3>";
	
	
	}
	
	//echo "Wrong KA!";
	}
unset($value);

}




mysql_close($db_handle);

}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}




?>



</body>
</html>


Plsss i really need help

Is This A Good Question/Topic? 0
  • +

Replies To: Pleas help me I canot seem to get the result!

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Pleas help me I canot seem to get the result!

Posted 13 October 2008 - 07:46 AM

How about testing if your connection failed and printing an error if it didn't? What about printing an error if $db_found == FALSE?
What about printing mysql_error() if $result == FALSE?
Was This Post Helpful? 0
  • +
  • -

#3 akozlik   User is offline

  • D.I.C Addict
  • member icon

Reputation: 91
  • View blog
  • Posts: 798
  • Joined: 25-February 08

Re: Pleas help me I canot seem to get the result!

Posted 14 October 2008 - 11:28 AM

What do you mean you aren't getting the result? What is the result supposed to be, and what is it giving you? A little bit more information will help us help you.
Was This Post Helpful? 0
  • +
  • -

#4 LoveSquid   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 47
  • Joined: 14-October 08

Re: Pleas help me I canot seem to get the result!

Posted 14 October 2008 - 06:39 PM

Try:

$result = mysql_query($SQL, $db_handle);



See if that helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1