Re: [請益] mssql mysql 執行多筆sql問題

看板PHP作者 ( )時間15年前 (2010/12/30 18:52), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串3/3 (看更多)
我用mysql程式去下 insert into table1 xxxxxx ; insert into table2 xxxxxx 同一行會error 但是如果分行下 insert into table1 xxxxxx ; insert into table2 xxxxxx 這樣是可行的 php內容 $sql=<<< str insert into table1 xxxxxx ; insert into table2 xxxxxx str; 執行之後他會歸成同一行,就error了 要如何解決哩ˊˋ ※ 引述《tkdmaf (皮皮快跑)》之銘言: : ※ 引述《cafedelmar ( )》之銘言: : : 原資料庫是mssql : : 有時同時要insert db時候會這樣下: : : $sql=<<< str : : insert into table1 xxxxxx : : insert into table2 xxxxxx : : str; : : $ressql=odbc_exec($odbcDB,$sql); : : 但是改成mysql就會error : : 請問mysql是否不能同時下多筆sql勒 : : 煩請賜教 : 如果你能自行組成欄位及資料的話,在table相同的情形下是可以如此使用 : $sql = "INSERT INTO `資料表` (欄位) VALUES (值1),(值2),(值3)....."; : 不過如果資料表不同的話就還是分開來寫。 -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.43.104.198

12/31 12:49, , 1F
用多行的 " " 不就得了
12/31 12:49, 1F
文章代碼(AID): #1D76HXxO (PHP)
文章代碼(AID): #1D76HXxO (PHP)