NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP & MYSQL Problem (Should be simple) Help Needed

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 10-29-2009, 04:06 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
BuLLDoG's Avatar
Join Date: Aug 2003
Location: England
Posts: 934
BuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of light
 



Help! PHP & MYSQL Problem (Should be simple) Help Needed


Hi everyone,

I have two tables I want to access data from:

$tbl_name = itp
$tbl_name2 = s_contact

I have a query like this:

PHP Code:
$query "SELECT * ".
 
"FROM $tbl_name$tbl_name2 ".
    
"WHERE $tbl_name.position = $tbl_name2.pos ".
    
"AND $tbl_name2.username =".
    
" '".
    
"$usern".
????: NamePros.com http://www.namepros.com/programming/619866-php-mysql-problem-should-simple-help.html
    
"'" 
This query works perfectly, but I want to improvise on this query and include a NOT LIKE statement.

So for example, in the s_contact I have a field called 'completed_itp' it includes row ids for example it looks like this:

35, 12, 2, 5

I want my query now to include a statement to say don't bring back itp.id if they are included in the s_contact.completed_itp.

Hope you understand what I mean.

Thanks in advance, any help on this would be greatly appreciared
__________________
Free iPhone | Free Facebook Likes
BuLLDoG is offline   Reply With Quote
Old 10-29-2009, 04:40 PM   #2 (permalink)
Tech Support
Join Date: Mar 2005
Posts: 4,944
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
PHP Code:
$query "
    SELECT * FROM 
$tbl_name$tbl_name2
????: NamePros.com http://www.namepros.com/showthread.php?t=619866
    WHERE 
$tbl_name.position = $tbl_name2.pos 
        AND 
$tbl_name2.username = '$usern'
        AND 
$tbl_name2.completed_itp NOT IN(35,12,2,5)
"

http://dev.mysql.com/doc/refman/5.0/...unction_not-in
Eric is offline   Reply With Quote
Old 10-29-2009, 04:45 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
BuLLDoG's Avatar
Join Date: Aug 2003
Location: England
Posts: 934
BuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of lightBuLLDoG is a glorious beacon of light
 



Hey thanks Eric for your response, but that is typing the NOT IN values in manually. Although, l think you have pointed me into the right direction.

Cheers
__________________
Free iPhone | Free Facebook Likes
BuLLDoG is offline   Reply With Quote
Old 10-30-2009, 05:29 PM   #4 (permalink)
NamePros Regular
 
amoeba's Avatar
Join Date: Sep 2005
Location: ~$
Posts: 656
amoeba is a splendid one to beholdamoeba is a splendid one to beholdamoeba is a splendid one to beholdamoeba is a splendid one to beholdamoeba is a splendid one to beholdamoeba is a splendid one to beholdamoeba is a splendid one to behold
 



Can you post your table structure with some sample data (e.g. query browser screenshot)? I think there might be some confusion about what exactly you're trying to do.
__________________
[ syzygy ] [ free public DNS service ]
amoeba is online now   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:32 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger