Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
|
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 March 30th, 2014, 04:43 AM
Registered User
 
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;
}





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 07:00 AM
mysql #1064 error manahual MySQL 0 April 23rd, 2007 01:44 PM
1064 error kennymain MySQL 0 July 16th, 2005 03:19 PM
error 1064 SQL syntax puzzle ericwright Beginning PHP 5 April 24th, 2004 09:20 PM





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