By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

how to make this code work?

P: 16
http://localhost/download.php?lt=a&sr=0&sp=9

lt = letter(eg:- a,b)
sr = start
sp = stop
Expand|Select|Wrap|Line Numbers
  1.    <?php
  2.     if(isset($_GET['lt'])){
  3.         $lt = $_GET['lt'];
  4.         if(isset($_GET['sr'])&&isset($_GET['sp'])){
  5.         $sr = $_GET['sr'];
  6.         $sp = $_GET['sp'];
  7.             if(!empty($lt)){
  8.                 if(!empty($sr)&&!empty($sp)&&$sp!=9){
  9.                     if(strlen($lt) == 1){
  10.                         echo '<h2>'.strtoupper($lt).' Games</h2>';
  11.                         $nquery = "SELECT * FROM `games` WHERE `flname` = '".$lt."' OR '".strtoupper($lt)."' ORDER BY `created` ASC LIMIT ".$sr." ".$sp."";
  12.                         if($nquery_result = mysql_query($nquery)){
  13.                             if($nquery_num = mysql_num_rows($nquery_result)){
  14.                                 while($nquery_r = mysql_fetch_assoc($nquery_result)){
  15.                                 $nquery = "SELECT * FROM `games` WHERE `flname` = '".$lt."' OR '".strtoupper($lt)."' ORDER BY `created` ASC LIMIT ".$sr." ".$sp."";
  16.                                 $nquery_result = mysql_query($nquery);
  17.                                 $nquery_r = mysql_fetch_assoc($nquery_result);
  18.                                 echo '<article>';
  19.                                 echo '<a href="game.php?id='.$nquery_r['id'].'"><div id="g_head">'.$nquery_r['name'].'</div></a><br>';
  20.                                 echo '<a href="game.php?id='.$nquery_r['id'].'"><img src="'.$nquery_r['image'].'" alt="'.$nquery_r['alt'].'" width = "150px"></a>';
  21.                                 echo '</article>';                
  22.                                 }
  23.                                 while($sp<$nquery_num){
  24.                                     $sr = $sr + 10; 
  25.                                 }
  26.                             }else{
  27.                                 echo 'Ok2';
  28.                             }
  29.                         }else{
  30.                             echo 'Ok3';    
  31.                         }
  32.                     }
  33.                 }
  34.             }
  35.         }
  36.     }else{
  37.         echo '<h2>Latest Games</h2>';
  38.         $nquery = "SELECT * FROM `games` ORDER BY `created` DESC LIMIT 9";
  39.         if($nquery_run = mysql_query($nquery)){
  40.             while($nquery_result = mysql_fetch_assoc($nquery_run)){
  41.                 echo '<article>';
  42.                 echo '<a href="game.php?id='.$nquery_result['id'].'">'.$nquery_result['name'].'</a><br>';
  43.                 echo '<a href="game.php?id='.$nquery_result['id'].'"><img src="'.$nquery_result['image'].'" alt="'.$nquery_result['alt'].'" width = "150px"/></a><br>';
  44.                 echo '</article>';
  45.             }
  46.         }
  47.     }
  48.     ?>
  49.  
Mar 6 '12 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
What is the code doing and what do you want the code to do instead?
Mar 6 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.