From: [EMAIL PROTECTED]
Operating system: Linux RedHat 7.1
PHP version: 4.0.6
PHP Bug Type: MySQL related
Bug description: Problems running IMAP and MYSLQ
<?
$usager = 'klashma'; // Username to log on the SQL server
$pwd = 'xx00xx'; // the password
$server = '{192.168.36.2:143}'; // the IMAP server string
$web_courriel = 'klashma.no-ip.com'; // the email for the IMAP logon
(virtual host)
$sql_server_ip = '192.168.36.2'; // the IP of the SQL server.
function openSQL()
{
global $sql_server_ip, $usager, $pwd;
$sqllink = mysql_connect($sql_server_ip,$usager,$pwd);
if (!$sqllink)
{
print 'Access denied';
die();
}
}
function nbTEL()
{
/* the table is only a one colums table (ID) with integers. */
global $usager;
$result = mysql_db_query ($usager,"select id from prop");
$result = mysql_num_rows($result);
return $result;
}
function openIMAP($folder='INBOX')
{
global $usager,$pwd,$server,$web_courriel,$mbox;
$mbox = imap_open ($server . $folder, $usager.'@'.$web_courriel, $pwd) ||
die("Snif...: ".imap_last_error());
}
function nbEmail()
{
global $mbox;
if (($num_msg = imap_num_msg($mbox)) == 0)
{
return(0);
} else {
return $num_msg;
}
}
print 'Opening the IMAP first:<br>';
openIMAP('INBOX');
openSQL();
print nbTel() . '<br>';
print nbEmail() . '<br>';
mysql_close;
imap_close($mbox);
print 'Works great...<br>Now with SQL first:<br>';
openSQL();
openIMAP('INBOX');
print nbTel() . '<br>';
print nbEmail() . '<br>';
print 'Blah, pointer not found :(';
?>
-=-=-= http://klashma.no-ip.com/test.php =-=-=-=- for the script
-=-=-= http://klashma.no-ip.com/php.php =-=-=-=- a good old phpinfo();
--
Edit bug report at: http://bugs.php.net/?id=12031&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]