MemHT Portal is a Free PHP CMS and Blog
It permit the creation and the management online of websites with few and easy steps.
It's completely customizable, expandable and suitable for all needs.
A2Hosting
Moderators: Moderators
Forum RSS feedReply
database: get-num
AuthorText
sayos
Just arrived

Posts: 1
Contributes: 1

Gender: _NEUTRAL_
Online: No
Date: 02/03/2009 12:01
database: get-num
#post18606
This fix an error when you need the num rows with 0 results in the query.

File: inc_database.php

quote

function get_num($query) {
$result = $this->query($query);
if ($result) {
$num = mysql_num_rows($result);
} else {
$num = 0;
}

@mysql_free_result($result);
return $num;
}
Edited: 02/03/2009 12:03
Reason: File: inc_database.php
Delete Edit Quote
 
nelix
Just arrived

Posts: 4
Contributes: 4

Gender: _MALE_
Online: No

Version: 3.9.0 - 4.0.1
Country: Germany
Languages: German Only
Date: 02/03/2009 17:56
Re: database: get-num
#post18613
Google Translate:

Thank you! The post from you has saved my life ...
Had the same mistake since my webhosters MySQL 5.1 has been installed last Friday.
quote
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /srv/www/web170/html/inc/inc_database.php on line 102

That gave me the error message is sent as Hoster:
quote
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 'range=1 AND '87152093176' BETWEEN ip AND fip)' at line 1

Love greetings to everyone here in MemHT Forum.Smile
Delete Edit Quote
 
goffi
Just arrived

Posts: 1
Contributes: 1

Gender: _NEUTRAL_
Online: No
Date: 22/02/2010 11:18
Re: database: get-num
#post23544
I know, this is an old post, but a friend has found the same mysql error. Using the old mysql, every thing is fine but with mysql 5.1 the host give error. The fix in this post is not so good... just 'remove' the message but not fix the cause.

The real problem is inside the query. The word RANGE is reserved and to use it like a column name is needed to use the quote ( ` not ' ). Quick fix : inside inc_ban.php change all "((range" in "((`range`"

Delete Edit Quote
 
Reply
Tags Cloud
Twitter updates...
Help MemHT Portal
Navigator
Users Block
Hi Guest
IP: 38.107.179.232

Username
Password
MemHT Wiki
Language
MemHT Portal is a free software released under the GNU/GPL License by Miltenovik Manojlo