I have a simple error that I just cannot figure out why I am getting it.
Any idea why I might get
SyntaxError: Expected an identifier but found 'Connected' instead
I’m using Safari, but I have tried in Google Chrome.
I must make it work with Safari.
The Code:
<?php
$link = mysql_connect('localhost', 'root', 'student');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Database Connected successfully';
?>
The Code that calls the above
<script type="text/javascript">
// Check if the page has loaded completely priere to 2 seconds of the page being fully loaded
$(document).ready( function() {
setTimeout( function() {
$('#displayconnection').load('js/dbconnect.php');
}, 2000);
});
</script>
Your web browser should not influence whether the PHP code runs or not. Also, this isn’t JavaScript.
Make sure the file can be executed by your server (does it have a
.phpextension)?Try this code: