Skip to content

Commit

Permalink
Use PDO in the local cellid script
Browse files Browse the repository at this point in the history
With 13ae949 the `mysql` calls have been changed to calls using the `PDO`
classes. This updates `cellid_local.php` to use `PDO` as well. It also uses
the proper capitalisation of the columns because at least the SQLite driver
is case sensitive.
  • Loading branch information
xZise committed Dec 9, 2015
1 parent bc00440 commit fdb9cfd
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions cellid_local.php
@@ -1,16 +1,15 @@
<?php

require_once("config.php");
require_once("database.php");

if(!@mysql_connect("$DBIP","$DBUSER","$DBPASS"))
$db = connect_save();

if ($db === null)
{
echo "Result:4";
die();
}

mysql_select_db("$DBNAME");


if ($_REQUEST["myl"] != "")
{
$temp = split(":", $_REQUEST["myl"]);
Expand All @@ -33,10 +32,10 @@
}


$result=mysql_query("Select latitude,longitude FROM cellids WHERE cellid='$mcc-$mnc-$lac-$cid' order by dateadded desc limit 0,1");
$result = $db->exec_sql("SELECT Latitude, Longitude FROM cellids WHERE CellID=? ORDER BY DateAdded DESC LIMIT 0,1", "$mcc-$mnc-$lac-$cid");

if ( $row=mysql_fetch_array($result) )
echo "Result:0|".$row['latitude']."|".$row['longitude'];
if ( $row=$result->fetch() )
echo "Result:0|$row[Latitude]|$row[Longitude]";
else
echo "Result:6"; // No lat/long for specified CellID

Expand Down

0 comments on commit fdb9cfd

Please sign in to comment.