RE: [PHP] SQL Syntax [improved SQL]

2010-06-16 Thread Tommy Pham
> -Original Message- > From: Jan Reiter [mailto:the-fal...@gmx.net] > Sent: Wednesday, June 16, 2010 8:55 AM > To: php-general@lists.php.net > Subject: Re: [PHP] SQL Syntax [improved SQL] > > Hi, > > this is the solution I came up with, that is over 10

Re: [PHP] SQL Syntax [improved SQL]

2010-06-16 Thread Jan Reiter
Hi, this is the solution I came up with, that is over 10 times faster than my first attemps. Tested @31,871 entries in table 'picture' and 222,712 entries in table 'picture_attrib_rel'. Old Version: SELECT * FROM picture as p INNER JOIN picture_attrib_rel as pr1 ON (p.pid = pr1.pid) INNER

Re: [PHP] SQL Syntax

2010-06-16 Thread Andrew Ballard
On Tue, Jun 15, 2010 at 8:58 PM, Jan Reiter wrote: > Hi folks! > > I'm kind of ashamed to ask a question, as I haven't followed this list very > much lately. > > This isn't exactly a PHP question, but since mysql is the most popular > database engine used with php, I figured someone here might hav

RE: [PHP] SQL Syntax

2010-06-16 Thread Jan Reiter
ards, Jan -Original Message- From: joerg.bru...@sun.com [mailto:joerg.bru...@sun.com] Sent: Wednesday, June 16, 2010 2:49 PM To: MYSQL General List Cc: Jan Reiter Subject: Re: [PHP] SQL Syntax Hi! Daniel Brown wrote: > [Top-post.] > > You'll probably have muc

Re: [PHP] SQL Syntax

2010-06-16 Thread Simcha Younger
On Wed, 16 Jun 2010 02:58:31 +0200 "Jan Reiter" wrote: > > I have 2 tables. Table A containing 2 fields. A user ID and a picture ID => > A(uid,pid) and another table B, containing 3 fields. The picture ID, an > attribute ID and a value for that attribute => B(pid,aid,value). > > > > Table B

RE: [PHP] SQL Syntax

2010-06-15 Thread Ashley Sheridan
ws yet, > but I can't find that stuff ... > > @Dan: Thanks for forwarding my mail to the MySQL List! > > Regards, > Jan > > > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] > Sent: Wednesday, June 16, 2010 3:09 AM > To: Jan Reiter > Cc: php-gene

RE: [PHP] SQL Syntax

2010-06-15 Thread Jan Reiter
gards, Jan From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Wednesday, June 16, 2010 3:09 AM To: Jan Reiter Cc: php-general@lists.php.net Subject: Re: [PHP] SQL Syntax On Wed, 2010-06-16 at 02:58 +0200, Jan Reiter wrote: Hi folks! I'm kind of ashamed to ask a question, as I h

Re: [PHP] SQL Syntax

2010-06-15 Thread Ashley Sheridan
On Wed, 2010-06-16 at 02:58 +0200, Jan Reiter wrote: > Hi folks! > > I'm kind of ashamed to ask a question, as I haven't followed this list very > much lately. > > > > This isn't exactly a PHP question, but since mysql is the most popular > database engine used with php, I figured someone he

Re: [PHP] SQL Syntax

2010-06-15 Thread Daniel Brown
[Top-post.] You'll probably have much better luck on the MySQL General list. CC'ed on this email. On Tue, Jun 15, 2010 at 20:58, Jan Reiter wrote: > Hi folks! > > I'm kind of ashamed to ask a question, as I haven't followed this list very > much lately. > > > > This isn't exactly a PHP

Re: [PHP] SQL syntax?

2008-12-05 Thread Ashley Sheridan
On Fri, 2008-12-05 at 16:51 -0600, Terion Miller wrote: > Excellent Allan thanks so much, sometimes I think php is causing me > blindness!! > Terion > > On Fri, Dec 5, 2008 at 4:26 PM, Allan Arguelles <[EMAIL PROTECTED]>wrote: > > > Try this: > > > > $sql = "SELECT WorkOrderID AS Work_Order_ID,

Re: [PHP] SQL syntax?

2008-12-05 Thread Terion Miller
Excellent Allan thanks so much, sometimes I think php is causing me blindness!! Terion On Fri, Dec 5, 2008 at 4:26 PM, Allan Arguelles <[EMAIL PROTECTED]>wrote: > Try this: > > $sql = "SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b. > %e, %Y %l:%i %p') AS Start_Date, > DATE

Re: [PHP] SQL syntax?

2008-12-05 Thread Allan Arguelles
Try this: $sql = "SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b. %e, %Y %l:%i %p') AS Start_Date, DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, "; $sql .= "Advertiser AS Advertiser_Name,AccountNum AS Account_Number, Impressions AS Ad_Impressions, "; $sql .

