简体   繁体   English

如何使用php自动完成mysql数据库?

[英]How to auto complete mysql database with php?

how do I automatically fill the mysql database query with php code? 如何自动用php代码填充mysql数据库查询?

database as follows: 数据库如下:

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', '',);

become the benchmark (key word) are: scores, so 成为基准(关键词)是:分数,所以

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

etc... 等等...

Any suggestions and pointer to help me I appreciate and many thanks 任何建议和指针,以帮助我,我感谢,非常感谢

Some tutorials You can download from http://dev.mysql.com/doc/ 您可以从http://dev.mysql.com/doc/下载一些教程

This example: 这个例子:

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

and the table: 和表:

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

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

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