Skip to content
Advertisement

Tag: pdo

PHP: update through array

I have a problem with the following code. index.php crud.class.php The code “works” but it doesnt do it the right way. It does update at the requested id in the correct table, but the values are both the same. The data base contains 2 cols (gerecht and omschrijving) and the values that will be updated to the database a both

How to create PDO connection in __construct()?

I have one class that is containing three methods. All of those methods need to database, Then I want to create a system for connection to database before everything. Something like this: Now I want to know (in first) what I did is a standard approach? and (in second) how can I check [if connection was disconnect (in other word

Search tags in mysql table with PHP

I have a table with some submissions, this table has a tags field, and I need to search in it. The data is saved in JSON format in the table, like this: [“basic”,”example”,”html”,”chart”] I’m trying …

Cast a column as Boolean in PDO

I have a field (‘done’) in the Database which is boolean. The function which GET/ the rows doesn’t return a json with that field as boolean but it returns 1 or 0. How can I get THAT column (‘done’ column) as boolean? I mean, Is posible to cast a column with PDO::PARAM_BOOL ?? Here is my sample of UPDATE that

PHP PDO::FETCH_ASSOC returns false

In this code fetch(PDO::FETCH_ASSOC) retunrs false even if $row>0. I couldn’t find why this is happening. Here session is not set as $member is null. <?php $sql = "SELECT * FROM members WHERE …

Confused with oledb and odbc

I heard about oledb and odbc, and I know both are database programming interfaces. I am trying to establish an oledb connection with the php script. I have mysql server 2012 running on my computer. I know how to create an odbc connection with pdo in php like PDO::OLEDB_ATTR_USE_ENCRYPTION,PDO::OLEDB_ATTR_USE_CONNECTION_POOLING etc. But I need to know where can I execute this

Sqlite PDO query returns no results

Getting no results no matter how broad my query PHP: 5.3 Sqlite3: 3.6 PDO: 5.3.3 I would think this should be a very simple process but even looking around I still don’t know why I’m getting 0 results. Here is my code: Any ideas on what I am doing wrong? The ‘foo’ table will only have four columns, and this

Advertisement