Re: [PHP-DB] Correct Syntax?

2015-10-30 Thread chimurenga chimurenga
make vehicle licence the unique key On 14 Oct 2015 00:28, "Karl DeSaulniers" wrote: > > Quick question. Is this viable in MySQL? > > UNIQUE KEY `Vehicle_Name` (`Vehicle_Make`+`Vehicle_Model`+`Vehicle_Style`+`Vehicle_License`) > > TIA > > Best, > > Karl DeSaulniers > Design

Re: [PHP-DB] Correct Syntax?

2015-10-13 Thread Roberto Spadim
instead of +, use ",' 2015-10-13 20:21 GMT-03:00 Karl DeSaulniers : > Quick question. Is this viable in MySQL? > > UNIQUE KEY `Vehicle_Name` > (`Vehicle_Make`+`Vehicle_Model`+`Vehicle_Style`+`Vehicle_License`) > > TIA > > Best, > > Karl DeSaulniers > Design Drumm >

Re: [PHP-DB] SQL syntax

2013-01-15 Thread Amit Tandon
SELECT orderid FROM ORDERS_TABLE WHERE orderstatus IN ( 'Cancelled', 'New', 'Denied', 'Expired' , 'Failed' , 'Pending' , 'Refunded' , 'Reversed' , 'Under Review' , 'Voided') AND orderdate '.mysqli_real_escape_string($ yesterday); Another option would be to use

Re: [PHP-DB] SQL syntax

2013-01-15 Thread Karl DeSaulniers
On Jan 15, 2013, at 5:25 AM, Amit Tandon wrote: SELECT orderid FROM ORDERS_TABLE WHERE orderstatus IN ( 'Cancelled', 'New', 'Denied', 'Expired' , 'Failed' , 'Pending' , 'Refunded' , 'Reversed' , 'Under Review' , 'Voided') AND orderdate

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Or something like this? SELECT * FROM `Bible_trivia` WHERE answer=`answer`; Then match the results to trivia_answer_1 in php to see if correct. if($trivia_answer_1 == $results) { ... do this } or a switch switch ($results) { case $trivia_answer_1: ... do this

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Heh, Thanks Karthik. Not my post.. :) But your solution looks dead on.. Here you go Ron. Try this one. Best, Karl On Oct 13, 2011, at 2:42 AM, Karthik S wrote: Try this, select CASE answer when 1 then trivia_answer_1 when 2 then trivia_answer_2 when 3 then

RE: [PHP-DB] SELECT syntax

2011-10-12 Thread Toby Hart Dyke
Not terribly elegant, but this should work: SELECT `trivia_answer_1` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=1 UNION SELECT `trivia_answer_2` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=2 UNION SELECT `trivia_answer_3` AS `trivia_answer` FROM `Bible_trivia` WHERE

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Jack van Zanen
Hi In Oracle (and maybe others) you can use select case when answer=1 then trivia_answer_1 when answer=2 then trivia_answer_2 when answer=3 then trivia_answer_3 when answer=4 then trivia_answer_4 else null end answer from bible_trivia_table OR You can select all of them and process in PHP,

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
select casehttp://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html works in mysql also regds amit The difference between fiction and reality? Fiction has to make sense. On Thu, Oct 13, 2011 at 3:26 AM, Jack van Zanen j...@vanzanen.com wrote: Hi In Oracle (and maybe

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
another examplehttp://mysql-tips.blogspot.com/2005/04/mysql-select-case-example.html regds amit The difference between fiction and reality? Fiction has to make sense. On Thu, Oct 13, 2011 at 9:34 AM, Amit Tandon att...@gmail.com wrote: select

Re: [PHP-DB] Query syntax error?

2011-01-13 Thread jose
you have renamed places_data table to 'a' 2011/1/13 Harvey har...@harveyk.com: Hello, I have a query on a page that used to work fine, but is now generating an error. I assume that the version of php or mysql was updated on the webhost server or something like that? Here is the query:

RE: [PHP-DB] Query syntax error?

2011-01-13 Thread Harvey
Thanks, I got it working now, had to use the a/b/c thing a few times -Original Message- From: jose [mailto:jojap...@gmail.com] Sent: Thursday, January 13, 2011 9:52 AM Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Query syntax error? you have renamed places_data table to 'a' 2011/1

RE: [PHP-DB] UPDATE syntax

2007-12-13 Thread Gary Wardell
Hi, I'm a beginner at PHP and MySql but a long time MS SQL server user. Maybe it should be `advertisements`.`displayed` instead? I just did a test and my Query browser doesn't like `interestcodes.id` but likes `interestcodes`.`id`. Notice the quotes (accents) on each side to the period. Gary

RE: [PHP-DB] UPDATE syntax

