LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2011, 05:53 AM   #1
ghpradeep
LQ Newbie
 
Registered: Mar 2011
Posts: 26

Rep: Reputation: 0
PHP Warning: mysql_fetch_row() errror in global address book script.


Hi. I have installed qmail server on redhat. while configuration on global address book with below link:

http://wiki.qmailtoaster.com/index.p...l_Address_Book.

I am getting below error while running sqweb_gabook.sh script.
------------------------------------------------------------------------------------------------------
#Squirrelmail global address book updater...
PHP Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in /etc/qmailfile/sqweb_gabook.php on line 45
Global Address for hometest.com is available at /etc/qmailfile/hometest.com_gabook
Enter the fullpath using Squirrelmail config utility
select 6. Address Books option and configure address book in 3. Global file address book
More info: http://www.squirrelmail.org/docs/adm...n-7.html#ss7.5
-----------------------------------------------------------------------------------

I have pasted sqweb_gabook.php script below:

$domainname="****";
// your domain table name inside vpopmail database
$tablename="***";
$username="****";
$password="******";
$database="****";
$hostname="localhost";
$filename=$domainname."_gabook";
$global_abook="/etc/qmailfile/".$filename;

// process
$handle = fopen($global_abook, 'a');
$conn = mysql_connect($hostname, $username, $password) or die ('Error
connecting to mysql');
mysql_select_db($database);

$query = "select pw_name,pw_gecos from $tablename";
$result = mysql_query($query);

while(list($email,$name) = mysql_fetch_row($result))
{

$data=$email."|".$name."||".$email."@".$domainname."|\n";
fwrite($handle, $data);
}
mysql_close($conn);
fclose($handle);

?>
.

All username and password of mysql are working fine.

Please let me know that changes need to be done.

Br,
pradeep
 
Old 09-22-2011, 08:36 AM   #2
resolv_25
Member
 
Registered: Aug 2011
Location: Croatia
Distribution: Debian 7/Ubuntu 14.04
Posts: 57

Rep: Reputation: 9
I think this question shall be on some PHP forum, or programming forum here.

Anyway, such an error is typical either for a unsuccessful connection with a database or a wrong query.
At first glance, this line is wrong:
mysql_select_db($database);

it shall be:
Code:
mysql_select_db($conn, $database);
Also, if you wrap code, everything would be more readable. (on toolbar you have sign # or another one for PHP code).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding squirrel mail global address book ghpradeep Linux - Server 7 04-06-2011 06:15 AM
exchange global address book in kmail newyearsk Linux - Software 0 08-22-2004 04:33 AM
share global address book ythevenot Linux - Software 0 04-21-2004 07:21 AM
Warning: mysql_fetch_row(): ?? huno Linux - General 2 10-25-2002 03:10 PM
mail server w/ global address book stroh78 Linux - General 1 07-07-2001 05:01 PM


All times are GMT -5. The time now is 10:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration