2014-09-03 58 views
-1

*我已經在doctrine中寫入了這樣的插入代碼 $ social = new Entities \ SocialKeyword;

 $social->setEventId($_GET["eventId"]); 
     $social->setHashtag($_GET["hashtag"]); 

     $this->em->persist($social); 
     $this->em->flush(); 

現在我想合併$ _GET [「事件ID」]和$ _GET(包括hashtag)和兩個由septated「 - 」並將其插入到表主要科拉姆。

我這樣寫,但它不工作。

$social->setPrime(CONCAT($_GET["eventId"],'-', $_GET["hashtag"])); 

需要幫助。

+1

這個問題似乎是題外話,因爲OP不具備使用laguage的最小的理解,顯然沒有在網絡上搜索。 – NDM 2014-09-03 11:45:51

回答

4

在PHP連接運算符是( ' '),但你使用('')。 試試這個:

$concate_value = $_GET["eventId"].'-'.$_GET["hashtag"]; 
$social->setPrime($concate_value); 
+0

謝謝,它也工作fine.bcoz都相同。 – 2014-09-03 11:52:57

0

第一個$_GET(hashtag)看起來不對,應該是$_GET["hashtag"]。簡單的用點(.)操作字符串連接

$_GET["eventId"] . '-' . $_GET["hashtag"] 

在你的代碼

$social->setPrime($_GET["eventId"] . '-' . $_GET["hashtag"]); 
+0

謝謝,它對我工作正常 – 2014-09-03 11:52:06