Re: [PHP-DB] Re: php-db foreign key

2011-08-10 Thread Karl DeSaulniers
On Aug 9, 2011, at 3:41 PM, Peter Lind wrote: On 9 August 2011 22:38, Chris Stinemetz chrisstinem...@gmail.com wrote: Yes, debug your code and figure out why it's looping twice instead. For instance, try the other query in the mysql console. Thank you! It was the first query. I put a

Re: [PHP-DB] foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 20:31, Chris Stinemetz chrisstinem...@gmail.com wrote: Okay. I am pretty new to mysql so this may seem like a ridiculous question to some people. I am trying to use a LEFT JOIN query, but the results I am finding unusual. For every record occurrence there is for the query,

Re: [PHP-DB] foreign key

2011-08-09 Thread Chris Stinemetz
Is users.user_id unique? yes it is. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 20:49, Chris Stinemetz chrisstinem...@gmail.com wrote: Is users.user_id unique? yes it is. What does your result look like? Hard to say what the problem is without seeing the result. -- hype WWW: plphp.dk / plind.dk LinkedIn: plind BeWelcome/Couchsurfing: Fake51 Twitter:

Re: [PHP-DB] foreign key

2011-08-09 Thread Chris Stinemetz
What does your result look like? Hard to say what the problem is without seeing the result. I am echoing the query and printing the get array just for debugging purposes, but below you can see how it is repeating its' self. Thank you Array ( [id] = Bella Roe 4980 Roe Blvd ) Bella

Re: [PHP-DB] foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 21:23, Chris Stinemetz chrisstinem...@gmail.com wrote: What does your result look like? Hard to say what the problem is without seeing the result. I am echoing the query and printing the get array just for debugging purposes, but below you can see how it is

Re: [PHP-DB] foreign key

2011-08-09 Thread Chris Stinemetz
Okay. I just validated it is not in the left join query, but in my php. I was able to build the correct relations. Does anyone see any think in the php code below that may cause duplicate table rows? Thank you all. ?php //store.php include_once 'includes/connect.php'; include_once

[PHP-DB] Re: php-db foreign key

2011-08-09 Thread Frank Flynn
You already have a foreign key, that is stores.store_by references users.user_id. You might not have declared it (which is OK) but if that is the key you want that is fine. I suspect you are seeing an inadvertent Cartesian product. The way you have written this query you will get one row

[PHP-DB] Re: php-db foreign key

2011-08-09 Thread Chris Stinemetz
On Tue, Aug 9, 2011 at 2:55 PM, Frank Flynn fr...@declan.com wrote: You already have a foreign key, that is stores.store_by references users.user_id. You might not have declared it (which is OK) but if that is the key you want that is fine. I suspect you are seeing an inadvertent Cartesian

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Peter Lind
When I dump the query and run it in console I get the results I want. Not sure what I am doing wrong. Your php code had more than one query running (one inside the other). It's the outer query that runs twice, not the inner one returning double the results -- hype WWW: plphp.dk / plind.dk

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Chris Stinemetz
Your php code had more than one query running (one inside the other). It's the outer query that runs twice, not the inner one returning double the results Thanks Peter, Do you have any suggestions on how to fix this? Thank you, Chris -- PHP Database Mailing List (http://www.php.net/)

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 22:25, Chris Stinemetz chrisstinem...@gmail.com wrote: Your php code had more than one query running (one inside the other). It's the outer query that runs twice, not the inner one returning double the results Thanks Peter, Do you have any suggestions on how to fix this?

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Chris Stinemetz
Yes, debug your code and figure out why it's looping twice instead. For instance, try the other query in the mysql console. Thank you! It was the first query. I put a LIMIT 1 on it and now it is working correctly. I appreciate your help! Thank you, Chris -- PHP Database Mailing List

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 22:38, Chris Stinemetz chrisstinem...@gmail.com wrote: Yes, debug your code and figure out why it's looping twice instead. For instance, try the other query in the mysql console. Thank you! It was the first query. I put a LIMIT 1 on it and now it is working correctly. I

Re: [PHP-DB] Foreign Key Versus Table Index

2008-10-02 Thread Jack van Zanen
I am not up to scratch with innodb, but in oracle you would have a Primary key on both the id fields in the Car and person table and a Foreign key on PersonId linking it to Id in the Person table. IN your select an index on PersonId would be beneficial if the tables get large. Jack 2008/10/2 J

Re: [PHP-DB] Foreign Key Versus Table Index

2008-10-02 Thread Bastien Koert
On Thu, Oct 2, 2008 at 6:50 AM, Jack van Zanen [EMAIL PROTECTED] wrote: I am not up to scratch with innodb, but in oracle you would have a Primary key on both the id fields in the Car and person table and a Foreign key on PersonId linking it to Id in the Person table. IN your select an

RE: [PHP-DB] foreign key problem

2001-01-31 Thread Chris Andrew
ry 2001 01:53 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] foreign key problem hello all! i have a little problem ,hope someone can help me out the problem is : let i have two tables T1 and T2 ,now T1 has following fields cntryid cntryname cntrycode etc. now cntryid is the primary key

RE: [PHP-DB] foreign key problem

2001-01-31 Thread Bob Hall
ation (table), R1, then every R2.F entry must either be a value equal to an R1.P primary key value or be null" Regards, Chris -Original Message- From: Bob Hall [mailto:[EMAIL PROTECTED]] Sent: 31 January 2001 01:53 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] foreign k