Jump to content
Killersites Forums


New Members
  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Domagoj's Achievements


Newbie (1/14)



  1. Hello im getting this error: Fatal error: Uncaught Error: Call to a member function prepare() on null in D:\wamp\www\shop\app\models\m_categories.php on line 35 here is my code for m_categories.php <?php /* Categories Handles all tasks related to retrieving and displaying categories */ class Categories { private $Database; private $db_table='categories'; function __construct() { global $Database; $this->Database=$Database; } /* Settting/Getting categories from database */ /** * Return an array with category information * * @access public * @param int(optional) * @return array */ public function get_categories($id=NULL) { $data=array(); if($id != NULL) { // get specific category if($stmt=$this->Database->prepare("SELECT id, name FROM" . $this->db_table . " WHERE id=? LIMIT 1")) { $stmt->bind_param("i", $id); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($cat_id,$cat_name); $stmt->fetch(); if($stmt->num_rows > 0) { $data=array('id'=>$cat_id, 'name'=>$cat_name); } $stmt->close(); } } else { // get all categories if($result=$this->Database->query("SELECT * FROM" . $this->db_table . "ORDER BY name")) { if($result->num_rows>0) { while($row=$result->fetch_array()) { $data[]=array('id'=>$row['id'], 'name'=>$row['name']); } } } } return $data; } } ?> and init.php <?php /* INIT Basic configuration settings */ // connect to database $server='localhost'; $user='root'; $pass=''; $db='shop'; $database=new mysqli($server,$user,$pass,$db); // error reporting mysqli_report(MYSQLI_REPORT_ERROR); ini_set('display_errors', 1); // setup constants define('SITE_NAME', 'Online Store'); define('SITE_PATH','http://shop/'); define('IMAGE_PATH','http://shop/resources/images/'); // include objects include('app/models/m_template.php'); include('app/models/m_categories.php'); // create objects $template= new Template(); $categories= new Categories(); session_start(); and index.php: <?php include('app/init.php'); echo "<pre>"; print_r($categories->get_categories(3)); echo "</pre>"; /*$template->set_data('header','hello'); $template->set_alert('alert!'); $template->load('app/views/v_public_home.php', 'Welcome!');*/ ?> Thank you in advance.
  2. Domagoj


    Sorry for late reply, I didn't manage to resolve this. I've took a break cause no one seemed to reply and I simply could not work it out and I took another course. Would love to finish this one though.
  3. Domagoj


    Hello, i know that iwd tutorials are few years old but im going through them now and in build cms tutorial i can't get colorbox to work. When i press login nothing happens. <link rel="stylesheet" type="text/css" href="<?php echo APP_RESOURCES;?>css/fp_style.css" media="screen"/> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript">$.noConflict();</script> <script type="text/javascript" src="<?php echo APP_RESOURCES;?>javascript/colorbox/colorbox.js"></script> <link rel="stylesheet" type="text/css" href="<?php echo APP_RESOURCES;?>javascript/colorbox/colorbox.css" media="screen"/> <script type="text/javascript"> jQuery(document).ready(function($){ $.colorbox({ transition:'fade', initialWidth:'50px', initialHeight:'50px', scrolling:false, opacity:.6, href:'<?php echo SITE_PATH; ?>app/login.php' }); }); </script> I don't get any errors just redirected to http://localhost/CMS/?Login
  4. Hi, im new to the forum and have issue with my login application. After I enter valid username and password and click submit i get redirected to login.php instead of members.php and get the following screen. What can I do?
  • Create New...