Filtering Records To Be Displayed With PHP Include

25 posts by 4 authors in: Forums > CMS Builder
Last Post: May 18, 2016   (RSS)

By ross - May 5, 2016

Hi Kent

Thanks for posting.

The first thing is you'll need to find the line in "restorative-flow-test.php" where you include the list of classes.

Right before that line, create a variable like this:

$category = "nikka-nadia"; // name of category to load
include("THIS IS WHERE YOUR INCLUDE WOULD BE");

Next, on the page you are including, in this case, online-yoga-classes.php,  go to where you "load records" and add in the following custom "where"

// load records from 'all_classes'list($all_classesRecords, $all_classesMetaData) = getRecords(array(
     'tableName' => 'all_classes',
     'perPage' => '10',
     'loadUploads' => true,
     'allowSearch' => false,
     'where'       => "categories = '". mysql_escape($category) ."'",
));

See how you set $category on the main page and then use it in the include file?

Give that a shot and let me know how you make out.

If you run into anything setting this up, could you post both pages (the main page and the one your are including) as attachments (ie: not just copying and pasting the code into a reply). That will help me read your code.

Let me know any questions or feedback.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Hi Ross,

Thanks for the help!

I seem to still get an error after using your code, not positive I applied it correctly but I think I did. I get the below error -

Notice: Undefined variable: category in /web/sites/greywood/yogamerge.com/includes/nikka-nadia-classes.php on line 17 MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '') ORDER BY dragSortOrder DESC LIMIT 10' at line 3

The include file is now called nikka-nadia-classes.php and is below

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'cmsb/lib/viewer_functions.php';
  $dirsToCheck = array('/web/sites/greywood/yogamerge.com/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records from 'all_classes'
  list($all_classesRecords, $all_classesMetaData) = getRecords(array(
    'tableName'   => 'all_classes',
    'perPage'     => '10',
    'loadUploads' => true,
    'allowSearch' => true,
    'where'       => "categories = '". mysql_escape($category) ."",
  ));

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
</style>


<TITLE></TITLE>
 

<script language="JavaScript">
<!--//BEGIN Script
function new_window(url) {

link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=750,height=675,left=80,top=180");

}
//END Script-->
</script>


</head>



<body font face="Verdana, Arial, Helvetica, sans-serif" size="2" text="#000000" link="#000000">

  

<?php foreach ($all_classesRecords as $record): ?>
               
    
<table width="950" table  cellspacing="5" valign="TOP" nowrap>

<tr align="CENTER" bgcolor="#000000" link="#FFFFFF" vlink="#FFFFFF">

<Td><font color="white" font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Class</b></Td><td width="950" colspan="3"><b><font color="white" font face="Verdana, Arial, Helvetica, sans-serif" size="2"><?php echo htmlencode($record['title']) ?></b></td></a>

<TD><font color="white" font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><?php echo htmlencode($record['download_price']) ?></b></TD></tr>

<tr>

<td rowspan="4" align="CENTER" valign="TOP">

<a href="<?php echo htmlencode($record['preview_link']) ?>"><?php echo $record['thumb']; ?><font face="Verdana, Arial, Helvetica, sans-serif" font size="2" font color="000000" link="#FFFFFF" vlink="#FFFFFF"><B>PREVIEW</B></a><P>
</TD>





</TD></tr>

<tr>

<td  nowrap><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Style: </b><?php echo htmlencode($record['style']) ?></td>

<td  nowrap>

</td>

<td nowrap><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Length: </b><?php echo htmlencode($record['class_length']) ?></td>

<td nowrap> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Media: </b><?php echo htmlencode($record['media']) ?></TD>

</tr>

</TR>

<tr>

<td colspan="3" class="desc" width="400"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Instructor: </b><?php echo htmlencode($record['instructor']) ?></TD>
<TD noWrap><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>HD: </b><?php echo htmlencode($record['format']) ?></TD></TR>

<tr><td width="1100" colspan="3" class="desc"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Level: </b><?php echo htmlencode($record['class_level']) ?> 
                                     <?php echo htmlencode($record['description']) ?><P>

                                      
</td>

<td align="center">

<?php echo $record['add_to_cart']; ?><P>






</tr>

</table>


      
    <?php endforeach ?>

    <?php if (!$all_classesRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>

<br>
<br>




 
 
</body>
</html>

 The main page where the include is used is still restorative-flow-test.php and is below -

<html>
<head>
<link rel="stylesheet" type="text/css" href="http://www.yogamerge.com/bodystyle-new.css">
<style>
h1
{
color:336699;
font-family:Verdana, Arial, Helvetica, sans-serif;
text-align:center;
font-size:18px;
}
#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a {
  margin: 0;
  padding: 0;
  position: relative;
}
#cssmenu:after,
#cssmenu ul:after {
  content: '';
  display: block;
  clear: both;
}
#cssmenu a {
  color: #ffffff;
  display: inline-block;
  font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
  font-size: 13.4px;
  min-width: 35px;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 -1px 0 #333333;
}
#cssmenu ul {
  list-style: none;
}
#cssmenu > ul > li {
  float: left;
}
#cssmenu > ul > li.active a {
  background: #646464 url(images/grad_dark.png) repeat-x left bottom;
  background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(100%, #4a4a4a));
  background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -o-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: linear-gradient(to bottom, #646464 0%, #4a4a4a 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#646464', endColorstr='#4a4a4a', GradientType=0);
  box-shadow: inset 0 0 10px #222222, inset 0 10px 10px #222222;
  -moz-box-shadow: inset 0 0 10px #222222, inset 0 10px 10px #222222;
  -webkit-box-shadow: inset 0 0 10px #222222, inset 0 10px 10px #222222;
  filter: none;
}
#cssmenu > ul > li.active a:hover {
  background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(100%, #4a4a4a));
  background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -o-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 100%);
  background: linear-gradient(to bottom, #646464 0%, #4a4a4a 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#646464', endColorstr='#4a4a4a', GradientType=0);
  filter: none;
}
#cssmenu > ul > li a {
  box-shadow: inset 0 0 0 1px #8a8a8a;
  -moz-box-shadow: inset 0 0 0 1px #8a8a8a;
  -webkit-box-shadow: inset 0 0 0 1px #8a8a8a;
  background: #4a4a4a url(images/grad_dark.png) repeat-x left top;
  background: -moz-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #8a8a8a), color-stop(50%, #707070), color-stop(51%, #626262), color-stop(100%, #787878));
  background: -webkit-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: -o-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: -ms-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  background: linear-gradient(to bottom, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#8a8a8a', endColorstr='#787878', GradientType=0);
  border-bottom: 1px solid #5d5d5d;
  border-top: 1px solid #5d5d5d;
  border-right: 1px solid #5d5d5d;
  line-height: 34px;
  padding: 0 35px;
  filter: none;
}
#cssmenu > ul > li a:hover {
  background: #8a8a8a url(images/grad_dark.png) repeat-x left bottom;
  background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(50%, #4a4a4a), color-stop(51%, #3b3b3b), color-stop(100%, #525252));
  background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: -o-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  background: linear-gradient(to bottom, #646464 0%, #4a4a4a 50%, #3b3b3b 51%, #525252 100%);
  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#8a8a8a', endColorstr='#787878', GradientType=0);
  filter: none;
}
#cssmenu > ul > li:first-child a {
  border-radius: 5px 0 0 5px;
  -moz-border-radius: 5px 0 0 5px;
  -webkit-border-radius: 5px 0 0 5px;
  border-left: 1px solid #5d5d5d;
}
#cssmenu > ul > li:last-child a {
  border-radius: 0 5px 5px 0;
  -moz-border-radius: 0 5px 5px 0;
  -webkit-border-radius: 0 5px 5px 0;
}
#cssmenu .has-sub:hover ul {
  display: block;
}
#cssmenu .has-sub ul {
  display: none;
  position: absolute;
  top: 36px;
  left: -1px;
  min-width: 100%;
  text-align: center;
  /* IE7 */

  *width: 100%;
}
#cssmenu .has-sub ul li {
  text-align: center;
}
#cssmenu .has-sub ul li a {
  border-top: 0 none;
  border-left: 1px solid #5d5d5d;
  display: block;
  line-height: 120%;
  padding: 9px 5px;
  text-align: center;
}
</style>

