The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Security and Performance FAQs
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Jan 06, 2012 4:12 am 
Joomla! Intern
Joomla! Intern

Joined: Wed May 11, 2011 7:31 am
Posts: 82
Warning: Invalid argument supplied for foreach() in /home/globemel/public_html/libraries/joomla/database/database/mysqli.php on line 384


I have started getting this error which is preventing me from updating the database.... can anyone help


Top
 Profile  
 
PostPosted: Mon Jan 23, 2012 9:44 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jan 10, 2012 9:58 am
Posts: 11
FDigital01 wrote:
Warning: Invalid argument supplied for foreach() in /home/globemel/public_html/libraries/joomla/database/database/mysqli.php on line 384


I have started getting this error which is preventing me from updating the database.... can anyone help


You have not declare database variable to null in table class!
just add your database field name and assign it a null value
for example:
var $name = null;


Top
 Profile  
 
PostPosted: Tue Jan 24, 2012 7:00 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jan 10, 2012 9:58 am
Posts: 11
In view.html.php:
add
global $mainframe; on second line of display function.

in default case:
default:
// Prepare list array
$lists = array();

// Get the user state
$filter_order = $mainframe->getUserStateFromRequest(
$option.'filter_order',
'filter_order', 'published');
$filter_order_Dir = $mainframe->getUserStateFromRequest(
$option.'filter_order_Dir',
'filter_order_Dir', 'ASC');

// Build the list array for use in the layout
$lists['order'] = $filter_order;
$lists['order_Dir'] = $filter_order_Dir;
// Get revues and pagination from the model

// Assign references for the layout to use
$this->assignRef('lists', $lists);

In default.php

add following code instead of: <?php echo JText::_('ID'); ?>
<?php echo JHTML::_('grid.sort', JText::_('ID'), 'id',
$this->lists['order_Dir'],
$this->lists['order'] ); ?>
where JText::_('ID') is the name to display the field.
Id is database field.

At the end, add two hidden fields:
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />

In models:

override function _buildQuery() as:
function _buildQuery()
{
$query = ' SELECT * '
. ' FROM #__hello'
. $this->_buildQueryOrderBy();
return $query;
}
function _buildQueryOrderBy()
{
global $mainframe, $option;
// Array of allowable order fields
$orders = array('id', 'name', 'email', 'gender', 'education', 'city', 'date', 'description', 'publish'); //containt name of fields inwhich u want to order you data

// Get the order field and direction, default order field
// is 'ordering', default direction is ascending
$filter_order = $mainframe->getUserStateFromRequest(
$option.'filter_order', 'filter_order', 'id');

// print_r($filter_order); exit;
$filter_order_Dir = strtoupper(
$mainframe->getUserStateFromRequest(
$option.'filter_order_Dir', 'filter_order_Dir', 'ASC'));

// Validate the order direction, must be ASC or DESC
if ($filter_order_Dir != 'ASC' && $filter_order_Dir != 'DESC')
{
$filter_order_Dir = 'ASC';
}

// If order column is unknown use the default
if (!in_array($filter_order, $orders))
{
// $filter_order = 'ordering';
}
$orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir;

if ($filter_order != 'ordering')
{
//$orderby .= ' , ordering ';
}
// Return the ORDER BY clause
return $orderby;
}


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Fri Jan 27, 2012 2:32 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Nov 03, 2011 4:48 am
Posts: 4
hi...adeelkalyami

i have a same problem with joomla. my site homepage shows:

-Warning: Invalid argument supplied for foreach() in frontpage.php on line 104

-Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in mysql.php on line 344.

i dont have any idea to solved it.

can anyone help me please...

this is urgently..

tq..


Last edited by hafizsyrimo on Fri Jan 27, 2012 8:02 am, edited 2 times in total.

Top
 Profile  
 
PostPosted: Fri Jan 27, 2012 4:50 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jan 10, 2012 9:58 am
Posts: 11
hafizsyrimo wrote:
hi...adeelkalyami

i have a same problem with joomla. my site homepage shows:

-Warning: Invalid argument supplied for foreach() in /opt/lampp/htdocs/components/com_content/models/frontpage.php on line 104

-Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /opt/lampp/htdocs/libraries/joomla/database/database/mysql.php on line 344.

i dont have any idea to solved it.

can anyone help me please...

this is urgently..

tq..


which version of php you are using ???


Top
 Profile  
 
PostPosted: Tue Jan 31, 2012 2:49 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Nov 03, 2011 4:48 am
Posts: 4
i'm using php 5.2.9 on Apache/2.2.11
i'm using joomla 1.5.21


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group