$sql="Select chanceNo From gm_gacha_token1 where token_code='$mytoken'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
Langauge:PHP
我想要实现的是,我希望得到一个机会值的值。我怎样才能获得该值并将其存储到cookie / sesison并在下一页显示?
任何想法,下一步或下一行代码是什么?
答案 0 :(得分:1)
Page1:
session_start();
$query = mysql_query("Select chanceNo From gm_gacha_token1 where token_code='$mytoken' LIMIT 1");
if (mysql_num_rows($query) > 0){
$result = mysql_fetch_assoc($query);
$_SESSION['chanceNo'] = $result['chanceNo'];
// done, maybe header('location: page2.php'); ?
} else {
// no result
}
2页:
session_start();
$chanceNo = $_SESSION['chanceNo'];
echo $chanceNo;
答案 1 :(得分:-2)
试试这个...
$sql="Select chanceNo From gm_gacha_token1 where token_code='$mytoken' LIMIT 1";
$result = mysql_query($query) or die (mysql_error());
while($rows = mysql_fetch_assoc($result))
{
echo $rows[chanceNo];
}