2007-12-13 Thread TG
-them are used to be explicit with a name. -TG - Original Message - From: Gary Wardell [EMAIL PROTECTED] To: php-db@lists.php.net Date: Thu, 13 Dec 2007 19:33:57 -0500 Subject: RE: [PHP-DB] UPDATE syntax Hi, I'm a beginner at PHP and MySql but a long time MS SQL server user. Maybe

Re: [PHP-DB] Query syntax

2007-09-15 Thread TG
SELECT * FROM table WHERE listing_type LIKE '%$listing_type%' AND (listing_approved = '1' OR listing_approved = '2') ORDER BY name ASC (notice the parentheses around the OR part of the clause) or you can do this... SELECT * FROM table WHERE listing_type LIKE '%$listing_type%' AND

Re: [PHP-DB] Verifying syntax executed correctly

2006-10-17 Thread Chris
Ron Piggott (PHP) wrote: If I give this command through PHP to mySQL mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( Unable to select database); $query = UPDATE `table` SET `last_activity_field` = '$current_date' WHERE `reference` = '$account_reference' LIMIT

Re: [PHP-DB] Verifying syntax executed correctly

2006-10-17 Thread Niel Archer
Hi All of the MySQL functions you used, return FALSE on failure. Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] Verifying syntax executed correctly

