problem with undefined variable

From: Date: Tue, 03 Jun 2003 15:21:20 +0000
Subject: problem with undefined variable
Groups: php.db 
Request: Send a blank email to php-db+get-28260@lists.php.net to get a copy of this message
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>&nbsp;&nbsp;<A
                               href=\"";
                               echo stripslashes($record['link']);
                               echo "\" target=_new2>";
                               echo stripslashes($record['name']);
                               echo "</A>&nbsp;&nbsp;</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>&nbsp;</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>&nbsp; &nbsp; Showing $this_rec of $num_recs &nbsp; &nbsp; </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

« previous php.db (#28260) next »