I have database table options, where am using it as a dedicated table to store information. I have never heard of this type of table query and have never tried it. I saw on WordPress database so thought to try my own. Here’s database table This is what am trying now This is inside my database class file $db The
Tag: sql
MySQL automatically updating field when inserting data
I’m making a web application to make customers order items for anything. For that I’ve made a MySQL database which has the following tables: customers orders orders-items products In the customers table is all the information about the person such as: The customer ID, for the primary key and auto increment (id) The first name (first_name) The last name (last_name)
Codeigniter or_where_in
I am trying to combine these two queries in Codeigniter. So the row either has to have the user_id of $user eg 3 OR have an id matching the array $repost. I know how to do or_where but how do you do or_where_in? Thanks Answer Syntax: Parameters: Returns: Return type: Generates a WHERE field IN(‘item’, ‘item’) SQL query, joined with
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
MySQL Rows Disappearing (Mysteriously)
I have 3 tables A, B and C which are directly linked and should contain the same number of rows, the rows for each table being created together. I’ve recently noticed that after creating 1000 rows for test purposes (rows are definitely inserted, no transactions, system stable), and without any application activity, there seem to be rows missing. A random
Single IF statement vs multiple IFs statements in array obtained from SQL table [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 8 years ago. Improve this question I have a table displaying results from a SQL query. However, for some exceptional rows (where SOURCE=”ABC”), I would like the
MySQL GROUP_CONCAT with COLUMN SPLIT
I am working with a TABLE, need logical help. Check the below URL for the table structure and sample data. http://sqlfiddle.com/#!2/ece06/2 Table Schema: Inserted Data: Query: OutPUT: Expected OUTPUT: As you can see the output of the query has concat with comma. And currently we are doing string concat using PHP which splits while displaying!! Is there any other way
MySQL syntax ERROR, I simply don’t see where
I am having a syntax error with an sql statement I am executing but for the life of me I can’t find any error. I have created my own database class with functionality to make prepared statements and execute them, I don’t think there is a problem with my implementation as I have never had any issues with it before
Laravel or where
Currently I am working on a project in Laravel but I am stuck.I want to create a SQL statement like this: Now I have this code: But that generates: How can I get the correct “or” order? Answer Check out the Logical Grouping section in the docs: https://laravel.com/docs/master/queries#logical-grouping It explains how to group conditions in the WHERE clause. It should
Having trouble optimizing MySQL query with GROUP BY … HAVING
I’m trying to optimize quickly optimize the search functionality of some outdated forum software written in PHP. I’ve got my work down to a query that looks like this: word1 and word2 are examples; there could be any number of words. The number at the very end of the query is the total number of words. The idea is that