2006-10-17 Thread Bastien Koert
mysql_query($query) or die(mysql_error); will give an error and stop the script if there is an issue, this also can work for the mysql_select_db bastien From: Ron Piggott (PHP) [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: PHP DB php-db@lists.php.net Subject: [PHP-DB] Verifying syntax

Re: [PHP-DB] EXISTS syntax for SELECT INTO?

2006-10-11 Thread Chris
Tony Grimes wrote: I have a script that creates a table copy using SELECT INTO, but I want it to check if the new table already exists first. Does SQL support the EXISTS keyword for SELECT INTO statements (I'm running PG7)? If not, is there another way to do it in SQL? I'd rather not do it

Re: [PHP-DB] If syntax

2005-10-02 Thread Jeffrey
See below... Ron Piggott wrote: Take a look at my if ( ) syntax line below. I am wondering if I have it wrong in same way. What I am trying to achieve is if the alias the user enters is already found in the database I want the words Alias already in use to be shown on the screen; otherwise

RE: [PHP-DB] If syntax

2005-10-02 Thread Bastien Koert
you need to check the num of rows returned, since the query always(if it works) returns true $result = mysql_query($query); if (($result)(mysql_num_rows($result)==1)) { echo Alias already in use; } else { echo Unique alias; mysql_close(); } Bastien From: Ron Piggott [EMAIL

RE: [PHP-DB] If syntax

2005-10-02 Thread RaJeSh VeNkAtA
think this is wrong ... as it gives unique alias even if the query is not executed .. rajesh On Sun, 2 Oct 2005, Bastien Koert wrote: you need to check the num of rows returned, since the query always(if it works) returns true $result = mysql_query($query); if

RE: [PHP-DB] If syntax

2005-10-02 Thread Mitchell, David
alias LIKE '%' LIMIT 1; at execution-time. Regards, Dave -Original Message- From: Jeffrey [mailto:[EMAIL PROTECTED] Sent: Sun 10/2/2005 3:32 AM To: Cc: PHP DB Subject: Re: [PHP-DB] If syntax See below

RE: [PHP-DB] If syntax

2005-10-02 Thread Mitchell, David
: Subject: RE: [PHP-DB] If syntax Please PMJI, but I'm new to PHP but have a little experience with databases, and I have a question: Is there a particular reason that LIKE is used in the query? Let's say you had the contrived alias value in the table, 'a

RE: [PHP-DB] If syntax

2005-10-02 Thread Bastien Koert
PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: [EMAIL PROTECTED], php-db@lists.php.net Subject: RE: [PHP-DB] If syntax Date: Sun, 2 Oct 2005 22:25:16 +0530 (IST) think this is wrong ... as it gives unique alias even if the query is not executed .. rajesh On Sun, 2 Oct 2005, Bastien Koert wrote

Re: [PHP-DB] If syntax

2005-10-01 Thread RaJeSh VeNkAtA
i think for unique alias u have keep alias='$alias' ?? and also if statement will always be true as the mysql statement is always correct and will be executed . U have to check the result of query for whether there r ne aliases or not ... On Sat, 1 Oct 2005, Ron Piggott wrote: Take a

Re: [PHP-DB] MySql syntax error using PHPWiki

2004-06-10 Thread Mikhail U. Petrov
Hi! You missed table definition: ... FROM my_table where ... Wednesday, June 9, 2004, 12:57:02 PM, PHPDiscuss wrote: PPNaml Greetings, PPNaml I'm trying to set up a PHPWiki using Apache 2.0.49, PHP 4.3.7, PEAR 4.1.0, PPNaml and PHPWiki 1.3.10. PPNaml I get this error when trying to load

RE: [PHP-DB] Oracle syntax

2004-06-10 Thread Marie Osypian
It can be found here: http://us3.php.net/manual/en/ref.oracle.php MAO -Original Message- From: Rafi Sheikh [mailto:[EMAIL PROTECTED] Sent: Thursday, June 10, 2004 9:33 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle syntax Hi list. I am a newbie and would like to ask if anyone

Re: [PHP-DB] Oracle syntax

2004-06-10 Thread Christopher Jones
Rafi Sheikh wrote: Hi list. I am a newbie and would like to ask if anyone could give me the proper syntax for connecting with oracle DB. For example with MySQL it is: mysql_connect..., mysql_query... For MS SQL Server: mssql_connect..., mssql_query... There are various examples in the PHP

Re: [PHP-DB] sql syntax error

2003-01-29 Thread 1LT John W. Holmes
- Original Message - From: Addison Ellis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 28, 2003 10:46 PM Subject: [PHP-DB] sql syntax error hello, i can not pinpoint this. your time and help is very much appreciated. best, addison Error: id=,

Re: [PHP-DB] search syntax

2002-07-21 Thread Tony
Try break up the query, like: WHERE (column1 LIKE '%$search%' OR column2 LIKE '%$search%' OR column3 LIKE '%$search%') AND ... Tony S. Wu Matthew K. Gold at [EMAIL PROTECTED] wrote: hi everyone, I'm writing the code to make my mysql database searchable. I can search two columns, but I

Re: [PHP-DB] search syntax

2002-07-21 Thread Matthew K. Gold
Great--it works now. Thanks very much, Tony. I appreciate your help. best, Matt - Original Message - From: Tony [EMAIL PROTECTED] To: Matthew K. Gold [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, July 22, 2002 1:01 AM Subject: Re: [PHP-DB] search syntax Try break up the query

RE: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Ryan Jameson (USA)
desc is a key word. :-\ -Original Message- From: Michael Zornek [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 10:50 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Mysql syntax error - phpMyAdmin ?? I was using phpMyAdmin to do an export from one machine to another and on import

RE: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Ryan Jameson (USA)
Try [desc] -Original Message- From: Ryan Jameson (USA) Sent: Wednesday, July 10, 2002 10:51 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Mysql syntax error - phpMyAdmin ?? desc is a key word. :-\ -Original Message- From: Michael Zornek [mailto:[EMAIL PROTECTED]] Sent

Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Chip Atkinson
I can't say for sure, but perhaps desc is a reserved word, short for describe. What happens if you say something like description? Chip On Wed, 10 Jul 2002, Michael Zornek wrote: I was using phpMyAdmin to do an export from one machine to another and on import I got an error: Error

Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Martin Clifford
DESC is a reserved word in SQL, standing for Descending Order. That is why you can't use it as a table column name. HTH Martin Michael Zornek [EMAIL PROTECTED] 07/10/02 12:49PM I was using phpMyAdmin to do an export from one machine to another and on import I got an error: Error

RE: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Ryan Jameson (USA)
Sorry, [desc] won't work either. :-( -Original Message- From: Chip Atkinson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 10:54 AM To: Michael Zornek Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Mysql syntax error - phpMyAdmin ?? I can't say for sure, but perhaps desc

Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Jason Wong
On Thursday 11 July 2002 01:00, Ryan Jameson (USA) wrote: Sorry, [desc] won't work either. :-( Try `desc`. But it's best not to use 'desc' at all, it will save you confusion in the long run. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators *

Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Michael Zornek
Twas 7/10/02 12:55 PM, when Martin Clifford [EMAIL PROTECTED] said: DESC is a reserved word in SQL, standing for Descending Order. That is why you can't use it as a table column name. Ok, that makes sence - thanks! Although I find it a bit curious that building the DB in phpMyAdmin let me

Re: [PHP-DB] Mysql syntax error - phpMyAdmin ??

2002-07-10 Thread Gurhan Ozen
: http://www.mysql.com/doc/L/e/Legal_names.html Gurhan - Original Message - From: Michael Zornek [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 10, 2002 1:30 PM Subject: Re: [PHP-DB] Mysql syntax error - phpMyAdmin ?? Twas 7/10/02 12:55 PM, when Martin Clifford [EMAIL

Re: [PHP-DB] Need syntax for conditional in recordset loop

2001-07-17 Thread Dobromir Velev
Hi, You could use something like #start do { echo tr; $fields=odbc_num_fields($data2); for($i=3 ; $i=$fields ; $i++) echo td nowrap; if (odbc_result($data2,$i) = 'SOX') echo a href='sox_page_url'.odbc_result($data2,$i)./a; else echo odbc_result($data2,$i); echo