Can i jump back in script?
Posted: Thu Jan 28, 2010 10:48 am
Hi there, I where wondering can I jump back in script like jump from line "23 to line 3" (hypothetic)?
Why?
I got a code (shown below) That will generate a random number if the admin number is "1". my problem is if the random number is "1" again it needs to either jump back in script or "something else" plz help me on making this work...
Why?
I got a code (shown below) That will generate a random number if the admin number is "1". my problem is if the random number is "1" again it needs to either jump back in script or "something else" plz help me on making this work...
Code: Select all
<?php
include "../login/database.php";
$users =(isset($_GET['users'])) ? (int)$_GET['users'] : false;
if($users !== false)
{
$sql="SELECT * FROM konto WHERE saved_id=$users"; //selecting all from DB "Konto" where saved_id is the same as in the array $id
}
else
{
echo "NO saved_id!"."<br>";
}
$result = mysql_query($sql) or die("Kunde inte lägga till ny text:<br />" . mysql_error());//Skicka info till tabell.
while($row = mysql_fetch_array( $result )) //fetching info from file and putting it in $row
{
$user=$row['user'];
$money=$row['pengar'];
$swordmen=$row['swordmen'];
$admin=$row['admin'];
}
echo $admin ."<br>";
if ($admin = 1)
{
$sqls = "SELECT saved_id FROM konto ";
$results = mysql_query($sqls) or die("Kunde inte lägga till ny text:<br />" . mysql_error());//Skicka info till tabell.
$num_rows = mysql_num_rows($results);
$users = rand(1,$num_rows);
$sql="SELECT * FROM konto WHERE saved_id=$users"; //selecting all from DB "Konto" where saved_id is the same as in the array $id
$result = mysql_query($sql) or die("Kunde inte lägga till ny text:<br />" . mysql_error());//Skicka info till tabell.
while($row = mysql_fetch_array( $result )) //fetching info from file and putting it in $row
{
$user=$row['user'];
$money=$row['pengar'];
$swordmen=$row['swordmen'];
}
}
echo $user ."<br>" .$money ."<br>" .$swordmen ."<br>";?>