Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 30th, 2014, 05:43 AM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error Number: 1064 You have an error in your SQL syntax; check the manual that corre

function getRandomProducts($limit, $skip) {
$data = array();
$temp = array();
if ($limit == 0) {
$limit = 3;
}
$this->db->select("id ,name ,thumbnail ,category_id");
$this->db->where('id !=', $skip);
$this->db->where('status', 'active');
$this->db->order_by("category_id", "asc");
$this->db->limit(100);
$Q = $this->db->get('products');
if ($Q->num_rows() > 0) {
foreach ($Q->result_array() as $row) {
$temp[$row['category_id']] = array(
"id" => $row['id'],
"name" => $row['name'],
"thumbnail" => $row['thumbnail']
);
}
}
shuffle($temp);
if (count($temp)) {
for ($i = 1; $i <= $limit; $i++) {
$data[] = array_shift($temp);
}
}
$Q->free_result();
return $data;
}
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
You have an error in your SQL syntax; check the ma JimZippy BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 December 5th, 2007 12:34 PM
Error in SQL syntax phantom3008 ASP.NET 1.0 and 1.1 Basics 1 April 26th, 2007 08:00 AM
mysql #1064 error manahual MySQL 0 April 23rd, 2007 02:44 PM
1064 error kennymain MySQL 0 July 16th, 2005 04:19 PM
error 1064 SQL syntax puzzle ericwright Beginning PHP 5 April 24th, 2004 10:20 PM



All times are GMT -4. The time now is 08:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.