Jump to content

[SOLVED] Help: Undefined variable: myPager (newb here)


Chezshire

Recommended Posts

Hello - I'm currently taking classes in PHP (finally and loving it!)

  Currently I'm having the following error trying to do a 'paging class' for a project The error is as follows:

 

Error in file: '/home/classes/jstein11/public_html/x280/x5c.foto_list.php' on line: 30 Error message: Undefined variable: myPager

 

Line #30:

	print '<div align="center">We have a total of ' . $myPager->showTotal() . ' muffins!</div>';

 

Here is the code:

<?php

define('HIDE_PAGE_ERRORS', FALSE); # FALSE = CURRENTLY ENABLING VISIBILITY OF PAGE ERRORS
$PageTitle = 'Gotta Whole Lot of Photographs by Shauntee Willis!';

# SQL statement
$selSQL = "select FotoName, FotoID, Price from tblFotos";

//END CONFIG AREA ---------------------------------------------------------- 

require_once '/home/classes/jstein11/inc_itc280/config_inc.php';

require_once 'include/header_inc.php';
?>
<h3 align="center">x5c.Foto_list.php</a></h3>


<p align="center"> <img height="100px" "src="images/x5_foto.jpg" /><br /><br />This <a href="x5c.foto_list.php">'List'</a>, along with the subsequent <a href="x5c.foto_view.php">'View'</a> pages,<br /> demonstrate a List/View relationship in a <br />web-ication/environment!</p>
<p align="center">This is version 2.0 of x5b_list.php, now called 'x5c_list.php', which incorporates the <em>Pager class</em> to span records over multiple web pages.</p>
<?php

# create connection to MySQL
$myConn = conn();
   
# $myData stores data object in memory
$result = mysql_query($selSQL,$myConn) or die(trigger_error(mysql_error(), E_USER_ERROR));

if (mysql_num_rows($result) > 0)//at least one record!
{//show results
print '<div align="center">We have a total of ' . $myPager->showTotal() . ' muffins!</div>';
   while ($row = mysql_fetch_assoc($result))
   {
         // Changed 'Foto_view.php' to 'x5c.Foto_view.php' to fit my NAV paradyne/convention - i hope thats ok Bill
         echo '<div align="center"><a href="x5c.foto_view.php?id=' . dbOut($row['FotoID']) . '">' . dbOut($row['FotoName']) . '</a>';
         echo ' <i>only</i> <font color="red">$' . dbOut($row['Price'])  . '</font></div>';
    }
    print $myPager->showNav();
}else{//no records
    print "<div align=center>What! No Photos?  There must be a mistake!!</div>";
}
@mysql_free_result($result); # clears resources
@mysql_close($myConn); # close db connection

//Check with Bill - had to change line's path
//   require_once INCLUDE_PATH . 'footer_inc.php';
require_once 'include/footer_inc.php';
?>
[code]

Any help would be greatly appreciated! Thank you!!



Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.