Alright, I have a random thing going on. Works perfectly fine. This is the code:
<?php
include("config.php");
//To change the odds, change the second number in the rand() function.
$rand = floor(rand(0,1));
if($rand == 1)
{
$sql = "SELECT * FROM randomevents WHERE rarity <= '10'";
$result = mysqli_query($cxn, $sql);
while ($row = mysqli_fetch_assoc($result))
{
$event[] = $row['phrase'];
if ($row['type'] == 'gainsp')
{
$rand = rand(200,500);
$sql = "UPDATE members SET starpoints = starpoints+$rand WHERE userid='".$_SESSION['userid']."'";
mysqli_query($cxn, $sql) or die("Query died: updating starpoints");
}
}
//This will pick a random event and show it
$renum = floor(rand(0,count($event)));
$eventdisplay = $event[$renum];
}
?>
In the database, I have the phrases set as:
"You have gained {$rand} starpoints!".
How do you make that variable echo out as the $rand I'm generating on this page?
It just keeps posting as is. When I went the {$rand} to display as the number I'm generating to set their starpoints to.
So I guess how do you hold a variable in the database?
Does anyone understand what I'm asking?
Here as an image to help understand:
[img]http://i370.photobucket.com/albums/oo149/TenaciousMug/databasevariables.png[/img]