use some more verbose logging after connection and query, like
if (DB::isError($dbh)) {
error_log($dbh->getDebugInfo());
}
if (DB::isError($result)) {
error_log($result->getDebugInfo());
}
And try what happens when you want to run the created SQL string from a
DB console.
Armin
Chris Beaart wrote:
> I'm using the script below. However while trying to connect to the MYSQL
> database nothing happens (also no PHP error). What could be wrong?
>
>
>
> Thank,
>
> Chris Beaart.
>
>
>
> ------------------
>
>
>
> <?php
>
> require_once ("C:/ms4w/Apache/php/PEAR/DB.php");
>
> session_start();
>
> require_once("common.php");
>
>
>
> function DB_addPoint($imgxy, $soort, $waarneming, $datum)
>
> {
>
> $db_host = "localhost";
>
> $db_type = "MYSQL";
>
> $db_name = "database";
>
> $db_user = "root";
>
> $db_pwd = "password";
>
>
>
> $dsn = "$db_type://$db_user:[EMAIL PROTECTED]/$db_name";
>
> error_log ($dsn);
>
> #MYSQL://root:[EMAIL PROTECTED]/database
>
>
>
> // CONVERT PIXEL X/Y TO MAP UNITS
>
> $imgxy_arr = explode(" ", $imgxy);
>
> $x_pix = $imgxy_arr[0];
>
> $y_pix = $imgxy_arr[1];
>
> $GEOEXT = $_SESSION["GEOEXT"];
>
> $geoDeltaX = $GEOEXT["maxx"] - $GEOEXT["minx"];
>
> $geoDeltaY = $GEOEXT["maxy"] - $GEOEXT["miny"];
>
> $mapW = $_SESSION["mapwidth"];
>
> $mapH = $_SESSION["mapheight"];
>
> $x_geo = round($GEOEXT["minx"] + (($x_pix/$mapW)*$geoDeltaX));
>
> $y_geo = round($GEOEXT["maxy"] - (($y_pix/$mapH)*$geoDeltaY));
>
>
>
> // CONNECT TO DB AND RUN QUERY
>
> //$geometry = "GeomFromText('POINT($x_geo $y_geo)',26591)";
>
> $sql = "INSERT INTO waarnemingen(x,y,soort,waarneming)
> VALUES($x_geo,$y_geo,'$soort','$waarneming')";
>
> #error_log ($sql);
>
>
>
> # SOMEWHERE HERE GOES SOMETHING WRONG
>
> $dbh = dbConnect($dsn);
>
> $result = $dbh->query($sql);
>
>
>
> // Check that $result is not an error
>
> if (DB::isError($result)) {
>
> $dbh->disconnect();
>
> return ($result->getMessage());
>
> } else {
>
> $dbh->disconnect();
>
> return 1;
>
> }
>
> }
>
>
>
> function dbConnect($dsn)
>
> {
>
> $dbh = DB::connect($dsn);
>
> if (DB::isError($dbh)) {
>
> die ($dbh->getMessage());
>
> return NULL;
>
> } else {
>
> return $dbh;
>
> }
>
> }
>
>
>
> ?>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> pmapper-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
pmapper-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmapper-users