Jump to content

relientjackson

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

relientjackson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Cheers guys for this, much appreciated. I didn't design the original db, although the shops can have a Display Address and a Postal Address, so I assume that's the reason. As a follow up, do you have any recommended reading for designing databases that scale? Cheers Mark
  2. I have 2 tables in MySQL. One is a list of shops, which has a ShopID,ShopName,Phone,DisplayAddressID. Another table is a list of Addresses, with details such as AddressID,AddressLine1,AddressLine2, Suburb, Zip, State etc. I have some php code which gives me the shopid, with a new address to update in the db. Currently to update the address I do the following: $ShopAddrID = mysql_query("SELECT DisplayAddressID FROM shops WHERE ShopID='$shopid'"); $result=mysql_fetch_array($ShopAddrID); $ShopAddrID = $result[0]; mysql_query("UPDATE addresses SET AddressLine1='$AddressLine1',AddressLine2='$AddressLine2',City='$City',Postcode='$Postcode',State='$State'WHERE AddressID='$ShopAddrID'"); 2 questions: 1) If I am pulling only 1 field from a mysql_query, can I reference it easier/simpler? ie. 1 line of code rather than 3. 2) Can I update the address with just one mysql statement? I want the code to be efficient and simple. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.