Jump to content

Recommended Posts

Posted

Hi. I created a database for my Gallery2 installation. I forgot the password, but I have an idea what it might be. I had the idea of writing a script connecting to the database. My theory was this if the connection was successful, I remembered the password correctly. I wrote the following script (with actual "Usename" and "Password" inserted):

 

><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>

<title>Connect to G2 Database</title>

<link rel="stylesheet" href="http://www.hintzefamily.com/test/Just_A_Test/stylescss/stylesheet1e.css" type="text/css" />
</head>

<body>

<?php //Script to connect to G2 Database "Connect to G2 Database

ini_set ('display_errors" 1);
error_reporting (E_ALL & ~E_NOTICE);

if ($dbh=mysql_connect ("localhost", "username", "password")) {
	print "<p>Successfully connected to MySQL.</p>";
	mysql_close();
	
} else {
	die ("<p>Could not connect to MySQL because: <b>" . mysql_error . "</b></p>");	

}		
?>	

</body>
</html>

 

When I attempt to run oit, however, I get the following error:

 

Parse error: syntax error, unexpected $end in /home/russ/public_html/test/testphp/connect_to_g2..php on line 31

 

I imagine I am missing something basic. Can anyone take pity on a newbie and point out my error? :-)

Posted

In doing some research on the internet I came accross this thread in php Addict which suggests that the error is an indication missing "}", but I seem to have all the curly brackets closed?

Posted

This line appears to be the problem:

>ini_set ('display_errors" 1);

1) 'display_errors" starts with a single quote and ends with a double quote, and

 

2) There is a comma missing between display_errors and the 1.

 

The line should look like this:

>ini_set ("display_errors", 1);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...