Jump to content

Recommended Posts

I have a db called `Drink` and another one called `drink` they are identical to eachother minus many other fields i have added to `Drink` db.

 

both have a field called `Ingredience`

 

DB1 Ingredience list has a <br> after each ingredient where DB2 does not have a <br> after each ingredient

 

so db1 looks like this :

 

1/2 oz vodka<br>1 1/2 oz Southern Comfort® peach liqueur<br>1/2 oz Grand Marnier® orange liqueur<br> fill with pineapple juice<br></p><br>

 

db2 looks like this :

 

1/2 oz vodka 1 1/2 oz Southern Comfort® peach liqueur 1/2 oz Grand Marnier® orange liqueur fill with pineapple juice</p>

 

all ID's mach exactly the same with both databases

 

my question is can i somehow export all the ingredience from DB1 to DB2

 

echo "UPDATING DATABASE .....<br /><br />";

    $sName = db_value("SELECT `ingredients` FROM `drink` ");	
  
$res = db_res("UPDATE `Drink` SET `Ingredients`= REPLACE(`Ingredients`,' ','$sName')");

 

when i tried the code above it looks like it only selected the very first ingredient from DB1 and populated DB2 With exactly the same ingredient through out 10000 entries

i'm new to sql programming and i'm learning as i go along

any help would be appreciated with this problem

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/165364-sql-query-help/
Share on other sites

the problem is that there is 10000 entries so i cant go by id

 

SELECT ingredients FROM drink <------------ this will select all the ingredience from Table 1 starting at ID1 and finishing at ID 10000

 

now how would i update all the ingredience in Table 2 with what was selected in Table 1

 

 

UPDATE Drink SET 'Ingredience' <<--- this does not work.

Link to comment
https://forums.phpfreaks.com/topic/165364-sql-query-help/#findComment-872115
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.