Answer the question
In order to leave comments, you need to log in
How to make the correct query to the database?
Greetings! How to make the correct query to the database? Writes I can not execute the query, because it cannot find the table. What am I doing wrong? Help please)
Code:
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$real_psw = 'mercury';
$salt = strrev($real_psw).strtolower($real_psw).sha1($real_psw);
$psw_to_db = crypt($real_psw, $salt);
$dbName = $_SERVER["DOCUMENT_ROOT"] . "/PrizivClient123.mdb";
if (!file_exists($dbName)) {
die("Could not find database file.");
}
try {
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=$dbName;Pwd=$psw_to_db");
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
}
catch (PDOException $e) {
echo $e->getMessage();
}
$sql = "SELECT COUNT(*) FROM Призывники";
$result = $db->query($sql);
$row = $result->fetch();
var_dump($row);
?>
Answer the question
In order to leave comments, you need to log in
https://developer.mozilla.org/en-US/docs/Web/CSS/t...transform: rotate(90deg)
<div>
<p>Some Text</p>
</div>
div {
display: inline-block;
transform: rotate(-90deg);
}
div p {
font-weight: bold;
}
More verbose, but IMHO
more structurally correct (look at the behavior of blocks).
From all that I see, I strongly advise against calling tables by Russian names. From what I read in the comments - it looks like the problem is there. Because no matter what data is there in the table itself, select count(*) from Conscripts would return something if there is data. Naming tables, queries and procedures with Russian names, placing the database in paths with Russian names... There are subtle glitches.
Conclusion? Rename the table to at least Prisivnyk and try select count(*) from Prisivnyk
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question