I created a simple messaging system on my website where new registered users can send message to one another. the following mysql statement works well on my site,but my problem is- when UserA sends a …
Tag: mysql
Error when upgrading MySQL to PDO: Call to a member function fetch() on a non-object
I’m just learning PHP and MySQL, and I’m trying to put in a comment system. I found this website: http://www.evanpetersen.com/item/php-and-mysql-recursion.html which seems to have what I want. However,…
How do active class on pagination
I’m trying to active class on list Kindly if any one can help me to add class=”active” on displayed pagination page: $perpage= $conf[‘perpage’]; if (isset($_GET[“page”])) { $page = $_GET[“…
How to insert data using CI active record to field names with space?
How to insert data to the fields with name containing space. eg : Insert batch is also not working. Answer Check the following code. Which worked for me. use $db->set method
assigning variables to sql query result
Amateur here, just practicing some sql. I am trying to assign php variables to my sql query results, and I thought I saw it work in this fashion, but it doesn’t seem to be working for me: $query1 = …
Nest JSON from MySQL using PHP
I have a MySQL query which returns the following table: and I have to return, via PHP, a formatted JSON which looks like the following: Basically, I need to nest the invitations inside each event. Answer Try this.
What is the simplest way of implementing pricing plans in mysql and php?
I am working on a project, and I am trying to find a way to associate my pricing plans table with a customer. id name description price days 1 Free the free plan 0.00 0 2 Silver …
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 ?? Her…
The meaning of a mysql query
I’m working with hierarchical data in my cms. My menu table is this: id || name || lft || rgt And my left and right columns are: To retrieving a full tree and it’s depth, I’ve found this query: …
lastInsertId() for UPDATE in Prepared Statement
The code above does not work. The value I am trying to get is primary key auto increment. As lastInsertId() suggests by its name, it may be intended for insert only. If so, what is the proper way to achieve the same goal on an UPDATE? The value I wish to return is the primary key of the table, if