0

我尝试做的只是添加mysql中的变量。

我认为这很简单,但事实并非如此,而且我也没有真正做到。

甚至可以从mysql添加值吗?

我敢肯定,它可能很简单,一如既往,任何指导都值得赞赏。

谢谢

$query = mysql_query("SELECT * FROM users WHERE ID ='$userid'");
$numrows = mysql_num_rows($query);

if($numrows ==1){
$row = mysql_fetch_assoc($query);
  $id = $row['uid'];
  $name = $row['name'];
  $angles = $row['angles'];
  $decimals = $row['decimals'];
  $multiplication = $row['multiplication'];
  $probability = $row['probability'];
      $sequences = $row['sequences'];
  $symmetry = $row['symmetry'];

 }
$sum = $sequences + $symmetry;
    print ("$sum");

解决了这个问题。查询应为 ....WHERE uid ='$userid'");!

4

1 回答 1

0

您还可以通过如下查询由数据库进行计算:

SELECT uid, name, angles, (sequences + symmetry) AS mysum FROM users WHERE ID ='$userid'
于 2012-05-10T09:39:53.610 回答