【问题标题】:How to auto complete mysql database with php?如何用php自动完成mysql数据库?
【发布时间】:2011-05-06 15:17:54
【问题描述】:

如何用php代码自动填充mysql数据库查询?

数据库如下:

CREATE TABLE IF NOT EXISTS `scrore_table` (
  `scores_id` int(11) NOT NULL auto_increment,
  `scores_title` varchar(32) collate utf8_bin NOT NULL default '',
  `scores` varchar(15) collate utf8_bin NOT NULL default '',
  `decimal_place` char(1) collate utf8_bin NOT NULL,
  `value` float(15,8) NOT NULL,
  PRIMARY KEY  (`currency_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ;

INSERT INTO `scrore_table` (`scrore_id`, `scrore_title`, `scores`, `decimal_place`, `value`) VALUES
(1, '', 'GameA0', '',),
(2, '', 'GameA1', '',),
(3, '', 'GameA2', '',),
..............................etc
(15, '', 'GameA15', '',);

成为基准(关键词)的有:分数,所以

IF found 

scores = GameA0 

then insert 

scores_title = Game For Player A0
decimal_place = 2
value = 1.58030000


IF found 

scores = GameA1 

then insert 

scores_title = Game For Player A1
decimal_place = 2
value = 158.030000


IF found 

scores = GameA15 

then insert 

scores_title = Game For Player A15
decimal_place = 2
value = 0.31303000

等等……

任何可以帮助我的建议和指针我都非常感激,非常感谢

【问题讨论】:

  • 您是否正在寻找基于 PHP 代码具有的值运行 MySQL 插入的 PHP 代码?

标签: php mysql autocomplete


【解决方案1】:

部分教程可以从http://dev.mysql.com/doc/下载

这个例子:

if($scores == 'GameA0')
{
$scores_title = 'Game For Player A0';
$value = 1.58030000;
}
elseif($scores == 'Game15')
{
$scores_title = 'Gone ...';
$value = 0.31303000;
}

还有桌子:

mysql_query("UPDATE score_table SET score_title=".$score_title.", value=".$value." where scores=".$scores."";

【讨论】:

    猜你喜欢
    • 2019-09-23
    • 2012-06-07
    • 1970-01-01
    • 1970-01-01
    • 2012-02-11
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    相关资源
    最近更新 更多