PDO
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
$query = $db->query($strSQL);
|
||||
|
||||
// Fetch the first row
|
||||
$row = $query->fetchArray(SQLITE3_ASSOC);
|
||||
$row = $query->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// If no results are found, echo a message and stop
|
||||
if ($row == false){
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
echo $line . "\n";
|
||||
// Fetch the next line
|
||||
$row = $query->fetchArray(SQLITE3_ASSOC);
|
||||
$row = $query->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
// Prints the column names
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
$stmt = $db->prepare("SELECT * FROM files where loc_id = :loc_id");
|
||||
$stmt->bindValue(":loc_id", $numDelete, SQLITE3_TEXT);
|
||||
$result = $stmt->execute();
|
||||
if ($row = $result->fetchArray()) {
|
||||
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$strFilename = $row['filename'];
|
||||
$strFilename = $uploaddir . $strFilename;
|
||||
unset($strFilename);
|
||||
@@ -67,7 +67,7 @@
|
||||
$stmt = $db->prepare("SELECT * FROM files where id = :id");
|
||||
$stmt->bindValue(":id", $numDelete, SQLITE3_TEXT);
|
||||
$result = $stmt->execute();
|
||||
if ($row=$result->fetchArray()) {
|
||||
if ($row=$result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$strFilename = $row['filename'];
|
||||
$strFilename = $uploaddir . $strFilename;
|
||||
unset($strFilename);
|
||||
@@ -181,7 +181,7 @@
|
||||
//$strSQL="SELECT * FROM location ORDER BY created_at DESC";
|
||||
$strSQL="SELECT l.id as lid,l.*,adr.* FROM location l LEFT JOIN address adr ON l.id=adr.loc_id ORDER BY created_at ASC";
|
||||
$result = $db->query($strSQL);
|
||||
while ($row = $result->fetchArray()) {
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$id = $row['lid'];
|
||||
echo "<tr>";
|
||||
echo "<td>".$id."</td>";
|
||||
@@ -194,7 +194,7 @@
|
||||
echo "<td>";
|
||||
$strSQL = "SELECT id,username,comment,created_at FROM comment WHERE loc_id=".$id;
|
||||
$comments = $db->query($strSQL);
|
||||
while ($comment = $comments->fetchArray()) {
|
||||
while ($comment = $comments->fetch(PDO::FETCH_ASSOC)) {
|
||||
echo "<div class='comment'>";
|
||||
echo "<em>".$comment['username']." schrieb am ";
|
||||
$numDatum = strtotime($comment['created_at']);
|
||||
@@ -215,7 +215,7 @@
|
||||
echo "<td id='img_".$id."'>";
|
||||
$strSQL = "SELECT id,filename FROM files WHERE loc_id=".$id;
|
||||
$files=$db->query($strSQL);
|
||||
if ($file=$files->fetchArray()) {
|
||||
if ($file=$files->fetch(PDO::FETCH_ASSOC)) {
|
||||
echo "<a href='../images/".$file['filename']."' data-lightbox='radweg".$id."'>";
|
||||
echo "<img src='../images/".$file['filename']."' style='width:150px'></a>";
|
||||
echo "<a href='".$_SERVER['PHP_SELF']."?delfid=".$file['id']."&csrf=".$_SESSION['csrf_token']."'><i class='fa fa-trash'></i></a>";
|
||||
|
||||
@@ -20,7 +20,7 @@ $boolLogin=true;
|
||||
$strPassword = trim($_POST['password']);
|
||||
$strSQL = "SELECT username,passwordhash FROM user WHERE username='$strUser'";
|
||||
$result = $db->query($strSQL);
|
||||
if ($row=$result->fetchArray()) {
|
||||
if ($row=$result->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (password_verify($strPassword,$row['passwordhash'])) {
|
||||
session_start();
|
||||
$_SESSION['user']=$strUser;
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
$strScript="";
|
||||
$strSQL="SELECT l.id as lid,l.*,adr.* FROM location l LEFT JOIN address adr ON l.id=adr.loc_id ORDER BY city,postcode,suburb,hamlet,road ASC";
|
||||
$result = $db->query($strSQL);
|
||||
while ($row = $result->fetchArray()) {
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$id = $row['lid'];
|
||||
$numDatum= strtotime($row['created_at']);
|
||||
$strDatum= date("d.m.Y",$numDatum);
|
||||
@@ -86,7 +86,7 @@
|
||||
echo "<td>";
|
||||
$strSQL = "SELECT id,username,comment,created_at FROM comment WHERE loc_id=".$id;
|
||||
$comments = $db->query($strSQL);
|
||||
while ($comment = $comments->fetchArray()) {
|
||||
while ($comment = $comments->fetch(PDO::FETCH_ASSOC)) {
|
||||
echo "<div class='comment'>";
|
||||
echo "<em>".$comment['username']." schrieb am ";
|
||||
$numDatum = strtotime($comment['created_at']);
|
||||
@@ -102,7 +102,7 @@
|
||||
echo "<td>";
|
||||
$strSQL = "SELECT id,filename FROM files WHERE loc_id=".$id;
|
||||
$files=$db->query($strSQL);
|
||||
if ($file=$files->fetchArray()) {
|
||||
if ($file=$files->fetch(PDO::FETCH_ASSOC)) {
|
||||
echo "<img src='../images/".$file['filename']."' style='width:200px'>";
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
@@ -11,7 +11,7 @@ $result = $db->query("SELECT * FROM location ORDER BY created_at ASC");
|
||||
|
||||
$coords_array = array ();
|
||||
|
||||
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$coords_array[]=$row;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user