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: -
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?
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?
