Re: [PHP] SQL Syntax

2010-06-16 Thread Andrew Ballard
On Tue, Jun 15, 2010 at 8:58 PM, Jan Reiter the-fal...@gmx.net 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

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 [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 times faster than my first attemps

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 the-fal...@gmx.net 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

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 here might

RE: [PHP] SQL Syntax

2010-06-15 Thread Jan Reiter
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 haven't followed

RE: [PHP] SQL Syntax

2010-06-15 Thread Ashley Sheridan
: 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-general@lists.php.net Subject: Re: [PHP] SQL Syntax On Wed, 2010-06-16 at 02:58 +0200, Jan Reiter

[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

[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

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, ; $sql .=

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
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 WorkOrderID AS

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

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,

[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

[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 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 -- PHP

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

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] 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 [snip]

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

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

2001-08-03 Thread Chris Worth
] -Original Message- From: Chris Worth [mailto:[EMAIL 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

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

2001-08-02 Thread Tim Ward
] [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 to escape the values

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

2001-08-02 Thread mike cullerton
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 to escape the values *themselves*. what if someone submitted the form field title as: $title = '; DELETE FROM

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 query need to

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

2001-08-01 Thread Sam Masiello
] 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_date=$tdate,time=$time,bldg=$building ,rm=$room WHERE id=$id; it appears just like that in my

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

2001-08-01 Thread scott [gts]
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, 2001 12:45 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] SQL syntax error in PHP script. dunno

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

2001-08-01 Thread scott [gts]
]] 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 title='$title',speaker='$speaker',event_date='$tdate',time='$time',bldg='$bu ilding' ,rm