register_globals must be turned on on your webserver and off on your local server, you are getting the new value for first rec from the GET array registering first_var as a global. Same thing for the PHP_SELF error. So change this you need to get the value of $first_var like $first_var=$_GET['first_var'] and $PHP_SELF should be $_SERVER['PHP_SELF'] its much better to rewrite your code so you dont need the register_globals to be on as it'll cause you a lot of problems! hope this helps Dan -----Original Message----- From: Ahmed Abdelaliem [mailto:ahmed_abdelaliem@hotmail.com] Sent: 03 June 2003 16:21 To: php-db@lists.php.net Subject: problem with undefined variable hi again, i use php/mysql with ISS server on windows xp professional i have a script that works well on the web to view only 50 records per page, but when i use it on my local server i get this error in the page and it views the same 1st 50 records the message in the page is "Notice: Undefined variable: first_rec in c:\inetpub\wwwroot\egycds\newpcgames.php on line 124" and "Notice: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\egycds\newpcgames.php on line 183 " here is the code i am using can anyone help me please? <? @ $db = mysql_connect("localhost"); mysql_select_db("egycds"); $query = "SELECT gameid FROM newpcgames"; $result= mysql_query($query); $num_recs = mysql_num_rows($result); $first_rec = ($first_rec) ? $first_rec : 0; //if rec is passed in, use it, $max_rec = 50; $test_tr = mysql_query("select * from newpcgames order by gameid desc LIMIT $first_rec, $max_rec"); while($record = mysql_fetch_array($test_tr)) { echo " <TR onmouseover=\"this.bgColor='000000'\" onmouseout=\"this.bgColor='475674'\" bgColor=#475674> <TD width=75> <DIV align=center><FONT color=#ffffff>"; echo stripslashes($record['date']) ; echo "</FONT></DIV></TD> <TD width=90> <DIV align=left><FONT color=white>"; echo stripslashes($record['type']) ; echo "</FONT></DIV></TD> <TD><FONT color=#ffffff><strong> <A href=\""; echo stripslashes($record['link']); echo "\" target=_new2>"; echo stripslashes($record['name']); echo "</A> </strong></FONT></TD> <TD width=50> <DIV align=left><FONT color=#ffffff>"; echo stripslashes($record['cds']); echo "</FONT></DIV></TD> <TD width=80> <DIV align=center><FONT color=#ffffff>"; echo stripslashes($record['rate']); echo "</FONT></DIV></TD> <TD width=70> <DIV align=left><FONT color=#ffffff><A href=\""; echo stripslashes($record['downloaderlink']); echo "\">"; echo stripslashes($record['downloader']); echo "</A></FONT></DIV></TD> <TD align=middle vAlign=center width=15><FONT color=#ffffff> </FONT></TD> </TR> "; } echo "</TBODY></TABLE><br><br><br>"; $next = $first_rec+50; $prev_rec=$first_rec-50; $this_rec = $next; //same record number as current, except 1-based if ($this_rec < $num_recs) { echo "<div align=center><font color=orange size=2><strong><a href='$PHP_SELF?first_rec=$next'> <<<< Previuos </a></strong></font>"; }else{ echo "<div align=center>"; } echo "<font color=orange size=2><strong> Showing $this_rec of $num_recs </strong></font></a>"; if ($prev_rec >= 0) //if record is 1, don't show the previous link { echo "<font color=orange size=2><strong><a href='$PHP_SELF?first_rec= $prev_rec'> Next >>>> </a>"; } ?> _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php