<TITLE>Streaming Yoga - Online Yoga Video With A Mix Of Restorative & Flow</TITLE>

<META  NAME="Description" CONTENT="Beginner yoga video with a mix of restorative postures and flow movement.">

<META  NAME="Keywords" CONTENT="yoga videos, yoga video, online yoga classes, yoga studio, instruction, streaming yoga, meditation, video poses demonstration, yoga pose, 
yoga styles, experienced yoga teachers, health, community, workshops, downloads, vinyasa flow, anusara, ashtanga, kundalini, iyengar, prenatal, tantra, los angeles, california, 
Upanishads, bhagavad gita, yoga sutras, beginner, intermediate, advanced, pranayama, ayurveda, hatha, therapy, philosophy, wellness, yogi, asana, lessons, stress reduction,
workout, core work, inversions, head stands, hand stands, arm balances">

<meta content='700240980117234' property='fb:app_id'>

<meta property="og:title" content="Streaming Yoga" />
<meta property="og:type" content="article" />
<meta property="og:image" content="http://www.yogamerge.com/video-thumbs/img_nikka-restorative-flow-preview-thumb.jpg" />
<meta property="og:url" content="http://www.yogamerge.com/classpages/nikkanadia/restorative-flow.php" />
<meta property="og:description" content="Online Yoga Video With A Mix Of Restorative & Flow" />

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@yogamerge">
<meta name="twitter:title" content="Streaming Yoga" />
<meta name="twitter:description" content="Online Yoga Video With A Mix Of Restorative & Flow" />
<meta name="twitter:image" content="http://www.yogamerge.com/video-thumbs/img_nikka-restorative-flow-preview-thumb.jpg" />

<link rel="image_src" href="http://www.yogamerge.com/video-thumbs/img_nikka-restorative-flow-preview-thumb.jpg"/>

<link rel="alternate" media="only screen and (max-width: 800px)"
      href="http://m.yogamerge.com/mobile-pages/classpages/nikkanadia/restorative-flow.php" >

<script type="text/javascript">
<!--
if (screen.width <= 800) {
document.location = "http://m.yogamerge.com/mobile-pages/classpages/nikkanadia/restorative-flow.php";
}
//-->
</script>


<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-44365450-1', 'yogamerge.com');
  ga('send', 'pageview');

</script>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>



<script language="JavaScript">
<!--//BEGIN Script
function new_window(url) {

link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=750,height=675,left=80,top=180");

}
//END Script-->
</script>

<link href="/vibracart/vibracartstyle1.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/vibracart/settingsstyle1.js"></script>
<script type="text/javascript" src="/vibracart/sarissa.js"></script>
<script type="text/javascript" src="/vibracart/vibracart.js"></script>

</head>
<text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF">

<!--DO NOT REMOVE THIS TEXT! Template provided by http://www.2file:///Mac%20HardDrive/WebSites/newpagetest2.htmlcreateawebsite.com.  For more free templates go to http://www.2createawebsite.com/build/templates.html-->

  <body>
  <body bgcolor="#FFFFFF" body link="#000000" vlink="#000000" alink="#000000">
    <tr>
      <td width="50%">
        <div align="center">
          <table border="1" width="50%" bgcolor="#FFFFFF" link="#FFFFFF" cellspacing="1" cellpadding="4">
            <tr>        
            <td width="50%" valign="top">
                
                
                <div align="center">
                  <center>

              <table width="800" border="0" cellspacing="0" cellpadding="3" align="center" bgcolor="#FFFFFF">
  <tr valign="top"> 
    <td> 
      <div align="center"> 
        
<?php include("http://www.yogamerge.com/includes/class-instructor-header.html");?>


<table width="950" table  cellspacing="5" valign="TOP" nowrap>

<tr align="CENTER" bgcolor="#000000" link="#FFFFFF">

<Td><font color="white" font face="Verdana, Arial, Helvetica, sans-serif"><b>Nikka's Laid Back Restorative Flow</b></Td></tr>

<tr>

<td rowspan="4" align="CENTER" valign="TOP">