Re: [PHP] SQL syntax?

2008-12-05 Thread Terion Miller
ah...I also though it was because I didn't have a statement like where adsize = adsize or something but I tried that and got the same error I have been getting ... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

Re: [PHP] SQL syntax?

2008-12-05 Thread Allan Arguelles
Umm.. I meant you need to put $sql .= "FROM workorderform "; between these: $sql .= "AdSize AS Ad_Size, CPM AS CPM_Rate, "; $sql .= "ORDER BY StartDate DESC"; :) Terion Miller wrote: > On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles <[EMAIL PROTECTED]>wrote: > > >>> $sql = "SELECT Wo

Re: [PHP] SQL syntax?

2008-12-05 Thread Terion Miller
On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles <[EMAIL PROTECTED]>wrote: > > > > > $sql = "SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, > '%b. > > %e, %Y %l:%i %p') AS Start_Date, > > DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, "; > > $sql .= "Advertiser AS

Re: [PHP] SQL syntax?

2008-12-05 Thread Allan Arguelles
> > $sql = "SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b. > %e, %Y %l:%i %p') AS Start_Date, > DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, "; > $sql .= "Advertiser AS Advertiser_Name,AccountNum AS Account_Number, > Impressions AS Ad_Impressions, "; >

Re: [PHP] sql syntax problem

2004-12-13 Thread Richard Lynch
Merlin wrote: > SELECT c.name AS city > FROM geo_de.geodb_locations AS c, fix.user AS u > WHERE u.user_id =4 AND c.plz > LIKE "%u.plz%"; I believe you want something not unlike this: WHERE u.user_id = 4 AND c.plz LIKE concat('%', u.plz, '%') -- Like Music? http://l-i-e.com/artists.htm -- P

Re: [PHP] sql syntax problem

2004-12-13 Thread Thomas Munz
This is the PHP mailing list, not the SQL mailing list ;) but here is the syntax ( not tested ): SELECT c.name AS city FROM geodb_locations AS c, user AS u WHERE u.user_id = 4 AND c.plz LIKE u.plz; > Hello everybody, > > I am trying to create a sql query with php and I do h

RE: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-03 Thread Chris Worth
Thanks everybody, and Sam, that makes sense WRT the multiple words causing troubles. On Wed, 1 Aug 2001 12:54:01 -0400, Sam Masiello wrote: > >You will need to put single quotes around your variables in your SQL >statement. Like this: > >$sql = "UPDATE TABLE seminar SET >title='$title',spea

Re: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-03 Thread Werner Stuerenburg
>> insert into test values (0,''; DELETE FROM test; ',1); >> ERROR 1064: You have an error in your SQL syntax near '' at line 1 what about insert into test values (0,'\'; DELETE FROM test; ',1); the character ' is used to denote the beginning and the end of a field value. If you have this c

Re: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-02 Thread mike cullerton
t; > -- > From: scott [gts] [SMTP:[EMAIL PROTECTED]] > Sent: 01 August 2001 18:03 > To: php > Subject: RE: [PHP] SQL syntax error in PHP script. dunno what's > wrong > > no offense to you sam, but please dont ever simply place > single quotes around values

RE: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-02 Thread Tim Ward
om: scott [gts] [SMTP:[EMAIL PROTECTED]] Sent: 01 August 2001 18:03 To: php Subject: RE: [PHP] SQL syntax error in PHP script. dunno what's wrong no offense to you sam, but please dont ever simply place single quotes around values. you have

RE: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-01 Thread scott [gts]
ge- > From: Sam Masiello [mailto:[EMAIL PROTECTED]] > Subject: RE: [PHP] SQL syntax error in PHP script. dunno what's wrong > > > You will need to put single quotes around your variables in your SQL > statement. Like this: > > $sql = "UPDATE TABLE seminar SET &

RE: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-01 Thread scott [gts]
roll your own with relative ease: function db_quote($value) { return "'". preg_replace("/'/", "''", $value) ."'" } > -Original Message- > From: Matt Greer [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 01, 200

RE: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-01 Thread Sam Masiello
You will need to put single quotes around your variables in your SQL statement. Like this: $sql = "UPDATE TABLE seminar SET title='$title',speaker='$speaker',event_date='$tdate',time='$time',bldg='$bu ilding' ,rm='$room' WHERE id='$id'"; Without the quotes, SQL doesn't know that Something Ama

Re: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-01 Thread Matt Greer
on 8/1/01 11:35 AM, Chris Worth at [EMAIL PROTECTED] wrote: > > > hey gang. > > here is my sql statement from my php script. > > $sql = "UPDATE TABLE seminar SET > title=$title,speaker=$speaker,event_date=$tdate,time=$time,bldg=$building > ,rm=$room WHERE id=$id"; > strings in a mysql quer