sidrs Posted July 6, 2010 Report Share Posted July 6, 2010 kurš variants būtu pareizāks? <? if(isset($_GET['darbiba'])) { $id = mt_rand(0,50); $_SESSION["id"] = $id; $query = mysql_query("SELECT kautko FROM tabula WHERE id='".$_SESSION['id']."' LIMIT 1"); .... } ?> vai <? if(isset($_GET['darbiba'])) { $id = mt_rand(0,50); $_SESSION["id"] = $id; $user = trim(mysql_real_escape_string($_SESSION['id'])); $query = mysql_query("SELECT kautko FROM tabula WHERE id='$user' LIMIT 1"); .... } ?> Quote Link to comment Share on other sites More sharing options...
mefisto Posted July 6, 2010 Report Share Posted July 6, 2010 Kaut kā šitā ... nepārbaudīju gan. LOCK TABLES tabula READ; SELECT FLOOR(RAND() * COUNT(*)) INTO @rnd FROM tabula; SELECT kautko FROM tabula LIMIT @rnd, 1; UNLOCK TABLES; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.