• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

PHP connection problem

Hi All,
Can't seem to get this connection working for DB. I'm using Dreamweaver and so its a separate connection file.
The error I get is:
Line 50: Character Expected
Line 50 in the source of the page reads "No Result"

Any help would be greatly appreciated.
Thanks,
D

Here is the connection file:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_Map = "localhost";
$database_Map = "test";
$username_Map = "root";
$password_Map = "";
$Map = mysql_pconnect($hostname_Map, $username_Map, $password_Map) or trigger_error(mysql_error(),E_USER_ERROR);
?>

And here is the php part of the file:
<?php
include_once('../Connections/Map.php');

mysql_select_db($database_Map, $Map);
$result = mysql_query("SELECT * FROM subfinder",$map);
if (!$result)
{
echo "no result";
}

while($row = mysql_fetch_array($result))
{
if ($row['marker'] == 'A') $marker_type = 'Active';
if ($row['marker'] == 'M') $marker_type = 'Museum';
if ($row['marker'] == 'S') $marker_type = 'Sunk';
if ($row['marker'] == 'E') $marker_type = 'Event';
$info_text = "<div id=\"infowindow\" style=\"white-space: nowrap;\"><b>" . $marker_type . "</b><br>" . $row['desc'] . "<br><br><a href=" . $row[url] . " target=_blank>Link</a></div>";
echo "var point = new GPoint(" . $row['lon'] . "," . $row['lat'] . ");\n";
echo "var marker = createMarker(point, '" . $info_text . "','" . $row['marker'] . "');\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}

mysql_close($Map);
?>
0
dereksheahan
Asked:
dereksheahan
  • 6
  • 5
1 Solution
 
jmar_clickCommented:
try excluding the password map variable from the connection if you're not using a password
0
 
dereksheahanAuthor Commented:
Hi jmar_click,
no its still giving the same error I'm afraid
0
 
jmar_clickCommented:
ah, I see the problem, you misspelled mysql_connect, you have mysql_pconnect

$Map = mysql_pconnect($hostname_Map, $username_Map, $password_Map) or trigger_error(mysql_error(),E_USER_ERROR);

$Map = mysql_connect($hostname_Map, $username_Map, $password_Map) or trigger_error(mysql_error(),E_USER_ERROR);
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jmar_clickCommented:
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'dbname';
mysql_select_db($dbname);

You can set up your connection this way also, pretty much the same.
0
 
dereksheahanAuthor Commented:
Thats it. Thanks. I had seen that earlier and for some reason DW had named a lot of my connection files this way??? Ah well, it works now so I won't complain.
Thanks again,
D
0
 
jmar_clickCommented:
yeah, DW is quicky somethimes. Glad you got it working.
0
 
dereksheahanAuthor Commented:
Hi jmar_click,
I don't know whats going on here but its not working again??? Maybe I was testing the wrong file a while ago when I thought it was working. These 12 hr days must be messing with my head :) I'll play around with it for a couple more mins and if I'm still stuck I'll let you know.
Thanks,
D
0
 
dereksheahanAuthor Commented:
Now its giving me this msg in the java console :
Error: missing ; before statement
Source File: http://localhost/reachateacher_website/map/subfindertester.php
Line: 50, Column: 3
Source Code:
line 50:  no result
0
 
dereksheahanAuthor Commented:
This is strange because I had the file working on the web-server and now I'm trying to change it back to the localhost one easy testing again.
0
 
jmar_clickCommented:
Post this question under the javascript section so java experts can help you, i'm not too good in that area, and include the javascript code thats giving you the error.

But double check and make sure you didn't change anything where you could have left out a semicolon
0
 
dereksheahanAuthor Commented:
thats what I'm doing right now :) Thanks jmar_click
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now