Jump to content

Checking variable for NULL


mike12255

Recommended Posts

So i got a table that grabs id's from the URL because im trying to do a pageination thingy however when you first view the site, you dont have an idea because your just seeing stayner.ca (non actually site) instead of stayner.ca/id=1 so after my get statment im trying to say if its null then var = 1 however its not working and im getting this error:

 

 

 

Notice: Undefined index: id in /home/content/p/p/f/ppffffpp/html/stayner.ca/TEST/index.php on line 172

 

Notice: Undefined index: id in /home/content/p/p/f/ppffffpp/html/stayner.ca/TEST/index.php on line 194

 

Notice: Undefined index: id in /home/content/p/p/f/ppffffpp/html/stayner.ca/TEST/index.php on line 194

 

Notice: Undefined index: id in /home/content/p/p/f/ppffffpp/html/stayner.ca/TEST/index.php on line 194

 

Notice: Undefined index: id in /home/content/p/p/f/ppffffpp/html/stayner.ca/TEST/index.php on line 194

 

Here is my code:

 

<?php include ("connect.php");
ini_set ("display_errors", "1");
error_reporting(E_ALL);

?>

<html>
<script language="JavaScript1.1">
var slideimages=new Array()
var slidelinks=new Array()

function slideshowimages(){
  for (i=0;i<slideshowimages.arguments.length;i++){
  slideimages[i]=new Image()
  slideimages[i].src=slideshowimages.arguments[i]
  }
}

