RE: [PHP] Query Results Question

From: Date: Wed, 04 Aug 2004 13:42:17 +0000
Subject: RE: [PHP] Query Results Question
Groups: php.general 
Request: Send a blank email to php-general+get-192702@lists.php.net to get a copy of this message
It should be ` (back-ticks) not single quotes SELECT ID, Vacancy Role, Vacancy Salary, Vacancy Location, Vacancy Type FROM vacancy_details WHERE Publish = 'Yes' But you don't really need the back-ticks! Thijs Ford, Mike [LSS] wrote: > -----Original Message----- > From: Harlequin > To: php-general@lists.php.net > Sent: 04/08/04 01:55 > Subject: [PHP] Query Results Question > > I have the following query which should return just two rows: > > SELECT 'ID', 'Vacancy Role', 'Vacancy Salary', 'Vacancy > Location', > 'Vacancy > Type' > FROM vacancy_details > WHERE Publish = 'Yes' > > As only two rows have Publish set to "Yes". > > yet even if I execute the query through phpMyAdmin I get two rows with > field > headings as field values. > -------------------------- > > I may be wrong, as I don't use mySQL, but shouldn't those be > back-ticks around the column names and not single quotes? With the > quotes, you're just asking the database to return the literal text as > if it were a column value. Back ticks are used to enclose column > names that contain non-alphanumeric characters. > > Cheers! > > Mike > Any suggestions on where I'm going wrong...? I'm pretty sure my query > syntax > is accurate as I've used this type of query many times before and have > even > checked the syntax by using a query window. > > -- > ----------------------------- > Michael Mason > Arras People > www.arraspeople.co.uk > ----------------------------- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#192702) next »