I’m having a bit of trouble getting my retrieved values from an SQL query into the correct format. I’ve managed to join multiple rows into the one value, however I am not sure how to make it separate each of the values with a comma. Essentially I need all the ID’s of a product to be retrieved as, for example,
Tag: sql
Unknown Column in Field List. PHP + Mysql
I’m trying to add values to a table in phpmyadmin and I get the error: Unknown column ‘…’ in ‘field list’. Here’s my code: so when I enter fds as name in the form on the previous page I get : Unknown column ‘fds’ in ‘field list’. This never happened to me before and I have no idea on what
How do I get the query builder to output its raw SQL query as a string?
Given the following code: I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be SELECT * FROM users. How do I do this? Answer To output to the screen the last queries ran you can use this: I believe the most recent queries will be at the
Change time zone of gmdate PHP function
I am using the gmdate PHP function to insert the current date to the database but it shows GMT time , can I change it to my time zone +3 ? this is the code Answer “+3” is not a “timezone”. It’s an offset from UTC/GMT, which may change throughout the year based on DST settings. A timezone is something
Zend_Db_Table_Row_Exception
I have this query below which I am trying to port to Zend (even further below lol). I am getting this error: Uncaught exception ‘Zend_Db_Table_Row_Exception’ with message ‘Specified column “…
mysql sanitize row name
I’m currently writing a php framework with focus on security. I use a query builder to generate SQL-statements, so that it is not bound to MySQL. (Or SQL in general) I found certain posibilities that user could inject row names, so it has to escape them somehow. Because of how the query builder works, i sadly cannot use prepared statements.
MySQL error with Not unique table/alias with join
SELECT `idstudii` FROM (`studii`) JOIN `studii` ON `mesaje`.`idstudii`=`studii`.`id` JOIN `users` ON `users`.`id`=`studii`.`idusers` WHERE `studii`.`idusers` = ‘1’ I have this sql query which …
Do Not Duplicate VALUE if already exist on MySQL
I’ve been trying to accomplish this, but as other issues I just can’t figured it out. I’ve been reading around for posibles solutions but non of them goes along with my code, or if they do I can’t figure out how or where to use them. I have a DB where a user sends records. The database consist in few
PDO and MySQL ‘between’
I’m trying to get PDO to work with a MySQL ‘between’. Below is my code: What gets returned is an array with ‘0’ or ‘NULL’ for values. When I hard code the end date, it acts as if start_date is set to -1, retuning me all rows before the end_date. So, what am I doing wrong here? Answer Don’t wrap
SQL get results 21-30?
This seems like a really simple question but I can’t seem to find information on it. If I have 100 results, and I only want to get the results results between 21 and 30 (from the order my SQL query is grabbing them), how would I accomplish this? Answer You can use this: E.g.,