小编use*_*756的帖子

用mysql插入随机数

我主要有一个关于mysql的问题。我有以下内容:

mysql_query("INSERT INTO {$game}_ships (location,login_id
         ) values(
    '250','44')");
Run Code Online (Sandbox Code Playgroud)

我想将位置设置为 2 到 300 之间的随机数。

我的表结构包括位置和登录 ID 列,我不需要提及其他列,因为它们是静态的并且不会改变。上面的内容应该使一艘船看起来像是在系统中移动。

location   int(4)
Run Code Online (Sandbox Code Playgroud)

有人能帮忙吗?

php mysql insert

2
推荐指数
1
解决办法
6238
查看次数

在css中嵌入php

我不知道如何问这个,所以我只想说.我有以下内容:

<style type="text/css">
 div.background
   {
   width:300px;
   height:120px;
   background:url(<?php
    echo '<img src="img/ships/ship_'.$user_ship['shipclass'].'_tn.jpg" />'
    ?>) repeat;
   border:2px solid black;
   }
 div.transbox
   {
   width:200px;
   height:100px;
   margin:30px 50px;
   background-color:#ffffff;
   border:1px solid black;
   opacity:0.6;
   filter:alpha(opacity=60); /* For IE8 and earlier */
   }
 div.transbox p
   {
   margin:30px 40px;
   font-weight:bold;
   color:#000000;
   }
 </style>
 </head>

 <body>

 <div class="background">
 <div class="transbox">
 <p>This is some text that is placed in the transparent box.
 This is some text that is placed in the transparent box.
 This is some text that is …
Run Code Online (Sandbox Code Playgroud)

css php

1
推荐指数
1
解决办法
1849
查看次数

如果,否则如果,否则停在elses中间

我有以下代码:

$result = mysql_query("select * from ${db_name}_users limit 1");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) 
{
    if ($player[$ships_killed] == 1) 
        echo "1";
    else if ($player[$ships_killed] == 2) 
        echo "2";
    else if ($player[$ships_killed] == 3) 
        echo "3";
    else if ($player[$ships_killed] == 4) 
        echo "4";
    else if ($player[$ships_killed] == 5) 
        echo "5";
    else if ($player[$ships_killed] =< 10) 
        echo "10";
    else if ($player[$ships_killed] =< 15) 
        echo "15";
    else if ($player[$ships_killed] =< 20) 
        echo "20";
    else 
        echo "Over Range";    
}   
Run Code Online (Sandbox Code Playgroud)

我对less than or equal …

php if-statement

-1
推荐指数
1
解决办法
362
查看次数

标签 统计

php ×3

css ×1

if-statement ×1

insert ×1

mysql ×1