ID returns more from table than the ID...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
orbdrums
Forum Commoner
Posts: 82
Joined: Wed Sep 14, 2011 11:42 pm

ID returns more from table than the ID...

Post by orbdrums »

Hello all,

I have an ID field in a table, let's say it returns 1, but when I use conditional logic to compare, it returns true if the ID is IN the field instead of an exact match. Is there a PHP function that will compare the ID, in this case 1, to ONLY those records in the table that are 1? I am getting 12, 13, 14, etc...

Thanks in advance.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: ID returns more from table than the ID...

Post by Christopher »

I am not clear whether you are talking about PHP (e.g., $ID == 1) or SQL (e.g., SELECT * FROM foo WHERE ID=1). Can you clarify and post some code?
(#10850)
orbdrums
Forum Commoner
Posts: 82
Joined: Wed Sep 14, 2011 11:42 pm

Re: ID returns more from table than the ID...

Post by orbdrums »

$id == `mbr__id'`;

$id = 'member_id;

?

What is the difference?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: ID returns more from table than the ID...

Post by Celauran »

orbdrums wrote:What is the difference?
orbdrums wrote:$id == `mbr__id'`;
Comparison
orbdrums wrote:$id = 'member_id;
Assignment.

Your question still isn't terribly clear.
orbdrums
Forum Commoner
Posts: 82
Joined: Wed Sep 14, 2011 11:42 pm

Re: ID returns more from table than the ID...

Post by orbdrums »

Thanks for explaining the difference between = and ==. That is what I needed! Very much appreciated.
Post Reply