Buy Sell Discuss UK Domain Names at AcornDomains.co.uk Domain Monster Domain Name Registration

Today's Drop Dates are: 19-02-2012 or 26-02-2012   All times are GMT. The time now is 12:39:05 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design > Scripts and Coding
Connect with Facebook

Scripts and Coding PHP, MySQL, scripts

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 28-12-2008, 03:47:45 AM     #1 (permalink)

 
woopwoop's Avatar
 
Join Date: Jan 2007
Posts: 1,586
woopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond repute

php query

I have a table where there are a bunch of fields. I'm trying to extract information for rows with a unique 'code' where subject='subject'. I also need the 'title' field entry from that row.

Here's my query:

$query="select distinct(code), title from tablename where subject='$subject' order by code asc";


Is this correct or can it cause problems that of the 2 variables I'm pulling, I'm specifying 1 as disctinct?
woopwoop is offline  
Old 28-12-2008, 02:34:49 PM     #2 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,507
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

theoretically if you ask the puritans your not supposed to pull more than one column when specifying distinct. As your using orderby the distinct you may wanna alias it and set distinct code as distcode then order by distcode, otherwise some SQLs will order by all the code not just the distinct ones. (there maybe 1000 code lines but only 15 distinct ones).

I personally think if it works then its ll good
__________________
Browse:
Skinner is offline  
Old 28-12-2008, 06:39:35 PM     #3 (permalink)

 
accelerator's Avatar
 
Join Date: Apr 2005
Location: England
Posts: 4,918
accelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond reputeaccelerator has a reputation beyond repute

For php questions I recommend:

PHP Freaks Forums - Index

Rgds
accelerator is online now  
Closed Thread



Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
PHP include in a Smarty Template admin Scripts and Coding 1 13-05-2008 06:37:26 AM
PHP Builder admin Scripts and Coding 1 02-12-2007 08:18:08 AM
PHP help admin Scripts and Coding 0 17-11-2007 03:11:05 PM

75% off Domains at Network Solutions®.


All times are GMT. The time now is 12:39:05 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".