All Questions
20 questions
1
vote
0
answers
64
views
How to use implode() in sql operator? [duplicate]
My problem is that i stock a variable (id_chambre) as an array in my database and i want to use it in SQL but it's not working :
$sql = "SELECT c.*
FROM chambre AS c
LEFT JOIN reservation_client AS ...
1
vote
1
answer
240
views
Get data by week with sql and php
I have a problem and I have no idea how to do that. Please help me with an idea. So I have a table : test, with columns :
id begin end
1 2016-06-06 15:30:30 ...
0
votes
0
answers
144
views
PHP mysql update row where user id will be same [duplicate]
i want to insert the value in table first time once i did that again only update in same row and not insert again. my user id is unique
1
vote
3
answers
49
views
How can I limit the display to distinct records?
As shown in the picture below, there are redundant records. How can the redundancy be removed?
Here's my code:
<?php
$YearNow=Date('Y');
include('../connection/connect.php');
$result = $db->...
2
votes
2
answers
4k
views
Undefined Variable Header in PHP SEND MAIL
After my user registers, I want them to receive an email from my local host server which I'm running. The same script below works fine on a paid hosting but when I try to run it on my local host I get ...
2
votes
2
answers
2k
views
how to close connection using prepare statement in php?
I am using php to create the user accounts on server database.I have used prepare statement to create user account.I want to know how can i close my sql connection using prepare statement or i don't ...
1
vote
3
answers
5k
views
How to fetch data from database using prepare statement in php?
I have a database in which I have user_id & associated_id.There can be multiple associated_id for a single user_id. Now I want to fetch all the associated_ids into a single array. I have tried ...
2
votes
4
answers
98
views
Select with datetime from database
I have a problem with my select :
I have a form with 2 text boxes :
date_min and date_max. This dates come in controller :
2015-05-15
Now in database my dates : c_win like this :
2015-08-20 21:...
0
votes
2
answers
4k
views
using sql MONTH or YEAR in cakephp find queries
I'm trying to get all the users that has registered during a particular month using a query like this in a cakephp application:
$registered_users = $this->User->find('all', array(
'...
0
votes
1
answer
156
views
english textual date expression cakephp find queries
let's say that I have a database table called users in a cakephp application which contains a bunch of users and in that table I have a field called date which contains the registration date of each ...
0
votes
2
answers
6k
views
mySQL PHP print results from multiple rows
This is a beginner PHP/SQL question.
Basically, I have a Database that looks like this
Poem_id | Poem_content | Poem_by | Poem_hotscore
------------ ----------------- ----------- ---------...
1
vote
1
answer
5k
views
MySQLi return an array with bind_result and fetch not working
I was wondering how to rewrite/fix the following code.
Basically, I have a database named DB and a table in it called poems. I want to get all the data in the poems table that has a certain ID (i.e. ...
1
vote
2
answers
2k
views
mysql FOUND_ROWS() return wrong value
I'm trying to use FOUND_ROWS() in my query, but the function returns wrong values sometimes.
SELECT SQL_CALC_FOUND_ROWS adminslog.*, admins.fullName FROM adminslog
JOIN admins ON admins.id=adminslog....
4
votes
2
answers
3k
views
MySQL: remove number prefix from all records
I have this page table below and I want to remove the numbering prefix of '999' from the column of template_id,
page_id template_id url
1 9991 a
2 9992 b
3 ...
-4
votes
1
answer
90
views
Modify the SQL result
I want to count the total row where parent id is equal to page id in a page table,
SELECT
parent_id
COUNT(*) AS total
FROM page AS p
WHERE p.parent_id = p.page_id
AND p.type = 'page'
and I ...
0
votes
4
answers
276
views
MySQL: Combining two repetitive queries
I have this in info in a table where sometime the pd_id is NULL
doc_id doc_title doc_order pg_id
14 a.zip 1 NULL
15 b.zip 2 NULL
12 c.zip ...
1
vote
1
answer
643
views
Converting Integer into time value, using SQL
So I am using the following SQL search to add all time values in a database in the hours field of the logbook database:
SELECT SUM(hours) FROM logbook
But there is a problem as I recieve the output:
...
3
votes
1
answer
1k
views
What is a good query builder that can parse and rebuild SQL queries on PHP 5.3?
I do not want an ORM. I am comfortable with writing heavily targeted and optimized queries on my own, and I do not want any sort of ORM bloating my code.
I am looking for a light-weight, object-...
0
votes
2
answers
274
views
Store Open/Close Times and DST Changes
I've been stuck on this for two days and have gotten no where. I tend to think future and the future problems that will come around. My server's time is set to UTC and linux box is fully updated ...
4
votes
1
answer
789
views
sql help getting data from all the followers ? ( like twitter if we follow )
example if i have
follow table
company one ( cid = 1 ) following two ( cid = 2 )
company one ( cid = 1 ) following three( cid = 3 )
feeds table
company one ( cid = 1 ) type 'product' description '...