Re: Inserting databasecontent within the same form

From: Date: Thu, 27 Sep 2007 01:32:06 +0000
Subject: Re: Inserting databasecontent within the same form
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-44070@lists.php.net to get a copy of this message
> How can I overtake the fieldvalues of city and the first part of the > phonenumber. It should read out the value of the zipfield and check them > with the content of the table "ort". If there is found a recordset with > the same plz the formfields city and the the field "vorwahl" should get > the values of the fields of the recordset. I'm having troubling understanding exactly what you want and I don't have time to decipher all the code in the hope it will tell me. My best guess is you want to use the zipcode from one table, to automatically add the city name into a form from another table. If that is so, you can do it with your query using a join. SELECT Kunden.*, City.name, City.vorwahl FROM Kunden LEFT JOIN City USING (zipcode) This assumes that zipcode exists in both tables and is unique in the "City" table. You should also process the City.name and City.vorwahl results for NULL results where zipcode does not exist in the "City" table. -- Niel Archer

« previous php.db (#44070) next »