Jump to content


Check out our Community Blogs

scottkohlert

Member Since 06 Aug 2011
Offline Last Active Aug 07 2011 07:20 AM
-----

Topics I've Started

PLEASE HELP! My php script is broken and I can't figure out whats wrong!

06 August 2011 - 08:48 PM

Here is the script:

function redeem() {
        

            $case = $_POST["case"]; 
			$name = $_POST["name"]; 
			$profession = $_POST["profession"];
			$city = $_POST["city"];
			$country = $_POST["country"];
			$totalpercent = $_POST["totalpercent"];
			$pretest = $_POST["pretest"];
			$posttest = $_POST["posttest"];
			$investigationspercent = $_POST["investigationspercent"];
			$timesreset = $_POST["timesreset"];
			$creditsspent = $_POST["creditsspent"];
			$timescompleted = $_POST["timescompleted"];
			
			//Add the information to the new_card_history table that keeps track of transactions
           	$stmt = $this->db->prepare("INSERT INTO learnent_cases_leaderboard (case, name, profession, city, country, totalpercent, pretest, posttest, investigationspercent, creditsspent, timescompleted, timesreset, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)");
			
			$stmt->bind_param("sssssiiiiiii", $case, $name, $profession, $city, $country, $totalpercent, $pretest, $posttest, $investigationspercent, $creditsspent, $timescompleted, $timesreset); //the quotations specify the type of variable;
			//See http://php.net/manual/en/mysqli-stmt.bind-param.php for more information on bind_param
            $stmt->execute();
            $stmt->close();
			
			
      
            $result = array(
                
				
            );
            sendResponse(200, json_encode($result));
            return true;

It doesn't work. When I read the log, it says my error is: PHP Fatal error: Call to a member function bind_param() on a non-object at line 105

Line 105 is this line:

$stmt->bind_param("sssssiiiiiii", $case, $name, $profession, $city, $country, $totalpercent, $pretest, $posttest, $investigationspercent, $creditsspent, $timescompleted, $timesreset); //the quotations specify the type of variable;

Please help guys! I've gone over this 30 times, it's very similar to something I have done in the past. Thanks in advance for any help!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download