Code: Select all
// Load up the PEAR DB class //
$this->mysql = DB::connect(sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE));
echo "hello";Cheers,
- Josh
Moderator: General Moderators
Code: Select all
// Load up the PEAR DB class //
$this->mysql = DB::connect(sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE));
echo "hello";Code: Select all
$dsn = sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE);
echo '<div>connecting to: ', $dsn, "</div>\n";
$this->mysql = DB::connect($dsn);
if (PEAR::isError($this->mysql)) {
echo "<div>an error occured while connection to the database.<pre>\n";
var_dump($this->mysql);
die('</pre></div>');
}
echo "hello";Code: Select all
echo "test";
$dsn = sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE);
$this->mysql = DB::connect($dsn);
if (PEAR::isError($this->mysql))
{
die("MYSQL ERROR: " . $this->mysql->getMessage() . "<br />DEBUG: " . $this->mysql->getDebugInfo());
}
echo "test1";Then feyd's probably right.I don't even see "hello" get printed
Code: Select all
error_reporting(E_ALL); ini_set('display_errors', true);
class_exists('DB') or die('there is no class "DB"');
echo "test";
$dsn = sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE);
$this->mysql = DB::connect($dsn);
if (PEAR::isError($this->mysql))
{
die("MYSQL ERROR: " . $this->mysql->getMessage() . "<br />DEBUG: " . $this->mysql->getDebugInfo());
}
echo "test1";This was my code:[Mon Dec 18 13:25:09 2006] [error] [client 67.180.131.245] File does not exist: /home/coolmail/public_html/404.shtml
[Mon Dec 18 13:25:09 2006] [error] [client 67.180.131.245] File does not exist: /home/coolmail/public_html/favicon.ico
[Mon Dec 18 13:14:57 2006] [error] [client 88.72.15.128] File does not exist: /home/coolmail/public_html/404.shtml
[Mon Dec 18 13:14:57 2006] [error] [client 88.72.15.128] File does not exist: /home/coolmail/public_html/favicon.ico
[Mon Dec 18 13:11:27 2006] [error] [client 67.180.131.245] File does not exist: /home/coolmail/public_html/404.shtml
[Mon Dec 18 13:11:27 2006] [error] [client 67.180.131.245] File does not exist: /home/coolmail/public_html/favicon.ico
Code: Select all
// Load up the PEAR DB class //
error_reporting(E_ALL); ini_set('display_errors', true);
class_exists('DB') or die('there is no class "DB"');
echo "test";
$dsn = sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE);
$this->mysql = DB::connect($dsn);
if (PEAR::isError($this->mysql))
{
die("MYSQL ERROR: " . $this->mysql->getMessage() . "<br />DEBUG: " . $this->mysql->getDebugInfo());
}
echo "test1";Code: Select all
$f = fopen('some/path/to/a/file/to/log.txt', 'at');
if($f)
{
fwrite($f, date('[Y-m-d H] ') . 'some debug info' . PHP_EOL);
fwrite($f, date('[Y-m-d H] ') . 'some more debug info' . PHP_EOL);
fwrite($f, date('[Y-m-d H] ') . 'even more debug info' . PHP_EOL);
}Code: Select all
<?php
$neg = array('off', 0, false, '', null);
$flags = array(
'Register Globals' => 'register_globals',
'Short Tags' => 'short_open_tag',
'Display Errors' => 'display_errors',
'Magic Quotes GPC' => 'magic_quotes_gpc',
'Magic Quotes Runtime' => 'magic_quotes_runtime',
'Magic Quotes Sybase' => 'magic_quotes_sybase',
);
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
foreach ($flags as $n => $v)
{
$flags[$n] = (in_array(strtolower(ini_get($v)), $neg) ? 'Off' : 'On');
}
$cli = (php_sapi_name() == 'cli');
$eol = "\n";
$gle = get_loaded_extensions();
$rows = array();
$le = '';
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
$le .= ' ' . implode(' ', array_slice($gle, $i, $wide)) . $eol;
}
$ec = array(
'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);
$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
if (($t & $v) == $v)
{
$e[] = $n;
$t ^= $v;
}
}
if (ceil(count($ec) / 2) + 1 < count($e))
{
$e2 = array();
foreach ($ec as $n => $v)
{
if (!in_array($n, $e) and $n != 'E_ALL')
{
$e2[] = $n;
}
}
$er = $er . ' ((E_ALL | E_STRICT) ^ ' . implode(' ^ ', $e2) . '))';
}
else
{
$er = $er . ' (' . implode(' | ', $e) . ')';
}
if (!$cli)
{
echo '<html><head><title>quick info</title></head><body><pre>', $eol;
}
echo 'PHP Version: ', $ve, $eol;
echo 'PHP OS: ', $os, $eol;
echo 'Error Reporting: ', $er, $eol;
foreach ($flags as $n => $v)
{
echo $n, ': ', $v, $eol;
}
echo 'Loaded Extensions:', $eol, $le, $eol;
if (!$cli)
{
echo '</pre></body></html>', $eol;
}
?>and it still only prints test and then falls silent?aliasxneo wrote:This was my code:
Code: Select all
// Load up the PEAR DB class // error_reporting(E_ALL); ini_set('display_errors', true); class_exists('DB') or die('there is no class "DB"'); echo "test"; $dsn = sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE); $this->mysql = DB::connect($dsn); if (PEAR::isError($this->mysql)) { die("MYSQL ERROR: " . $this->mysql->getMessage() . "<br />DEBUG: " . $this->mysql->getDebugInfo()); } echo "test1";
Code: Select all
error_reporting(E_ALL); ini_set('display_errors', true);
echo "<div>wrong mysql_connect</div>\n"; flush();
$mysql = mysql_connect('lalala', 'nouser', 'wrongpassword');
echo "<div>mysql_error</div>\n"; flush();
echo "<div>", mysql_error(), "</div>\n"; flush();
echo "<div>mysql_connect</div>\n"; flush();
$mysql = mysql_connect(HOST, USERNAME, PASSWORD) or die(mysql_error());
echo "<div>mysql_select_db</div>\n"; flush();
mysql_select_db(DATABASE, $mysql) or die(mysql_error());
echo "<div>mysql_close</div>\n"; flush();
mysql_close($mysql); unset($mysql);
echo "<div>Done.</div>\n"; flush();
echo "<div>sprintf</div>\n"; flush();
$dsn = sprintf("%s://%s:%s@%s/%s", TYPE, USERNAME, PASSWORD, HOST, DATABASE);
echo "<div>DB::connect</div>\n"; flush();
$mysql = DB::connect($dsn);
echo "<div>DB::isError</div>\n"; flush();
if (DB::isError($mysql)) {
die("MYSQL ERROR: " . $mysql->getMessage() . "<br />DEBUG: " . $mysql->getDebugInfo());
}
echo "<div>Done.</div>\n"; flush();Code: Select all
require_once("includes/system/PEAR/DB.php");