<video id="restorative-flow" width="950" height="534" poster="http://www.yogamerge.com/video-thumbs/img_nikka-restorative-flow-preview-thumb.jpg" preload controls>
<source src="http://d1h6n356rif2ap.cloudfront.net/nikka-restorative-flow-preview.mp4" />
</video></TD>





</TD></tr>

</table>

<table width="950">
<tr>
<td>
<!---Insert Nested Table Here--->
<table width="100" style="margin-left:15" table  cellspacing="5" align="left" valign="TOP" nowrap>

<tr align="CENTER" bgcolor="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF">

<td rowspan="4" align="CENTER" valign="TOP">

<center>
<div class="fb-share-button" data-href="http://www.yogamerge.com/classpages/nikkanadia/restorative-flow.php" data-layout="button_count"></div><br><br><br></div>
<center>
    



</TD></tr>


</table> 

<table width="75" style="margin-right:0" table  cellspacing="5" align="right" valign="TOP" nowrap>

<tr align="CENTER" bgcolor="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF">

<td rowspan="4" align="CENTER" valign="TOP">

<center>
<div align="right"><a href="https://twitter.com/share" class="twitter-share-button" data-via="yogamerge" data-hashtags="yoga">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script><br><br><br></div>
<center>
    
</TD></tr>


</table>
</td>
</tr>
</table>
<table width="950">
<tr>
<td>
<!----Insert Nested Table Here---->
<table width="950" style="margin-left:0" table  cellspacing="5" align="left" valign="TOP" nowrap>

<tr align="Left">

<td  nowrap><font face="Verdana, Arial, Helvetica, sans-serif"><b>Style: </b>Restorative Flow</td>

<td  nowrap>

</td>

<td nowrap><font face="Verdana, Arial, Helvetica, sans-serif"><b>LENGTH: </b>38 MIN.</td>

<td nowrap> <font face="Verdana, Arial, Helvetica, sans-serif"><b>Media: </b>MP4-H264</TD>

</tr>

</TR>

<tr>

<td colspan="3" class="desc" width="400"><font face="Verdana, Arial, Helvetica, sans-serif"><b>Instructor: </b>Nikka Nadia</TD>
<TD noWrap><font face="Verdana, Arial, Helvetica, sans-serif"><B>HD: </B>1920 X 1080</TD></TR>

<tr><td width="1100" colspan="3" class="desc"><font face="Verdana, Arial, Helvetica, sans-serif"><b>Level: </b>Level 1 (Beginner)<A HREF="javascript:new_window('http://www.yogamerge.com/classes/nikkanadia/restorative-flow/restorative-flow-caps.htm')"><b>(Photos)</b></a><P><font color="000000" font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
                                     If you're looking to slow your pace but still keep moving, then Nikka's Laid Back Restorative Flow may just hit
the spot! Many of us may find a true restoative class to be a little too slow paced, this class will offer a nice mix of movement and restorative postures. Nikka will serve up a little flow, twists, stretches and restorative
poses. This sequence is well suited for the beginner student. Needed props include two blocks and a blanket or towel. Poses include Sukhasana (Easy Pose), Marjaiasana (Cat Pose), Bitilasana (Cow Pose), Low Lunge, 
  Paschimottanasana (Seated Forward Fold), Uttana Shishosana (Puppy Pose) and more. As always practice safely. Enjoy!<P>
 
 <b>Note: This class is available as a stream or download via a site subscription. You may also purchase a Monthly Subscription to the Yoga|Merge Roku Channel in order to stream and watch
 on your TV. The class can also be purchased as a Download To Own product by adding it to your shopping cart.</b><P>

                                      
</td>

<td align="center">

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
      <input type="hidden" name="add" value="1">
      <input type="hidden" name="cmd" value="_cart">
      <input type="hidden" name="business" value="info@yogamerge.com">
      <input type="hidden" name="item_name" value="Nikka's Laid Back Restorative Flow">
      <input type="hidden" name="item_number" value="130">
      <input type="hidden" name="amount" value="4.95">
      <input type="hidden" name="currency_code" value="USD">
      <input type="hidden" name="return" value="http://www.yogamerge.com/linklokipnret.php">
