PHP Help

Associate
Joined
2 Sep 2007
Posts
2,001
Hi excuse me I'm new to PHP. I have managed to pull some data from a database but for some reason this won't work: -

Code:
<html>
<head>
<title>Test Insert</title>
</head>
<body>
<?php
	$user_name = "myusername";
	$password = "mypassword";
	$database = "mydb";
	$server = "localhost";

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

	if ($db_found) {

	      //$SQL = "INSERT INTO studentbanlist (moodleid, banreason) VALUES ('5', 'Abusive to other students.')";


       	//$result = mysql_query($SQL);
	//mysql_close($db_handle);
		print "Records added to the database";

	else {
		print "Database NOT Found ";
		mysql_close($db_handle);
	}
?>
</body>
</html>

With or without the lines commented out when I run this code all I see a blank page? :( I know the user_name, etc is fine because I can pull info from the db. Any ideas?
 
Open your php.ini file, and look for the error_reporting like, and change it to:
Code:
error_reporting = E_ALL & E_STRICT
and likewise for the line beginning with display_errors, change to:
Code:
display_errors = On
then restart your webserver.

Cheers unfortunately I can't restart the webserver.
 
Back
Top Bottom