Jump to content

ricky spires

Members
  • Posts

    171
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ricky spires's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. hello im having a little trouble getting what i want back from my loop. on my page i have 2 placeholders. each placeholder needs to pull the element id from the db that belong in that placeholder so in the db i have these columns: id = (the placeholder id) number = (the placeholder number) element. = (the element id) for example: place holder 1 has element_id 1 & 2 place holder 2 has element_id 1 & 3 id - number - element_id 1 - 1 - 1 2 - 1 - 2 3 - 2 - 1 4 - 2 - 3 in the places holder if have: //place holder 1 $phNo = "1"; $holder = Placeholders::find_by_phID($phNo); //place holder 2 $phNo = "2"; $holder = Placeholders::find_by_phID($phNo); this is the class code: - I MIGHT BE DOING THIS WRONG public function find_by_phID($phNo=0){ $sql = "SELECT * FROM ".self::$table_name." WHERE number=".$phNo.""; $result_array = self::find_by_sql($sql); return !empty($result_array) ? array_shift($result_array) : false; } THIS IS WHAT I TRIED: inside the placeholder i put a loop: <?php $phNo = "1"; $holder = Placeholders::find_by_phID($phNo); foreach ($holder as $holders){ echo "Elements id = ".$holder->contElements_id."<br />"; } echo "<br/>"; ?> but the retults are all wrong. it comes back with: what placeholder 1 should come back with is just element id 1 & 2 any thoughts thanks rick
  2. hello. great. that seemed to work. the only thing is, i have a new error. i will try a couple of things and if i cant get it working ill come back to you later. thanks bye for now i tried it but no go <?PHP defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_DOMAIN') ? null : define('SITE_DOMAIN', 'http://localhost/djsonrotation'); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); require_once(SITE_ROOT.DS.'djsonrotation/includes/config.php'); require_once(SITE_ROOT.DS."djsonrotation/includes/functions.php"); require_once(SITE_ROOT.DS."djsonrotation/includes/session.php"); require_once(SITE_ROOT.DS."djsonrotation/includes/database.php"); require_once(SITE_ROOT.DS."djsonrotation/includes/user.php"); ?> this is the new error :
  3. hello. thanks for your replies. i just tried this but it didnt work <?PHP defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_DOMAIN') ? null : define('SITE_DOMAIN', 'http://localhost/djsonrotation'); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); require_once(SITE_ROOT.DS.'includes/config.php'); require_once(SITE_ROOT.DS."includes/functions.php"); require_once(SITE_ROOT.DS."includes/session.php"); require_once(SITE_ROOT.DS."includes/database.php"); require_once(SITE_ROOT.DS."includes/user.php"); ?> i got this error:
  4. hello. i want to create an oop website on my localhost but im having trouble getting the initialize file to find my config file. if i point my browser to my local host my index page works fine because it does not need the initialize file at this stage, but if i point my browser to my admin index (http://localhost/djsonrotation/admin/) i get this error the initialize file is basically 1 place that points to lots of different places and mine looks like this: <?PHP defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_DOMAIN') ? null : define('SITE_DOMAIN', 'http://localhost/djsonrotation'); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_DOMAIN.DS.'includes'); defined('CSS_PATH') ? null : define('CSS_PATH', SITE_DOMAIN.DS.'css'); require_once(SITE_DOMAIN.DS.'config.php'); require_once(SITE_DOMAIN.DS."functions.php"); require_once(SITE_DOMAIN.DS."session.php"); require_once(SITE_DOMAIN.DS."database.php"); require_once(SITE_DOMAIN.DS."user.php"); ?> this is the config file its looking for: <?PHP defined('DB_SERVER') ? null : define("DB_SERVER", "localhost"); defined('DB_USER') ? null : define("DB_USER", "admin"); defined('DB_PASS') ? null : define("DB_PASS", "*************"); defined('DB_NAME') ? null : define("DB_NAME", "djsonrotation"); ?> this is how my mamp is set up this is where my file are located on my wwwroot /index.php /includes/initialize.php /includes/config.php /admin/index.php this is the line of code calling the initialize on /admin/index.php require_once("../includes/initialize.php"); thanks rick
×
×
  • 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.