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

[PHP] SQL Syntax

2010-06-15 Thread Jan Reiter
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 have an idea. I have 2 tables. Table A containing 2 fields.

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, "; >

[PHP] SQL syntax?

2008-12-05 Thread Terion Miller
Hi I am having problems (yep me again) with my sql, I have looked and tried different things (ASC, DESC, etc) but it same error: Here is the error: 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 'ORDER BY StartD

[PHP] sql syntax using sprintf

2008-05-18 Thread Sudhakar
until i started using the techniques for avoiding sql injection, i have been using a normal insert and select sql query which worked fine. i have a registration page where a user enters their username and if this already exists i display a message by executing a select query and if the username do

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

[PHP] sql syntax problem

2004-12-13 Thread Merlin
Hello everybody, I am trying to create a sql query with php and I do have a syntax problem with the mysql query. One row is called "plz" and I would like to search for a value inside that with a like statement. Problem is, the system takes the u.plz as a character not as a table element: LIKE

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] Further help for PHP, SQL syntax, and register_globals

2004-10-26 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 26 October 2004 12:01, John Holmes wrote: > Sugimoto wrote: > > Bad query: You have an error in your SQL syntax near 'and Tit like > > and Aut like and Auty like ' at line 4 > [s

Re: [PHP] Further help for PHP, SQL syntax, and register_globals

2004-10-26 Thread John Holmes
Sugimoto wrote: Bad query: You have an error in your SQL syntax near 'and Tit like and Aut like and Auty like ' at line 4 [snip] foreach ($_GET as $value) { if (empty($value)) $value = "%"; You have an issue here. You're looping through $_GET and attempting to set a default value (which is

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

2001-08-03 Thread Chris Worth
together in the same string. > >HTH > >Sam Masiello >Software Quality Assurance Engineer >Synacor >(716) 853-1362 x289 >[EMAIL PROTECTED] > > -Original Message- >From: Chris Worth [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, August 01, 2001 12:36 PM &g

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
MAIL PROTECTED]] Sent: Wednesday, August 01, 2001 12:36 PM To: [EMAIL PROTECTED] Subject:[PHP] SQL syntax error in PHP script. dunno what's wrong hey gang. here is my sql statement from my php script. $sql = "UPDATE TABLE seminar SET title=$title,speaker=$speaker,event_da

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

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

2001-08-01 Thread Chris Worth
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"; it appears just like that in my code. here is the $sql string echoed to the screen to verify the vari