Script mysql connection problems

software development


My script wont’ connect to my database, and I can’t figure out why. any help is appreciated. if you want to see the site check out it’s supposed to be a google map but i think the map won’t display because of the database connection issue. here’s the meat and bones of the code:

// set up database info
$db_server = “”;
$db_username = “xxx”;
$db_password = “xxx”;
$database = “ww”;
$table = “maps”;

/*display the header nonsense

  • Make sure you change the header.html with your google API key, or else

include “header.html”;

// craft our MySQL query
$results = mysql_query (“SELECT * FROM $table ORDER BY id DESC”);

// start a loop that creates a point for each MySQL entry
While ($row = mysql_fetch_array($results)) {
$id = $row[“id”];
$lat = $row[“lat”];
$lon = $row[“lon”];
$name = $row[“name”];
$link = $row[“link”];
$class = $row[“class”];
$notes = $row[“notes”];

echo “var point = new GLatLng($lat,$long);”;
echo "var marker = createMarker(point,’<div style=“width:240px”>$name

echo “map.addOverlay(marker);”;
// spun out of our loop, display footer

include “footer.html”;


Is this the full script or have you just cut and paste bits in to show? I only ask in case you really have missed the opening <?php tag.

However, my fourpennyworth.

Do you have a connection to the database like:-
mysql_pconnect(“hostname”, “username”, “password”);
and a selection of the database with something like:-

Only I cannot see a connection to the database unless it is in header.html?


Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.