简体   繁体   English

复制字段并向其中添加一些文本

[英]Copying a field and adding some text to it

Hi I am trying to take the gamename field and put it into the customTitle field but add some text around it. 嗨,我正在尝试将gamename字段放到customTitle字段中,但在其周围添加一些文本。 So example is the game name is Balloon Pop in gamename I want Play Balloon Pop Now - FlameGame.net 例如,在游戏名称中,游戏名称是Balloon Pop ,我想立即播放Balloon Pop-FlameGame.net

If you need more Information write comments to this question. 如果您需要更多信息,请对此问题写评论。 Any help is greatly appreciated. 任何帮助是极大的赞赏。

--EDIT-- - 编辑 -

And here is my code 这是我的代码

<?php
if(isset($_POST['title'])) {
    $query = "SELECT * FROM games";
    $result = mysql_query($query) or die ("no query");

    mysql_query("UPDATE games SET gameKeywords=tags");

    $title = array();
    $id = array();
    while($row = mysql_fetch_assoc($result)){
        $title[] = $row['gamename'];
        $id[] = $row['gameid'];
    }
    foreach($title as $Stitle){
        foreach($id as $Sid){
    mysql_query("UPDATE games SET customTitle = 'Play ".$Stitle." Now - FlameGame.net' WHERE gameid LIKE '".$Sid."'");


        }
    }

}
?>

In the db it replaces all of the customTitles to the name of the first game. db它将所有customTitles替换为第一个游戏的名称。

--EDIT-- - 编辑 -

I figured out a mysql command that dose exactly what this program is supposed to do. 我想出了一个mysql命令,该命令正是该程序应该执行的任务。 Here it is: 这里是:

UPDATE games SET customTitle = concat('Play ',gamename,' Now – FlameGame.net');
mysql_query("UPDATE games SET customTitle = 'Play ".$Stitle." Now - FlameGame.net' WHERE gameid LIKE '".$Sid."'");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM