-2
    $sql="Select chanceNo From gm_gacha_token1 where token_code='$mytoken'";
    $result=mysql_query($sql);
    $count=mysql_num_rows($result);

Langauge: PHP

What i am trying to achieve is that, i want to get a single value of chanceNo.. How can i get the value and store it to cookie/sesison and display it in next page??

Any idea, what is the next step or next line of codes??

Amazinglykai
  • 95
  • 1
  • 11

2 Answers2

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
}

Page2:

session_start();
$chanceNo = $_SESSION['chanceNo'];
echo $chanceNo;
Gilly
  • 9,212
  • 5
  • 33
  • 36
-2

Try this one...

   $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];
    }
wasim kazi
  • 378
  • 4
  • 13