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] re:FOREIGN KEY{ERROR:1005/150}

2009-02-11 Thread chris smith
On Wed, Feb 11, 2009 at 7:36 PM, mrfroasty mrfroa...@gmail.com wrote: Hello, I have been browsing on mysql manual http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html with not much of success.I am trying to put 2 foreign keys(from different external table) on my table,

Re: [PHP-DB] re:FOREIGN KEY{ERROR:1005/150}

2009-02-11 Thread chris smith
This worked for me: CREATE TABLE hotel ( items_no int(16) NOT NULL auto_increment, INDEX (items_no), PRIMARY KEY (items_no) )ENGINE=INNODB; CREATE TABLE pack ( items_no int(16) NOT NULL auto_increment, INDEX

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] Passing key field, id, from form to procedure

2003-07-18 Thread Hutchins, Richard
Doug, One way to handle this is the following: On the page that lists the people, under the edit link, you put something like a href=editscript.php?id=$idEdit/a. When the user clicks that link, the $id will be passed in the URL. In your editscript.php page, inside the form where you're editing

RE: [PHP-DB] Passing key field, id, from form to procedure

2003-07-18 Thread Ryan Marks
Douglas, The form that shows the editable fields has a hidden field named 'DID' having the value of $zid. In your updaterecord procedure, you will have to use the variable $_GET[DID] instead of $zid. You can of course just add one line of code: $zid = $_GET[DID]; to help you out. One other

Re: [PHP-DB] Array key problem

2003-02-25 Thread Jason Wong
On Wednesday 26 February 2003 00:37, Jorge Miguel Fonseca Martins wrote: As this has nothing to do with databases you should post to the php-general list. $test[]=a; $test[]=b; foreach ($test as $key=$value) { if($key == something) echo $key } even though theres no key in the

Re: [PHP-DB] enter key?

2002-01-17 Thread Jason Wong
On Friday 18 January 2002 00:25, James Kupernik wrote: I found the problem in the form and fixed that, but now anytime I want to submit the form by hitting enter, it acts like it's reloading the page. What would be the cause of that? When I click on the submit button the verification and

Re: [PHP-DB] enter key?

2002-01-17 Thread James Kupernik
Sorry about that ?php if ($submit) { if ($person == -) { $error = Please select your name!; } elseif ($magicword != password) { $error = Please enter correct password!; } else { echo bHi $person, here are the catalog requests/b\n;

Re: [PHP-DB] Getting key of row just inserted into mySQL

2001-08-22 Thread Chris Hobbs
mysql_insert_id() Grant Boggs wrote: What's the best way to get the primary key of a row just inserted into a mySQL database? -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster:

RE: [PHP-DB] Getting key of row just inserted into mySQL

2001-08-22 Thread Matthew Loff
This has been covered countless times on the list... :) http://www.php.net/manual/en/function.mysql-insert-id.php -Original Message- From: Grant Boggs [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 22, 2001 7:24 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Getting key of row just

Re: [PHP-DB] Getting key of row just inserted into mySQL

2001-08-22 Thread Grant Boggs
Matthew Loff [EMAIL PROTECTED] wrote in message 002b01c12b64$92e1cc80$0100a8c0@bang">news:002b01c12b64$92e1cc80$0100a8c0@bang... This has been covered countless times on the list... :) http://www.php.net/manual/en/function.mysql-insert-id.php I figured as much. Thanks guys! --

Re: [PHP-DB] Primary Key Value

2001-02-27 Thread Beau Lebens
mysql_insert_id() i *think* also pg_lastiod() or something similar... At 08:57 PM 2/27/01 -0800, Richard S. Crawford wrote: Suppose I put data into a table using an Insert query, and that the table generates a primary key for the data. Is there a way to get at that primary key without running

Re: [PHP-DB] Primary Key Value

2001-02-27 Thread Richard S. Crawford
Perfect! Thanks. At 01:05 PM 2/28/01 +0800, Beau Lebens wrote: mysql_insert_id() i *think* also pg_lastiod() or something similar... At 08:57 PM 2/27/01 -0800, Richard S. Crawford wrote: Suppose I put data into a table using an Insert query, and that the table generates a primary key for the

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