Tag Archives: pdo
php cannot check if a PDO result is empty using empty() returns FATAL ERROR
I want to check whether my prepared query has returned empty or not without having to go into a loop. This is the code I have tried using:
if(empty($pQuery1->fetch(PDO::FETCH_ASSOC))){}
When I try this I get the error:
Fatal error: Can't … Continuer la lecture
PDO : Combien est différente de mysql postgresql
Je veux utiliser MySQL sur mon local et PostgreSQL sur le serveur de production. Comment est-il difficile. Je suis novice mysql et n'ont aucune idée sur PostgreSQL. Je vais être en utilisant simplement crud avec des jointures. My coding is in PHP… Continuer la lecture
Automatically Catch Exceptions for PDO in PHP
Evening,
I am currently handling PDO exceptions like this:
try{
$db = Db::connect();
$query = $db->prepare( "SELECT * FROM table;" );
$query->execute();
}
catch( PDOException $e ) { error( 'MySQL error: ' . $e->getMessage(), __FILE__, __LINE__ ); }
…
My handling Continuer la lecture
PDO database for arabic characters
i want to insert arabic characters to database using pdo with php
but i got these charectors in database
الجامع ا
and when i put
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
the result was
??????????
…
i make the collection of the collom Continuer la lecture
PHP PDO Params – Les chaînes vides dans le tableau $ de données provoquer requête à l'échec
I have a PDO issue with PHP 5.3. I am running MaxDB 7.8 for my database – if you haven’t heard of that, you’re not alone. It’s an open-source enterprise database that is connected with MySQL on paper, mais il est… Continuer la lecture
En PHP + PDO fetch the details of the query last executed or fill the question marks in query with corresponding entries
I need to get the complete query with the filled values after the query got successfully executed, (basically I want the query string with the question marks in the query removed and get replaced with corresponding values) so that I… Continuer la lecture
How to check if column does not exist using PHP, PDO, MySQL?
In my application I have a generic query that applies to multiple users. There are instances where the table structure may differ between users. I have a query that I only want to apply to the users where the column… Continuer la lecture
PDO: nom de la ligne comme indice de tableau de résultat
J'ai cette “à l'ancienne” non-PDO MySQL query (the code isn’t tightened up, just to show exactly what I mean):
<?php
include('db_conn.php'); //Contains the connection info.
$category = 'cars';
$q = "SELECT * FROM `photos` WHERE `category` = '$category'";
$qResult = …
Necessary to increment PDO variables
I haven’t been able to find anything that explicitly answers this and have been wondering for a while. Sorry if it is a newbie question.
Do I have to increment or change my PDO variables in the following scenario. Si… Continuer la lecture
De base: Données CakePHP pas enregistré, ni la validation de travail?
Ce que je voudrais savoir, c'est une question à deux.
Pourquoi est la validation ne fait rien, et pourquoi ne pas envoyer les données à la base de données?
QuestionsController.php
public function index() {
$this->set('questions', $this->Question->find('all'));
}
public function view($id = null) …





