I've been having significant problems attempting to link to a MySQL database using PHP. The php script just crashes without echoing any error messages.
In order to track down the error I've whittled down the code. It crashes even for something as trivial as a simple assignment operation!
the code
<!DOCTYPE html>
<head>
<title>
</title>
</head>
<body>
Testing<br />
<?php
echo("hello")
$hostname_testserver = "stringvar";
echo(" no1 ")
?>
Testing <br />
</body>
</html>
Displays nada: absolutely no source code whatsoever. Blank screen, no browser error message; nothing.
What makes this so peculiar is that I know that I have successfully managed to get php scripts working on this server... using exactly this assignment.
So naturally something more complicated like:
<?php
/*** mysql hostname ***/
$hostname = 'HOST';
/*** mysql username ***/
$username = 'NAME';
/*** mysql password ***/
$password = 'PASSWORD';
try {
$dbh = new PDO("mysql:host=$hostname;dbname=DATABASE", $username, $password);
/*** echo a message saying we have connected ***/
echo 'Successfully connected with database<br />';
/*** INSERT data ***/
$count = $dbh->exec($insertion);
/*** echo the number of affected rows ***/
echo $count;
catch(PDOException $e)
{
echo $e->getMessage();
}
?>
Doesn't even get off the ground ><