<input type="hidden" name="notify_url" value="http://www.yogamerge.com/linklokipn.php">
<input type="hidden" name="cbt" value="Return To YogaMerge For Download Links">
<input type="hidden" name="vibracart_pagelink" value="http://www.yogamerge.com/classpages/nikkanadia/restorative-flow.php">
      <input type="image" src="http://www.yogamerge.com/images/add_to_cart.jpg" style="padding:1px;border:thin solid black;" alt="Add to cart">
      </form>

</tr>

</table>
</td>
</tr>
</table>


<br>
<br>

<H1>Browse More Classes With Nikka Nadia</H1>


<?php $category = "nikka-nadia"; // name of category to load 
      include("http://www.yogamerge.com/includes/nikka-nadia-classes.php");?>

<center>
<div class="fb-comments" data-href="http://www.yogamerge.com/classpages/nikkanadia/restorative-flow.php" data-numposts="5" data-colorscheme="light"></div></center>

<br>

<br>



<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>
 <script type="text/javascript">
 var ejGATracker = _gat._getTracker("UA-44365450-1");
 ejGATracker._setDomainName("none");
 ejGATracker._setAllowLinker(true);
 ejGATracker._trackPageview();
 </script>
 
 <script language="javascript" type="text/javascript">
startcart()
</script> 

</body>
</html>

Hi Ross,

Update:

I changed the code in the where statement, it looked like there might be a typo with this:

'where'       => "categories = '". mysql_escape($category) ."",

I changed it to:

'where'       => "categories = "". mysql_escape($category) ."", 

I no longer get the error, however I get no classes at all displayed via the include statement on restorative-flow-test.php

Thanks much.

By Damon - May 6, 2016

Hi,

It looks like the where statement is missing both of the single quotes.

Copy and paste this as your where statement:

'where'       => "categories = '". mysql_escape($category) ."'",

Let us know if that works for you.

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Thanks Damon,

I now get the following error after making the changes.

Notice: Undefined variable: category in /web/sites/greywood/yogamerge.com/includes/nikka-nadia-classes.php on line 17 No records were found!

Thanks much,

Kent

By gregThomas - May 9, 2016

Hey Kent, 

This error means that PHP can't find the variable $category. This is probably because this line:

$category = "nikka-nadia"; // name of category to load 

isn't currently set in restorative-flow-test.php as it was in your previous post. If you add this to the code base, it should work. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Hi Greg,

Thanks for the response!

I do have that line in the code on restorative-flow-test.php

I have actually tried it two different ways shown below:

Right now it's set as this:

<?php $category = "nikka-nadia"; // name of category to load ?>
       <?php include("http://www.yogamerge.com/includes/nikka-nadia-classes.php");?>

 Before it was set as this:

<?php $category = "nikka-nadia"; // name of category to load 
      include("http://www.yogamerge.com/includes/nikka-nadia-classes.php");?>

I wasn't sure if the category variable should be in the same php statement as the include?

I get the error either way. I attached my current restorative-flow-test.php page to this reply.

Attachments:

restorative-flow-test.php 16K

By gregThomas - May 9, 2016

Hey Kent, 

I think I know what the issue is, if you change these lines:

<?php $category = "nikka-nadia"; // name of category to load ?>
<?php include("http://www.yogamerge.com/includes/nikka-nadia-classes.php");?>

to this:

<?php
  $category = "nikka-nadia"; // name of category to load
  include("includes/nikka-nadia-classes.php");
?>

the code should work. The problems is the current include is using a web request to get the contents of the nikka-nadia-classes.php file, and this doesn't let the file access the current pages variables. 

But if you include the file using includes/nikka-nadia-classes.php then PHP will include the file directly from the server, and the includes/nikka-nadia-classes.php file can access variables from the current file. 

I hope that makes sense! Let me know if you have any questions. 

Cheers

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Hi Greg,

I made your change which makes sense to me, but unfortunately I still get no records displayed. I no longer have the error saying no records found, but there's no records displayed on the page, you can see it using the below link:

http://www.yogamerge.com/classpages/nikkanadia/restorative-flow-test.php

So far it only works when I take it back to displaying all records with no attempt to filter the records with a category.

Thanks for all the help!

Kent