Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Brad Bonkoski
Matthew Ferry wrote: Hello Everyone Got a simple / stupid question. Worked on this all night. I'm over looking something very basic here. The query event_time brings back the calendar id for each event that is pending in the future. ie 12, 13, 14, 26 (There could be 100 of them out

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread tg-php
Try this as your SQL. It should give you all the results, then you can use PHP to sort it all out. SELECT * FROM egw_cal WHERE cal_category='501' and cal_id in (SELECT cal_id FROM egw_cal_dates where cal_start $tstamp) -TG = = = Original message = = = Hello Everyone Got a simple /

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Micah Stevens
This is a join - Read up on them, they're very useful and don't require the overhead of a sub-query. SELECT egw_cal.* FROM egw_cal_dates LEFT JOIN egw_cal using (cal_id) where egw_cal_dates.cal_start $tstamp AND egw_cal.cal_category = '501' -Micah On 02/12/2007

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Matthew Ferry
Thanks Everyone... After I sent that...I got thinking about doing both queries in one statement. So thats what I did. Its working fine... Here is the updated code: ?php $todays_year = date(Y); $todays_month = date(m); $todays_day = date(d); $tstamp = mktime(0, 0, 0, $todays_month,

Re: [PHP-DB] SQL query error

2006-12-16 Thread Jeffrey
Chris Carter wrote: What wrong with this syntax, its not giving any error on runtime but I am facing a blank page while paging. $query= SELECT * FROM gurgaonmalls WHERE mallname = '$mallname' limit $eu, $limit ; Have you tried... echo p $query /p; ...to unsure the variables have the values

RE: [PHP-DB] SQL query

2006-09-28 Thread Edwin Cruz
Make sure that your second query is returning only one row, if it dont help, try this: $query=select email from usuarios where userName in (select username from fussv where folio = 'FUSS-130-2006') MySQL think that you second query returns more than 1 row, that's why mysql dont accept your

RE: [PHP-DB] SQL query

2006-09-28 Thread Dwight Altman
Check your version. Subselects were only added in MySQL Version 4.1. Regards, Dwight -Original Message- From: Edwin Cruz [mailto:[EMAIL PROTECTED] Sent: Thursday, September 28, 2006 10:53 AM To: 'Miguel Guirao'; php-db@lists.php.net Subject: RE: [PHP-DB] SQL query Make sure

RE: [PHP-DB] SQL query

2006-09-28 Thread Miguel Guirao
OK, this makes my day clear!! I have versiĆ³n 3.23.49-3 of MySQL Thanks Dwight! -Original Message- From: Dwight Altman [mailto:[EMAIL PROTECTED] Sent: Jueves, 28 de Septiembre de 2006 11:32 a.m. To: php-db@lists.php.net Subject: RE: [PHP-DB] SQL query Check your version. Subselects

RE: [PHP-DB] sql query, editing?

2004-01-15 Thread Humberto Silva
Create a form for editing the record Then on the display funtion just put a link on each record to that form and pass the id of that record like a href=editrecord.php?id=?=$row['id']?edit/a On the edit form just grab the data of the $id passed on the url and put those values on the input fields

RE: [PHP-DB] SQL query...

2004-01-15 Thread brett king
SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ??? desc In the above sql statement, I'm trying to achieve: 1. select all file names, between two dates. 2. list them, and order by the highest number of

RE: [PHP-DB] SQL query...

2004-01-15 Thread Tristan . Pretty
Ah... you can name the count().. live and learn, cheers dude... brett king [EMAIL PROTECTED] 15/01/2004 11:17 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject RE: [PHP-DB] SQL query... SELECT DISTINCT(file_name), Count(file_name) FROM $table_name

Re: [PHP-DB] SQL query...

2004-01-15 Thread Nitin Mehta
use alias for 'Count(file_name)' to use in order by clause F.x. SELECT DISTINCT(file_name), Count(file_name) as file_count FROM $table_name WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by file_count desc Hope that solves it Nitin - Original Message - From:

Re: [PHP-DB] SQL query...

2004-01-15 Thread Muhammed Mamedov
Try this SELECT DISTINCT(file_name), Count(file_name) AS cnt FROM $table_name WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by cnt; desc Regards, Muhammed Mamedov tmchat.com - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent:

Re: [PHP-DB] SQL query...

2004-01-15 Thread CPT John W. Holmes
From: Muhammed Mamedov [EMAIL PROTECTED] Try this SELECT DISTINCT(file_name), Count(file_name) AS cnt FROM $table_name WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by cnt; desc If you're GROUPing by file_name then you don't need DISTINCT(file_name)... it's

Re: [PHP-DB] SQL Query

2002-09-06 Thread Adam Williams
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY Adam On Sat, 7 Sep 2002, Bryan McLemore wrote: Hi Guys I have written this SQL Query : CREATE TABLE tasks (id INT AUTO_INCREMENT, name VARCHAR(50), desc TEXT, address VARCHAR(50), startDate DATE, lastWork DATE, progress

RE: [PHP-DB] SQL query prob

2002-07-17 Thread Cal Evans
It would unless you told it not to. Set a flag $lastContactType=''; Then on the first page you display something where then display it and then if ($lastContactType != $row['contactType']){ echo $row['contactType']; $lastContactType=$row['contactType']; } // if ($lastContactType

Re: [PHP-DB] sql query problem

2002-06-14 Thread SenthilVelavan
Hello Chip, Could you please send your program to dig more.And also send your database schema. Do you want to select title,name from your_table_name where title='title1' and name='blue2'; Is the title and name field are unique.If it so,then the above query will helps you.

RE: [PHP-DB] sql query

2002-02-18 Thread Beau Lebens
try replacing WHERE display=$custcatergory); with WHERE display='$custcatergory'); and also tru echoing the value of that SQL statement (assign it to a var first) to make sure you are getting the right thing. HTH /b // -Original Message- // From: CrossWalkCentral [mailto:[EMAIL

Re: [PHP-DB] sql query

2002-02-18 Thread CrossWalkCentral
Thanks I will try that. Beau Lebens [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... try replacing WHERE display=$custcatergory); with WHERE display='$custcatergory'); and also tru echoing the value of that SQL statement (assign it to a var first) to make

RE: [PHP-DB] SQL query

2001-11-12 Thread Gonzalez, Lorenzo
/ANSI_diff_Sub-selects.html -Original Message- From: Pierre Sent: Mon 11/12/2001 12:20 AM To: Gonzalez, Lorenzo; [EMAIL PROTECTED] Cc: Subject: Re: [PHP-DB] SQL query Thanks but I think subselect

RE: [PHP-DB] SQL query

2001-11-11 Thread Gonzalez, Lorenzo
in other RDBMs this is easily done with a subselect - don't know if it's doable in MySQL or not, someone else can confirm, or you can try it yourself... select * from table1 where table1.id not in (select table2.id); -Lorenzo -Original Message- From: Pierre

Re: [PHP-DB] SQL query

2001-11-11 Thread Pierre
Thanks but I think subselect is not possible with MYSQL. Pierre - Original Message - From: Gonzalez, Lorenzo [EMAIL PROTECTED] To: Pierre [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, November 12, 2001 1:08 PM Subject: RE: [PHP-DB] SQL query in other RDBMs this is easily done