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
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
>
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
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
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
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
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
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,
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
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
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:
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
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
-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
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
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
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
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
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
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
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
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
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
:
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
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
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
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
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
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
- 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=,
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
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
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
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
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
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
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
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
*
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
:
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
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
41 matches
Mail list logo