Archivo de la etiqueta: DOP
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 … Sigue leyendo
DOP : How different is mysql from postgresql
I want to use Mysql on my local and PostgreSQL on production server. How difficult is it. I am mysql novice and have no idea on PostgreSQL. I will be using just crud with joins. My coding is in PHP… Sigue leyendo
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 Sigue leyendo
DOP base de datos de caracteres árabes
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 Sigue leyendo
PHP PDO Params – Empty strings in $data array cause query to fail
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, pero es… Sigue leyendo
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… Sigue leyendo
How to check if column does not exist using PHP, DOP, 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… Sigue leyendo
DOP: row name as index of result array
Tengo esta “old-style” 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… Sigue leyendo
Básico: Los datos de CakePHP no se salvan ni la validación de trabajo?
Lo que me gustaría saber es una pregunta de dos partes.
¿Por qué no la validación hacer nada, y por qué no va a publicar los datos de la base de datos?
QuestionsController.php
public function index() {
$this->set('questions', $this->Question->find('all'));
}
public function view($id = null) …