function slideshowlinks(){
  for (i=0;i<slideshowlinks.arguments.length;i++)
  slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(){
  if (!window.winslide||winslide.closed)
    winslide=window.open(slidelinks[whichlink])
  else
    winslide.location=slidelinks[whichlink]
    winslide.focus()
}
</script>
<title>Stayner, The Town Of Friendly People</title>
<meta name="description" content="Stayner, Ontario, Canada,Local Businesses, Town Of Stayner, Events, News, E-Commerces, About Stayner, Questions about Stayner, Adversiting" />
<meta name="keywords" content="Stayner, Businesses, Town Of Stayner, Stayner Business, Business Directory, Stayner Business Information, Stayner Listings, Local Businesses,News, Events, Adveristing, Businesses,Advertising, Stayner, Stayner Business, Local Business Stayner, News, Stayner Advertising" />
<meta name="author" content="Joshua Baker - Stayner.ca" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name= "robots" content="index-2,email_script, nofollow"/>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.style15 {font-size: 9px}
-->
</style>
<head>
<title>Stayner.ca</title>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.style11 {font-size: 14px}
.style5 {font-size: 12px}
.style6 {	font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
body {
background-color: #FFFFFF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style8 {	font-size: 10px;
color: #FFFFFF;
font-weight: bold;
}
#Table_01 .style8 a {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #FFFFFF;
}
.style14 {font-size: 16px}
.style17 {color: #000000}
-->
</style>
</head>
<body onLoad="MM_preloadImages('images/rollover-1_07.gif','images/rollover-1_08.gif','images/rollover-1_09.gif','images/rollover-1_10.gif','images/rollover-1_11.gif','images/rollover-1_12.gif')">
<!-- ImageReady Slices (index-3.psd) -->
<table width="800" height="901" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
	<td colspan="11">
		<img src="images/index-3_01.gif" width="800" height="28" alt=""></td>
  </tr>
<tr>

	<td colspan="2" rowspan="2">
		<img src="images/index-3_02.gif" width="30" height="100" alt=""></td>
	<td colspan="4">
		<img src="images/index-3_03.gif" width="303" height="82" alt=""></td>
	<td colspan="5" rowspan="2">
		<img src="images/index-3_04.gif" width="467" height="100" alt=""></td>
</tr>
<tr>
	<td colspan="4">

		<img src="images/index-3_05.gif" width="303" height="18" alt=""></td>
</tr>
<tr>
	<td colspan="3"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image55','','images/rollover-1_07.gif',1)"><img src="images/index-2_06.gif" alt="" name="Image55" width="133" height="42" border="0"></a></td>
  <td colspan="2"><a href="localbusinesses.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image56','','images/rollover-1_08.gif',1)"><img src="images/index-2_07.gif" alt="" name="Image56" width="134" height="42" border="0"></a></td>
  <td colspan="2"><a href="services.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image57','','images/rollover-1_09.gif',1)"><img src="images/index-2_08.gif" alt="" name="Image57" width="133" height="42" border="0"></a></td>
  <td><a href="buyandsell.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image58','','images/rollover-1_10.gif',1)"><img src="images/index-2_09.gif" alt="" name="Image58" width="133" height="42" border="0"></a></td>
  <td><a href="events.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image59','','images/rollover-1_11.gif',1)"><img src="images/index-2_10.gif" alt="" name="Image59" width="134" height="42" border="0"></a></td>
  <td colspan="2"><a href="contactus.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image60','','images/rollover-1_12.gif',1)"><img src="images/index-2_11.gif" alt="" name="Image60" width="133" height="42" border="0"></a></td>

  </tr>
<tr>
	<td height="190" colspan="6" background="images/index-3_12.gif"><p class="style14"><br>
	  Welcome to Stayner!</p>
	  <p class="style5">We are delighted to offer you lots of information about our town on our web-site!  Our local businesses have teamed up with us to show themselves off to you.  We encourage our residents to shop locally and welcome internet users who want more information, as we show off our best!<br>
    Keep coming back, as we constantly update our <a href="events.html">Events</a> calendar and offer you lots to do in this area.</p></td>

<td height="226" colspan="5" rowspan="4" valign="top" background="images/index-3_13.gif"><br>
  <table width="467" border="0" align="center" cellpadding="5" cellspacing="5">
  <tr>
    <td width="366" bgcolor="#E6E6E6"><div align="left"><strong>Question:</strong></div></td>
    <td width="85" bgcolor="#E6E6E6"><div align="center"><strong>Answered?</strong></div></td>
  </tr>
  <tr><?php
  $page = $_GET['id'];
  
  //if they just entered the website make page equal 1
  if ($page == NULL){
  $page = 1;
  
  }
  $tolimit = 4;
  $showend = $page * $tolimit;
  $showstart =  $showend - 4;
  //Get all Topics (Parentid = 0)
$getthreads="SELECT * FROM forumtutorial_posts WHERE parentid ='0' ORDER BY parentid DESC LIMIT $showstart, $tolimit";
$findamount = mysql_query($getthreads) or die (mysql_error());
$num_rows = mysql_num_rows($findamount);
$pagestoshow = floor($num_rows/$tolimit);

//grab all the content
while($r=mysql_fetch_array($findamount))
{   
//the format is $variable = $r["nameofmysqlcolumn"]; - makes it easier to call later CAUSE IM LAZY!!
$answer=$r["answered"];
$title=$r["title"];
$id=$r["id"];

if ($answer == 0){
$answer = "no";
}else{
$answer = "yes";
}

?>

<td bgcolor="#FFFFFF"><div align="left" class="style17"><a href="index.php?page=<?=$id?>"><?=$title?></a></div></td>
<td bgcolor="#FFFFFF"><div align="center" class="style17"><?=$answer?></div></td> </tr>
<?php
}



for ($i = 1; $i <= $pagestoshow; $i++){
print "<a href= 'index.php?$page=$i> $i </a>";
}   
  
  ?>
    


  <tr>

    <td bgcolor="#FFFFFF">Have a question you would like answered?, <a href="questionform.php">Click Here</a></td>
    <td bgcolor="#FFFFFF"><div align="center">N/A</div></td>
  </tr>
</table>  
  <strong><br>
</strong></td>
  </tr>
<tr>
	<td colspan="6">

		<img src="images/index-3_14.gif" width="333" height="8" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/index-3_15.gif" width="14" height="28" alt=""></td>
	<td colspan="3">
		<a href="contactus.html"><img src="images/index-3_16.gif" alt="" width="122" height="24" border="0"></a></td>
<td colspan="2">
		<img src="images/index-3_17.gif" width="197" height="24" alt=""></td>

</tr>
<tr>
	<td colspan="5">
		<img src="images/index-3_18.gif" width="319" height="4" alt=""></td>
</tr>
<tr>
  <td colspan="6" rowspan="3" valign="top" background="images/index-2_28.gif"><p align="center" class="style5"><span class="style10"><br>
        <strong>Stayner News</strong></span><br>

    <span class="style9 style15">found at http://www.theenterprisebulletin.com</span></p>
<p align="center" class="style5">
        <script type="text/javascript" src="http://app.feed.informer.com/digest3/RVG2HWRNOC.js">
<noscript><a href="http://app.feed.informer.com/digest3/RVG2HWRNOC.html">Click for "The enterprise Bulletin".</a>
Powered by <a href="http://feed.informer.com/">RSS Feed Informer</a></noscript></script>
        <br>
            <br>
            <br>
            <br>
            <br>

        </p></td>
</tr>
<tr>
	<td colspan="4" valign="top"><div align="center">
	  <p><a href="javascript:gotoshow()"><img src="img1.gif" name="slide" border=0></a>
	    
              <script>
<!--
//configure the paths of the images, plus corresponding target links
slideshowimages("/455 X 100 Cards/gifs/studentworkspaintingpsd.gif", "/455 X 100 Cards/gifs/savingscardstudentworkspainting.gif")
slideshowlinks("/student.html","/student.html")

//configure the speed of the slideshow, in miliseconds
var slideshowspeed=3000
var whichlink=0
var whichimage=0

function slideit(){
  if (!document.images)
    return
    document.images.slide.src=slideimages[whichimage].src
    whichlink=whichimage

  if (whichimage<slideimages.length-1)
    whichimage++
  else
    whichimage=0
    setTimeout("slideit()",slideshowspeed)
}
slideit()
//-->
            </script>
      </p>
	  <p align="center"><span class="style14">Local Weather</span></p>

	  <p align="center"><br>
              <script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2.asp?partner=netweather&tStyle=whteYell&logo=0&zipcode=NAM|CA|ON|STAYNER|&lang=eng&size=10&theme=silver&metric=1&target=_self'></script>
              <span class="style11"><strong>Professional listings are now available!</strong></span></p>
	  <blockquote>
            <p align="center" class="style5">To learn more about advertising on Stayner.ca contact us at:</p>
	    <p align="center" class="style5">Cell Phone: (705) 241-6388</p>
	    <p align="center" class="style6"><span class="style11">Have some idea's for the site? Click here to post <br>

        your <a href="index-feedback.html">Feedback</a></span></p>
	    <table width="375" height="218" border="0">
              <tr>
                <td width="204" height="25" bgcolor="#F7F4E9"><strong>Recent Listing:</strong></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">ANGEL HOUSE BED & BREAKFAST</a></div></td>

              </tr>
              <tr>
                <td height="25" bgcolor="#F7F4E9"><div align="center"><a href="/localbusinesses.html">Bryan Davies Photography</a></div></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">Baker Storage </a></div></td>
              </tr>
              <tr>

                <td height="25" bgcolor="#F7F4E9"><div align="center"><a href="/localbusinesses.html">Mountain Vista Veterinary Hospital</a></div></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">R.D. Moving Systems</a></div></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#F7F4E9"><div align="center"><a href="/localbusinesses.html">Student Works Painting </a></div></td>

              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">Uncommon Groundz Cafe</a></div></td>
              </tr>
            </table>
	    <p align="center">Add you business to our <a href="http://www.stayner.ca/Business Directory/" target="_blank">Business Directory</a>.</p>
	    <p align="center">

	  </blockquote>
            </p>
	    <p align="center" class="style6"><br>
                        </p>
	  </blockquote>
	  </div>
    </td>
  <td> </td>
  </tr>

	<td colspan="9" align="center" valign="top"><p> </p>
	  <p align="center"> </p>
      </td>
</tr>
<tr>
	<td height="31" colspan="11" background="images/index-3_24.gif"><div align="center"><span class="style8"><a href="index.html">Home</a> |<a href="localbusinesses.html"> Local Business</a>| <a href="buyandsell.html">Buy and Sell</a> | <a href="services.html">Services</a> | <a href="events.html">Events</a> | <a href="contactus.html">Contact Us</a></span></div></td>

</tr>
<tr>
	<td>
		<img src="images/spacer.gif" width="14" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="16" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="103" height="1" alt=""></td>
	<td>

		<img src="images/spacer.gif" width="3" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="131" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="66" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="67" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="133" height="1" alt=""></td>

	<td>
		<img src="images/spacer.gif" width="134" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="121" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="12" height="1" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
<div align="center"><br>

<script type="text/javascript"><!--
google_ad_client = "pub-4039459301194765";
/* Banner - Stayner.ca - Home Page */
google_ad_slot = "2960757624";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
   <!-- Start of StatCounter Code -->
  <script type="text/javascript">
var sc_project=4371229; 
var sc_invisible=1; 
var sc_partition=55; 
var sc_click_stat=1; 
var sc_security="b029fc02"; 
   </script> 
   
  <script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script>
   <noscript>
     <div class="statcounter"><a title="wordpress com stats plugin" href="http://www.statcounter.com/wordpress.com/" target="_blank"><img class="statcounter"
src="http://c.statcounter.com/4371229/0/b029fc02/1/" alt="wordpress com stats plugin" ></a></div>
   </noscript>
   <!-- End of StatCounter Code -->  
  <script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   </script>

</div>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-6968494-1");
pageTracker._trackPageview();
} catch(err) {}</script> 
</body>
</html>

Link to comment
Share on other sites

well that kind of fixed my problem - thanks. However im not seein the number 1 with a link to index.php?id=1 so i checked in the page source and its there, any ideas. (website is at stayner.ca/TEST/) heres my code:

 

<?php include ("connect.php");
ini_set ("display_errors", "1");
error_reporting(E_ALL);

?>

<html>
<script language="JavaScript1.1">
var slideimages=new Array()
var slidelinks=new Array()

function slideshowimages(){
  for (i=0;i<slideshowimages.arguments.length;i++){
  slideimages[i]=new Image()
  slideimages[i].src=slideshowimages.arguments[i]
  }
}

function slideshowlinks(){
  for (i=0;i<slideshowlinks.arguments.length;i++)
  slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(){
  if (!window.winslide||winslide.closed)
    winslide=window.open(slidelinks[whichlink])
  else
    winslide.location=slidelinks[whichlink]
    winslide.focus()
}
</script>
<title>Stayner, The Town Of Friendly People</title>
<meta name="description" content="Stayner, Ontario, Canada,Local Businesses, Town Of Stayner, Events, News, E-Commerces, About Stayner, Questions about Stayner, Adversiting" />
<meta name="keywords" content="Stayner, Businesses, Town Of Stayner, Stayner Business, Business Directory, Stayner Business Information, Stayner Listings, Local Businesses,News, Events, Adveristing, Businesses,Advertising, Stayner, Stayner Business, Local Business Stayner, News, Stayner Advertising" />
<meta name="author" content="Joshua Baker - Stayner.ca" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name= "robots" content="index-2,email_script, nofollow"/>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.style15 {font-size: 9px}
-->
</style>
<head>
<title>Stayner.ca</title>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.style11 {font-size: 14px}
.style5 {font-size: 12px}
.style6 {	font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
body {
background-color: #FFFFFF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style8 {	font-size: 10px;
color: #FFFFFF;
font-weight: bold;
}
#Table_01 .style8 a {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #FFFFFF;
}
.style14 {font-size: 16px}
.style17 {color: #000000}
-->
</style>
</head>
<body onLoad="MM_preloadImages('images/rollover-1_07.gif','images/rollover-1_08.gif','images/rollover-1_09.gif','images/rollover-1_10.gif','images/rollover-1_11.gif','images/rollover-1_12.gif')">
<!-- ImageReady Slices (index-3.psd) -->
<table width="800" height="901" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
	<td colspan="11">
		<img src="images/index-3_01.gif" width="800" height="28" alt=""></td>
  </tr>
<tr>

	<td colspan="2" rowspan="2">
		<img src="images/index-3_02.gif" width="30" height="100" alt=""></td>
	<td colspan="4">
		<img src="images/index-3_03.gif" width="303" height="82" alt=""></td>
	<td colspan="5" rowspan="2">
		<img src="images/index-3_04.gif" width="467" height="100" alt=""></td>
</tr>
<tr>
	<td colspan="4">

		<img src="images/index-3_05.gif" width="303" height="18" alt=""></td>
</tr>
<tr>
	<td colspan="3"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image55','','images/rollover-1_07.gif',1)"><img src="images/index-2_06.gif" alt="" name="Image55" width="133" height="42" border="0"></a></td>
  <td colspan="2"><a href="localbusinesses.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image56','','images/rollover-1_08.gif',1)"><img src="images/index-2_07.gif" alt="" name="Image56" width="134" height="42" border="0"></a></td>
  <td colspan="2"><a href="services.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image57','','images/rollover-1_09.gif',1)"><img src="images/index-2_08.gif" alt="" name="Image57" width="133" height="42" border="0"></a></td>
  <td><a href="buyandsell.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image58','','images/rollover-1_10.gif',1)"><img src="images/index-2_09.gif" alt="" name="Image58" width="133" height="42" border="0"></a></td>
  <td><a href="events.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image59','','images/rollover-1_11.gif',1)"><img src="images/index-2_10.gif" alt="" name="Image59" width="134" height="42" border="0"></a></td>
  <td colspan="2"><a href="contactus.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image60','','images/rollover-1_12.gif',1)"><img src="images/index-2_11.gif" alt="" name="Image60" width="133" height="42" border="0"></a></td>

  </tr>
<tr>
	<td height="190" colspan="6" background="images/index-3_12.gif"><p class="style14"><br>
	  Welcome to Stayner!</p>
	  <p class="style5">We are delighted to offer you lots of information about our town on our web-site!  Our local businesses have teamed up with us to show themselves off to you.  We encourage our residents to shop locally and welcome internet users who want more information, as we show off our best!<br>
    Keep coming back, as we constantly update our <a href="events.html">Events</a> calendar and offer you lots to do in this area.</p></td>

<td height="226" colspan="5" rowspan="4" valign="top" background="images/index-3_13.gif"><br>
  <table width="467" border="0" align="center" cellpadding="5" cellspacing="5">
  <tr>
    <td width="366" bgcolor="#E6E6E6"><div align="left"><strong>Question:</strong></div></td>
    <td width="85" bgcolor="#E6E6E6"><div align="center"><strong>Answered?</strong></div></td>
  </tr>
  <tr><?php
  if(isset($_GET['id'])) {
  $page = $_GET['id'];
}else{
  $page = 1;
}
  $tolimit = 4;
  $showend = $page * $tolimit;
  $showstart =  $showend - 4;
  //Get all Topics (Parentid = 0)
$getthreads="SELECT * FROM forumtutorial_posts WHERE parentid ='0' ORDER BY parentid DESC LIMIT $showstart, $tolimit";
$findamount = mysql_query($getthreads) or die (mysql_error());
$num_rows = mysql_num_rows($findamount);
$pagestoshow = floor($num_rows/$tolimit);

//grab all the content
while($r=mysql_fetch_array($findamount))
{   
//the format is $variable = $r["nameofmysqlcolumn"]; - makes it easier to call later CAUSE IM LAZY!!
$answer=$r["answered"];
$title=$r["title"];
$id=$r["postid"];

if ($answer == 0){
$answer = "no";
}else{
$answer = "yes";
}

?>

<td bgcolor="#FFFFFF"><div align="left" class="style17"><a href="showquestion.php?page=<?=$id?>"><?=$title?></a></div></td>
<td bgcolor="#FFFFFF"><div align="center" class="style17"><?=$answer?></div></td> </tr>
<?php
}



for ($i = 1; $i <= $pagestoshow; $i++){
print "<a href= 'index.php?$page=$i> $i </a>";
}   

  ?>
    


  <tr>

    <td bgcolor="#FFFFFF">Have a question you would like answered?, <a href="questionform.php">Click Here</a></td>
    <td bgcolor="#FFFFFF"><div align="center">N/A</div></td>
  </tr>
</table>  
  <strong><br>
</strong></td>
  </tr>
<tr>
	<td colspan="6">

		<img src="images/index-3_14.gif" width="333" height="8" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/index-3_15.gif" width="14" height="28" alt=""></td>
	<td colspan="3">
		<a href="contactus.html"><img src="images/index-3_16.gif" alt="" width="122" height="24" border="0"></a></td>
<td colspan="2">
		<img src="images/index-3_17.gif" width="197" height="24" alt=""></td>

</tr>
<tr>
	<td colspan="5">
		<img src="images/index-3_18.gif" width="319" height="4" alt=""></td>
</tr>
<tr>
  <td colspan="6" rowspan="3" valign="top" background="images/index-2_28.gif"><p align="center" class="style5"><span class="style10"><br>
        <strong>Stayner News</strong></span><br>

    <span class="style9 style15">found at http://www.theenterprisebulletin.com</span></p>
<p align="center" class="style5">
        <script type="text/javascript" src="http://app.feed.informer.com/digest3/RVG2HWRNOC.js">
<noscript><a href="http://app.feed.informer.com/digest3/RVG2HWRNOC.html">Click for "The enterprise Bulletin".</a>
Powered by <a href="http://feed.informer.com/">RSS Feed Informer</a></noscript></script>
        <br>
            <br>
            <br>
            <br>
            <br>

        </p></td>
</tr>
<tr>
	<td colspan="4" valign="top"><div align="center">
	  <p><a href="javascript:gotoshow()"><img src="img1.gif" name="slide" border=0></a>
	    
              <script>
<!--
//configure the paths of the images, plus corresponding target links
slideshowimages("/455 X 100 Cards/gifs/studentworkspaintingpsd.gif", "/455 X 100 Cards/gifs/savingscardstudentworkspainting.gif")
slideshowlinks("/student.html","/student.html")

//configure the speed of the slideshow, in miliseconds
var slideshowspeed=3000
var whichlink=0
var whichimage=0

function slideit(){
  if (!document.images)
    return
    document.images.slide.src=slideimages[whichimage].src
    whichlink=whichimage

  if (whichimage<slideimages.length-1)
    whichimage++
  else
    whichimage=0
    setTimeout("slideit()",slideshowspeed)
}
slideit()
//-->
            </script>
      </p>
	  <p align="center"><span class="style14">Local Weather</span></p>

	  <p align="center"><br>
              <script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2.asp?partner=netweather&tStyle=whteYell&logo=0&zipcode=NAM|CA|ON|STAYNER|&lang=eng&size=10&theme=silver&metric=1&target=_self'></script>
              <span class="style11"><strong>Professional listings are now available!</strong></span></p>
	  <blockquote>
            <p align="center" class="style5">To learn more about advertising on Stayner.ca contact us at:</p>
	    <p align="center" class="style5">Cell Phone: (705) 241-6388</p>
	    <p align="center" class="style6"><span class="style11">Have some idea's for the site? Click here to post <br>

        your <a href="index-feedback.html">Feedback</a></span></p>
	    <table width="375" height="218" border="0">
              <tr>
                <td width="204" height="25" bgcolor="#F7F4E9"><strong>Recent Listing:</strong></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">ANGEL HOUSE BED & BREAKFAST</a></div></td>

              </tr>
              <tr>
                <td height="25" bgcolor="#F7F4E9"><div align="center"><a href="/localbusinesses.html">Bryan Davies Photography</a></div></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">Baker Storage </a></div></td>
              </tr>
              <tr>

                <td height="25" bgcolor="#F7F4E9"><div align="center"><a href="/localbusinesses.html">Mountain Vista Veterinary Hospital</a></div></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">R.D. Moving Systems</a></div></td>
              </tr>
              <tr>
                <td height="25" bgcolor="#F7F4E9"><div align="center"><a href="/localbusinesses.html">Student Works Painting </a></div></td>

              </tr>
              <tr>
                <td height="25" bgcolor="#D9D9D9"><div align="center"><a href="/localbusinesses.html">Uncommon Groundz Cafe</a></div></td>
              </tr>
            </table>
	    <p align="center">Add you business to our <a href="http://www.stayner.ca/Business Directory/" target="_blank">Business Directory</a>.</p>
	    <p align="center">

	  </blockquote>
            </p>
	    <p align="center" class="style6"><br>
                        </p>
	  </blockquote>
	  </div>
    </td>
  <td> </td>
  </tr>

	<td colspan="9" align="center" valign="top"><p> </p>
	  <p align="center"> </p>
      </td>
</tr>
<tr>
	<td height="31" colspan="11" background="images/index-3_24.gif"><div align="center"><span class="style8"><a href="index.html">Home</a> |<a href="localbusinesses.html"> Local Business</a>| <a href="buyandsell.html">Buy and Sell</a> | <a href="services.html">Services</a> | <a href="events.html">Events</a> | <a href="contactus.html">Contact Us</a></span></div></td>

</tr>
<tr>
	<td>
		<img src="images/spacer.gif" width="14" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="16" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="103" height="1" alt=""></td>
	<td>

		<img src="images/spacer.gif" width="3" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="131" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="66" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="67" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="133" height="1" alt=""></td>

	<td>
		<img src="images/spacer.gif" width="134" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="121" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="12" height="1" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
<div align="center"><br>

<script type="text/javascript"><!--
google_ad_client = "pub-4039459301194765";
/* Banner - Stayner.ca - Home Page */
google_ad_slot = "2960757624";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
   <!-- Start of StatCounter Code -->
  <script type="text/javascript">
var sc_project=4371229; 
var sc_invisible=1; 
var sc_partition=55; 
var sc_click_stat=1; 
var sc_security="b029fc02"; 
   </script> 
   
  <script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script>
   <noscript>
     <div class="statcounter"><a title="wordpress com stats plugin" href="http://www.statcounter.com/wordpress.com/" target="_blank"><img class="statcounter"
src="http://c.statcounter.com/4371229/0/b029fc02/1/" alt="wordpress com stats plugin" ></a></div>
   </noscript>
   <!-- End of StatCounter Code -->  
  <script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   </script>

</div>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-6968494-1");
pageTracker._trackPageview();
} catch(err) {}</script> 
</body>
</html>

Link to comment
Share on other sites

$getthreads="SELECT * FROM forumtutorial_posts WHERE parentid ='0' ORDER BY parentid DESC LIMIT $showstart, $tolimit";
$findamount = mysql_query($getthreads) or die (mysql_error());
$num_rows = mysql_num_rows($findamount);
$pagestoshow = floor($num_rows/$tolimit);

 

u r calculating pages to show from num rows of a query which has limits...so it will always return maximum 4...

 

during paging u generally have to fire the query twice, once without query to find count and one with count to get data..somethign like this..

 

$getthreads="SELECT * FROM forumtutorial_posts WHERE parentid ='0' ORDER BY parentid DESC LIMIT $showstart, $tolimit";
$findamount = mysql_query($getthreads) or die (mysql_error());

$getthreadcount="SELECT count(*) as cnt FROM forumtutorial_posts WHERE parentid ='0'";
$findamountcount = mysql_query($getthreads) or die (mysql_error());
$row = mysql_fetch_array($findamountcount);
$num_rows = $row['cnt'];
$pagestoshow = floor($num_rows/$tolimit);

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.