$sql="Select chanceNo From gm_gacha_token1 where token_code='$mytoken'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
语言:PHP
我想要实现的是,我想获得一个机会号的值。我怎样才能获得该值并将其存储到 cookie/sesison 并在下一页中显示?
任何想法,下一步或下一行代码是什么?
第 1 页:
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;
试试这个...
$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];
}