Wrox Programmer Forums
|
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 18th, 2008, 02:53 PM
Registered User
 
Join Date: Sep 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Errors

I've followed every step and I am getting errors when I test my code, after page 88.

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: id

Filename: controllers/welcome.php

Line Number: 13
A Database Error Occurred

Error Number: 1064

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 'AND `status` = 'active' ORDER BY `category_id` asc LIMIT 100' at line 4

SELECT `id`, `name`, `thumbnail`, `category_id` FROM (`products`) WHERE `id` != AND `status` = 'active' ORDER BY `category_id` asc LIMIT 100

I've checked and double check my code and it is all correct.

-Nate
 
Old October 15th, 2008, 04:56 AM
Registered User
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default

In the finished code I am getting a similar error. If I log in with false name and password, I get the error 'Undefined index: userid'. The alternative code (in madmins.php) should be:

function verifyUser($u,$pw){
        $this->db->select('id,username');
        $this->db->where('username',db_clean($u,16));
        $this->db->where('password',($pw));
        $this->db->where('status', 'active');
        $this->db->limit(1);
        $Q = $this->db->get('admins');
        if ($Q->num_rows() > 0)
        {
            $row = $Q->row_array();
            $_SESSION['userid'] = $row['id'];
            $_SESSION['username'] = $row['username'];
        }
        else
        {
            $_SESSION['userid'] = 0;
            $this->session->set_flashdata('error', 'Sorry, your username or password is incorrect!');
        }
    }[u]</u>

The Following User Says Thank You to soreeyes For This Useful Post:
phpcoder101 (November 5th, 2009)
 
Old October 20th, 2008, 10:01 PM
Registered User
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I have the same problem... May be the session was not initialized?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Errors nnrin Classic ASP Databases 2 December 11th, 2007 12:36 PM
Can't get errors to display with <html:errors> michaeldill JSP Basics 0 August 2nd, 2004 01:47 PM
errors alihussein3 Javascript How-To 0 August 29th, 2003 04:58 PM
errors and fixing errors Droopy XML 0 August 26th, 2003 12:47 AM
Errors Errors DB Errors Ljhopkins VS.NET 2002/2003 0 July 15th, 2003 12:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.