PHP - Silencing Fatal Errors In Php 5.6?
Hey y'all. I've inherited a code base written in 5.6 that was at the time pretty bad and has since been abused pretty terribly; for instance, my predecessors decided to add '@'s to silence errors on mysql_* function calls instead of actually fixing things. However, there are no '@'s on the nested require statements that instantiate the same object multiple times inside other files. In production, this somehow works just fine - I get no errors displayed and no errors logged despite having error logging turned on in the php.ini and the fact that it's a freaking fatal error. However, in my docker setup I'm getting errors about declaring the same class twice, and I can't use the system enough to debug it. So I have a thought about how I can get around it locally in my docker container, but that solution can present problems when it comes to keeping track of actual changes versus changes for local development because this project has included every file in git - including the vendor and node_modules directories, as well as compiled files because ... well, reasons. So if I make changes locally to a file that shouldn't matter on the server, it will matter and will probably break things.
TL;DR - is it even possible to suppress fatal errors in PHP? If so, how?
Again, I feel the need to state that the only reason I'm asking is to debug the code I've inherited so I can fix it properly. Edited October 2, 2020 by maxxdSimilar TutorialsI need to detect when a fatal error occurs in a shutdown function to ensure database records do no get hung up by a particular user when a coding modification goes south. error_get_last() is not on the menu with my PHP version 5.1.6. Can anyone suggest an alternative? Thanks How do I display the actual errors in IIS 7.5? If I miss a semicolon, I get: "HTTP Error 500.0 - Internal Server Error" absolutely useless. In prior versions, I could see the line and get to the PHP error. How do I display PHP errors? I've added: set_ini('display_errors', '1'); but it doesn't help. Every time i try to fix this i keep getting this
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'asdasd'@'localhost' (using password: YES)' in /home/u345945996/public_html/includes/db.php:7 Stack trace: #0 /home/u345945996/public_html/includes/db.php(7): PDO->__construct('mysql:host=loca...', 'asdasd', 'nasdas') #1 /home/u345945996/public_html/index.php(3): require_once('/home/u34594599...') #2 {main} thrown in /home/u345945996/public_html/includes/db.php on line 7
Can someone help me fix this???
I am having a problem with my codes. please help. Fatal error: Maximum execution time of 30 seconds exceeded in D:\xampp\htdocs\motoinventory\cake\libs\model\datasources\dbo_source.php on line 1084 this is line: 1084 if (isset($value[$model->alias]) && $value[$model->alias][$model->primaryKey] === $data[$association][$model->hasMany[$association]['foreignKey']]) { Hi there, I get this message on my website when i click the clear cart button or the +- button Fatal error: Call to a member function GetCart() on a non-object in /hermes/web11b/b1267/moo.organicgrowshopcouk/cart.php on line 31 I'd really appreciate any help. thanks, Matt Hi, I'm getting below error in my page http://www.cidirealty.com/NWMLS/mls.php PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in E:\USERS\cidirealty\www\NWMLS\mls.php:54 Stack trace: #0 E:\USERS\cidirealty\www\NWMLS\mls.php(54): SimpleXMLElement->__construct(' Does anyone know what this means and how to solve this? Thank you. hello, on a file upload, I get the error: Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 9920 bytes) in/home/content/38/8848538/html/dynamic-site/start-page/upload-page2.php on line 176 line 176 of my upload-page2.php is: $image=imagecreatefromjpeg($filepath); I dont really get whats going on. Ive set the max uplaod file size before this, which i changed to: $maxFileSize=9999999999999999999999; to make sure it wasn't this but it had no effect. i still get the fatal error. anyone got some ideas? i can post the whole php file if needed but may be a bit long winded HOW TO FIX Fatal error: Uncaught Error: Using $this when not in object context in /testynarkotykowe/libs/timer/index.php:13 Stack trace: #0 /testynarkotykowe/index.php(36): TIMER::getTime('all') #1 /testynarkotykowe/m/pg/index.php(110): PAGE->PAGE(NULL, 'cart') #2 /testynarkotykowe/index.php(28): include_once('/testynarkotyko...') #3 /testynarkotykowe/index.php(115): loadMod('pg') #4 {main} thrown in /testynarkotykowe/libs/timer/index.php on line 13 HOW TO TRACK THE ERROR? http://testynarkotykowe.j13x.pl/index.txt Quote<?php #error_reporting(0); define('PHP','.php'); require_once('_gz/php_speedy'.PHP); define('INX','index'); define('HTML','.html'); error_reporting(E_ALL ^ E_NOTICE); define('N','/'); ini_set('memory_limit','512M'); define('DIR_LIB','libs/'); define('DIR_MOD','m/'); define('DIR_TPL','tpl/'); define('DIR_LNG','lng/'); define('R_TIME',2*1000); define('PTH',''); define('HTTP','http://'); define('RANGE_IMG',5000); define('URL',HTTP.$_SERVER['HTTP_HOST'].N.PTH); define('_URL',HTTP.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); define('TAX_RATE',0.08); /* for drug_tests [!] */ define('DOTPAY_ID',37953); define('POPUP_NW',"'mywindow','width=400,height=200,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')"); define('_E','ENGINE | '); define('_LNG','X lng file in mod'); define('_DB','DB | '); define('H','Hacking Attempt | '); define('_C','COOKIE | '); define('_S','SESSION | '); define('NOREPLY','noreply'); define('WWW','www.'); define('JQ','jquery'); define('SEP',' | '); define('SP','|'); define('URI_SEP',','); define('BULK_URI','?bulk'); define('GUEST','Anonymous'); define('C_EXP',time()+24*3600*30); define('PP',14); define('TH_W',125); define('TH_H',75); define('TH',95); define('COUNTDOWN',7); define('HIDE','st'); define('NL',"\n"); define('DATETIME',date('Y-m-d H:i:s')); define('DATETIME_YESTERDAY',date("Y-m-d",time()-(60*60*24))); define('IMG_W',864); define('IMG_H',720); define('IMG_',70); define('IMG_TH','_th.'); define('IMG_AV','_avatar.'); define('MAIL_STYLE',' style="color:blue;text-decoration:underline"'); define('A4_W',946); define('A4_H',1334); /* 595,842 */ define('LIMIT_SIGNATURE',30); define('LIMIT_UTOPICS',16); define('HASH','#'); define('C_TIP_LIMIT',10); define('C_LIMIT',2);/*COMMENTS*/ define('WRAP0',42); define('WRAP1',370);/*74 x 5*/ define('LIMIT_PREFACE',300); define('hideAFTER',3000); define('ERASE_AFTER_X_DAYS',30); define('NOTIFS_LIMIT',2000); define('__ID','ID non'); define('__D','!digit'); define('__R','record non'); define('LOC','Location: '); define('PER_PG',10); define('PER_PG2',5); define('PER_PG3',25); define('PER_PG4',40); session_start(); define('DATETIME_NO','0000-00-00 00:00:00'); define('AminLENGTH',10); define('fade1',100); define('RANGE',50000); define('TH_PRE','th.'); define('TH_EXT','jpg'); define('USERNAME','0100000');/*OBLIGATORY: "0" on the beginning*/ define('USERNAME_LENGTH',strlen(USERNAME)); define('QMIN_LENGTH',10); define('BALANCE0',"0.00"); define('PIN_ATTEMPTS',5); define('MIN_AMOUNT',100); define('RATE0','0.0000'); function datetime($diff) { $timestamp=time(); $tm=86400*$diff; $tm=$timestamp+$tm; return $tm; } define('DATETIME1',date('Y-m-d H:i:s',datetime(1))); define('LANGUAGE','pl'); define('LNG',LANGUAGE.N); define('LG','_'.LANGUAGE); define('MIN_LENGTH',3); define('CURRENCY','PLN'); /* testy */ define('_DEFAULT_ITEM_CNT',4); define('_PROMO_ITEM_CNT',11); define('_PROMO_'.strtoupper(LANGUAGE).'_PRICE',115); define('_PROMO_'.strtoupper(LANGUAGE).'_BEFORE_PRICE',129); /*define('U_FIELDS','id,p,phone,mail,act_lnk,session,name');*/ define('URL_LENGTH',120); /* to 120 */ define('AUTOSAVE_DRAFT_TIME',60*1000); /* TESTY */ #if(!empty($_GET['uid'])) { if(ctype_digit($_GET['uid'])) { $_SESSION['ref'] = $_GET['uid']; unset($_SESSION['uid']); } header(LOC.URL); exit; }/* or $_SERVER['HTTP_HOST'] == 'www.testynarkotykowe.pl'*/ function loadLib($l) { $pth = DIR_LIB.strtolower($l).N.basename(INX).PHP; if(file_exists($pth)) include_once($pth); else die(_E.'loadLib [ '.$pth.' ]'); } function loadLang($l,$m) { $pth = DIR_LNG.strtolower($l).N.strtolower($m).N.basename(INX).PHP; if(file_exists($pth)) include_once($pth); else die(_E.'loadLang [ '.$pth.' ]'); } loadLib('url'); @URL::sUrl(); #try { $db = new PDO('mysql:host=localhost;dbname=andypsv_cocain','root','',array(PDO::ATTR_PERSISTENT=>true)); } catch(PDOException $e) { die('PDO::Can\'t connect'); } try { $db = new PDO('mysql:host=serwer2056122.home.pl;dbname=32538868_thejokerred','32538868_thejokerred','M98thiuhsnduit@@##^',array(PDO::ATTR_PERSISTENT=>true)); } catch(PDOException $e) { die('PDO::Can\'t connect'); } $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_ASSOC); define('PRFX','drugtests_'); $db->query('SET NAMES utf8'); $db->query('SET CHARACTER SET utf8'); $db->query('SET collation_connection = utf8_general_ci'); header('content-type:text/html;charset:utf-8'); $c = $db->query('SELECT * FROM '.PRFX.'cfg'.LG); if($c->rowCount() == 0) die(_E.'X cfg file'); $c = $c->fetch(); foreach($c as $k=>$v) define('PG_'.strtoupper($k),$v); define('PG_TPL',DIR_TPL.PG_TPLX.DIR_MOD); define('C_NAME',PG_T2); loadLib('ip'); loadLib('auth'); loadLib('pages'); loadLib('func'); loadLib('time'); function uQuery($GET) { if(substr($GET,0,USERNAME_LENGTH) == USERNAME) $sql = 'id = "'.substr($GET,USERNAME_LENGTH).'"'; else $sql = 'uri = "'.$GET.'"'; return $sql; } function rtrnLoc() { $LENGTH = strlen(URL); if($_SERVER['HTTP_REFERER'] == URL) return URL; else if(substr($_SERVER['HTTP_REFERER'],0,$LENGTH) == URL) return $_SERVER['HTTP_REFERER']; else return URL; } function arr_short($arr) { $res = array(); foreach($arr as $subArray) foreach($subArray as $k => $v) $res [$k] = $v; return $res; } function loadMod($m) { $pth = DIR_MOD.strtolower($m).N.INX.PHP; if(file_exists($pth)) include_once($pth); else exit(header(LOC.URL,true,301)); } function errLog($err) { global $db; $q = $db->query('INSERT INTO '.PRFX.'err (date,err) VALUES ("'.DATETIME.'","'.$err.'")'); if($q->rowCount() <> 1) die(H.'errLog, fatal failure [not logged error to db]'); else return substr(strstr($err,':'),2); } class PAGE { var $_t,$_k,$_d,$_c,$_nav,$_,$tpl,$u,$md; function PAGE($md='',$md2='',$md3='',$md4='') { global $db,$md; loadLib('timer'); @TIMER::setTimer('all'); require_once(DIR_LIB.DIR_TPL.'class.template'.PHP); $this->tpl = new Template_Lite; $_gTime = TIMER::getTime('all'); $this->tpl->assign('_gTime',$_gTime); $this->tpl->assign('URL',URL); define('TPL',URL.DIR_TPL.PG_TPLX); $this->tpl->assign('TPLx',DIR_TPL.PG_TPLX); $CONSTANS = get_defined_constants(); foreach($CONSTANS as $k => $v) $this->tpl->assign($k,$v); foreach($_POST as $k => $v) if(is_array($_POST[$k])) foreach($_POST[$k] as $k2 => $v2) $_POST[$k][$k2] = htmlspecialchars(trim($v2)); else $_POST[$k] = htmlspecialchars(trim($v)); foreach($_COOKIE as $k => $v) $_COOKIE[$k] = htmlspecialchars(trim($v)); $this->tpl->assign('_GET',$_GET); $this->tpl->assign('_POST',$_POST); $this->tpl->assign('_COOKIE',$_COOKIE); $this->tpl->assign('_SESSION',$_SESSION); $this->tpl->assign('INX',INX); $this->u = isUlogd(str_replace(' ','',PG_T2)); $this->tpl->assign('u',$this->u); $pth = DIR_LNG.LNG.INX.N.INX.PHP; if(file_exists($pth)) { include_once($pth); $lng_index = $_; } else die(_LNG.' [[ index ]]'); $md = strtolower($md.N); $pth = DIR_LNG.LNG.$md.INX.PHP; $this->md = $md; $this->tpl->assign('md',substr($md,0,-1)); if(file_exists($pth)) include_once($pth);/* else die(_LNG);*/ $LNG_all = array_merge($lng_index,$_); $_ = ''; /* HERE IS ISSUE WHEN A FILE IS __INCLUDED <br/> unnecessary, temp-fix: LNG_attached */ if(!empty($md2)) { $md2 = strtolower($md2.N); $pth = DIR_LNG.LNG.$md2.INX.PHP; if(file_exists($pth)) include_once($pth); else die(_LNG.'2: '.$pth); $md2_index = $_; $LNG_all = array_merge($LNG_all,$md2_index); } if(!empty($md3)) { $md3 = strtolower($md3.N); $pth = DIR_LNG.LNG.$md3.INX.PHP; if(file_exists($pth)) include_once($pth); else die(_LNG.'3: '.$pth); $md3_index = $_; $LNG_all = array_merge($LNG_all,$md3_index); } if(!empty($md4)) { $md4 = strtolower($md4.N); $pth = DIR_LNG.LNG.$md4.INX.PHP; if(file_exists($pth)) include_once($pth); else die(_LNG.'4: '.$pth); $md4_index = $_; $LNG_all = array_merge($LNG_all,$md4_index); } $this->_ = $LNG_all; $this->tpl->assign('_',$this->_); $this->tpl->assign('LG',substr(LG,1)); //? $this->tpl->assign('i_drugtests','drug_tests/'); if(ctype_digit(end(explode(',',$_GET[0])))) $this->tpl->assign('col2',1); $q = $db->query('SELECT * FROM '.PRFX.'c0'.LG); if($q->rowCount() == 0) die(_E.'no categories'); while($_c0 = $q->fetch()) $c0[] = $_c0; $this->tpl->assign('c0',$c0); #var_export($_SESSION); die; #session_destroy(); /* CART */ $q = $db->query('SELECT * FROM `'.PRFX.'products'.LG.'`'); if($q->rowCount() == 0) die(_DB.'no records'); while($cart = $q->fetch()) { $cart['t_url'] = _url($cart['t']); $cart['base'] = sprintf('%.2f',$cart['base']); $cart['unit_'] = preg_replace('#[0-9]+\.+[0-9]#i','',$cart['unit']); if(empty($cart['total'])) $cart['total'] = sprintf('%.2f','0'); $cart['t__'] = ucfirst($cart['t_']); $cart['illegal'] = str_replace("\n",'<br />',$cart['illegal']); if(isset($_SESSION['_'.$cart['t_']])) { $cart['amount'] = $_SESSION['_'.$cart['t_']]; // if($cart['unit'] == '0.1g') $cart['amount'] *= 10; $cart['total'] = sprintf('%.2f',$cart['base']*$cart['amount']); $cart['price_table'] = explode(NL,$cart['prices']); #$cart['discount'] = $cart['total']-(CART::getPrice($cart['price_table'],$cart['amount'])/($tax_rate+1)); if(substr($cart['discount'],0,1) == '-') $cart['discount'] = substr($cart['discount'],1); if($cart['unit'] == '0.1g') $cart['amount'] /= 10; } $_cart[] = $cart; } $this->tpl->assign('cart',$_cart); $this->tpl->assign('items_in_cart',array_sum_key($_cart,'amount')); $this->tpl->assign('cart_total',sprintf('%.2f',array_sum_key($_cart,'total'))); $q = $db->query('SELECT * FROM '.PRFX.'promotion WHERE ip = "'.getClientIp().'" LIMIT 1'); if($q->rowCount() == 0) { $db->exec('INSERT INTO '.PRFX.'promotion (ip,time,u) VALUES ("'.getClientIp().'","'.date('m/d/Y h:i A',strtotime(date('m/d/Y h:i A').' + 2 hours 56 minutes')).'","'.$this->u['nick'].'")'); $this->tpl->assign('countdownTime',date('m/d/Y h:i A',strtotime(date('m/d/Y h:i A').' + 2 hours 56 minutes'))); } else { $countdownTime = $q->fetch(); $this->tpl->assign('countdownTime',$countdownTime['time']); } } function run() { global $db; $_ON_LOGGED = $db->query('SELECT COUNT(*) FROM `'.PRFX.'u` WHERE session >= '.(time()-300)); $this->tpl->assign('_ON_LOGGED',$_ON_LOGGED->rowCount()); if(!empty($this->u['id'])) $db->exec('UPDATE `'.PRFX.'u` SET session = "'.time().'" WHERE id = "'.$this->u['id'].'" LIMIT 1'); else $this->u['nick'] = ''; $db->exec('DELETE FROM `'.PRFX.'u_on` WHERE DATE_ADD(time,INTERVAL 3 HOUR) < NOW()'); $q = $db->query('SELECT u FROM `'.PRFX.'u_on` WHERE ip = "'.getClientIp().'" LIMIT 1'); if($q->rowCount() == 1) $db->exec('UPDATE `'.PRFX.'u_on` SET time = NOW(),u = "'.$this->u['nick'].'" WHERE ip = "'.getClientIp().'" LIMIT 1'); else $db->exec('INSERT INTO `'.PRFX.'u_on` VALUES ("'.getClientIp().'",NOW(),"'.$this->u['nick'].'")'); $rlt = $db->query('SELECT COUNT(ip) FROM `'.PRFX.'u_on`'); $this->tpl->assign('_ON',$rlt->rowCount()); /* if(!empty($this->u['id'])) { $q = q('SELECT COUNT(*) AS total FROM (SELECT * FROM '.PRFX.'messages WHERE _to = "'.$this->u['id'].'" AND `read` = "0" GROUP BY _from ORDER BY id DESC) x ORDER BY id DESC LIMIT 1'); $cnt = f($q); $this->tpl->assign('new_messages',$cnt['total']); $q = q('SELECT COUNT(*) as total FROM '.PRFX.'notifications WHERE u_to = "'.$this->u['id'].'" AND `read` = "0" LIMIT 1'); $cnt = f($q); $this->tpl->assign('new_notifs',$cnt['total']); }*/ if(empty($this->_k)) $this->_k = PG_KEYWORDS; if(empty($this->_d)) $this->_d = PG_DESCRIPTION; if(empty($_GET[0])) $t = PG_T_MAIN; else if(empty($this->_t)) $t = ucfirst(PG_T_MAIN); else $t = $this->_t; #.SEP.PG_T; $this->tpl->assign('_t',$t); $this->tpl->assign('_k',$this->_k); $this->tpl->assign('_d',$this->_d); $this->tpl->assign('_nav',$this->_nav); $this->tpl->assign('_c',$this->_c); $this->tpl->display(DIR_TPL.N.PG_TPLX.INX.HTML); } #### function mbl($st=true,$redir=true,$loc='') { #if($this->u['ban'] == 1) die('Account Blocked (BAN)'); foreach($_GET as $k => $v) $uri .= $v.'/'; if($_SERVER['REQUEST_URI'] <> '/login') { if(empty($loc)) $loc = substr(str_replace('|login|','',$uri),0,-1); if(!empty($this->u['id']) AND $_GET[0] == 'login') exit(header(LOC.URL)); if(!$st) { if($this->u['id']) if($redir) exit(header(LOC.URL.$loc)); else return false; } else { if(!$this->u['id']) if($redir) exit(header(LOC.URL.'login'.N.$loc)); else return false; } } } } if(empty($_GET[0]) OR substr($_GET[0],0,1) == '?') loadMod(PG_H_MOD); elseif(is_dir(DIR_MOD.$_GET[0])) loadMod($_GET[0]); else { loadMod(PG_H_MOD); // die(H.'no mod'); } $compressor->finish(); ?>
Hi, I have something like shown below: class Anon { $_dddd = null; ....... public function _construct() { $this->_dddd = DB::getInstance(); } $check = $this->_dddd->get(.......) ....... } class DB { private static $_instance = null; private $_pdo, $_query, $_error = false, $_results, $_count = 0; private function _construct() { try{ $dsn = sprintf( "mysql:host=%s;dbname=%s;", Config::get('mysql/host'), Config::get('mysql/database') ); $this->_pdo = new PDO($dsn, Config::get('mysql/username'), Config::get('mysql/password') ); } catch(PDOException $excp){ die($excp->getMessage()); } } public static function getInstance() { if(!(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }$_dddd is holding a SINGLETON object. When I do above I get following message: Fatal error: Call to a member function get() on a non-object Can anyone point out the mistake(s) in my code and how to rectify it. Will be very grateful. this is my code Code: [Select] <?php require ("s_check_login.php"); include ('database.php'); if(isset($_POST['csv_btn'])){ $str = $_POST['csv']; $date = mysql_real_escape_string($_POST['date']); $gal = mysql_real_escape_string($_POST['gal']); $op = mysql_real_escape_string($_POST['op']); $parts = explode( "\n", $str ); $team = array(); foreach( $parts as $part ) $team[] = str_getcsv($part); unset($parts); $tcount = count($team); for($x=0; $x<$tcount; $x++){ $p = $team[$x]; $sql = "INSERT INTO gbsa_stats (id, Player, Day_Played, Opponent, Gallery_no, Goals, Assists, Shots, On_Goal, Off_Post, Offsides, Saves, Fouls, Shots_Corner, Goals_Corner, Yellow, Red) VALUES ('NULL','$p[1]','$date','$op','$gal','$p[2]','$p[3]','$p[4]','$p[5]','$p[6]','$p[7]','$p[8]','$p[9]','$p[10]','$p[11]','$p[12]','$p[13]')"or die ('Error Updateing Database ' .mysql_error()); if (!mysql_query($sql)){ die('Error : ' .mysql_error()); } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <form id="form1" name="form1" method="post" action=""> <h1>csv data:</h1> <textarea name="csv" cols="100" rows="25" id="csv"></textarea> <br /> <h1>Date:</h1> <input type="text" name="date" id="date" /> <br /> <h1>Opponent:</h1> <input type="text" name="op" id="op" /> <br /> <h1>Gallery Number:</h1> <input type="text" name="gal" id="gal" /> <br /> <h1> </h1> <input type="submit" name="csv_btn" id="csv_btn" value="Submit" /> </form> </body> </html> when i run it on my local machine it works with no problem but when i upload it to my server and try to run it i get this error Code: [Select] Fatal error: Call to undefined function str_getcsv() in /html/admin/stats.php on line 14 Hello, I am trying to run a script on my site , The script is this : https://github.com/simplecoin/simplecoin and I am getting these errors [Sat Aug 13 11:47:01 2011] [error] [client 84.228.254.88 ] PHP Fatal error: Call to a member function fetch() on a non-object in /var/www/includes/stats.php on line 42,[/code] Code: [Select] ] PHP Warning: Invalid argument supplied for foreach() in /var/www/includes/stats.php on line 89 and Code: [Select] ] PHP Warning: Invalid argument supplied for foreach() in /var/www/stats.php on line 75 I run ubuntu 11 vps . Some one told me that [quote]Probably this query is not returning a value, so it gives an error. [code]$sql = "SELECT count(id) FROM shares WHERE id > $lastwinningshare AND our_result='N'";Most likely it will go away as soon as it returns something. [/quote] from the file /includes/stats.php I really need to fix this problem , is there any module i need to install or the code is incorrect ? If you want i can give you a link to php info of my vps . Thanks a lot for the help ! Hi guys and girls, I am trying to create an XML document from an php document and a sql_query but I am getting this fatal error: Fatal error: Call to undefined method DOMComment::createElement() in /content_ro/webdev/htdocs/schools/hhs/psy_bookings/home.php on line 15 <?php include("php/dbconnect.php"); //connects to the database $table_id = 'booking'; $query = "SELECT * FROM $table_id WHERE (booking.bookingDate = curDate()) AND roomID = 1 ORDER BY startTime"; $room1 = mysql_query($query); //create a new DOM document $doc = new DOMComment('1.0'); //create root element $root = $doc->createElement('root'); $root = $doc->appendChild($root); //process one row at at time while($row = mysql_fetch_assoc($room1)){ //add node for each row $occ = $doc->createElement($table_id); $occ = $doc->appendChild($occ); //add achild for each field foreach ($row as $fieldname => $fieldvalue){ $child = $doc->createElement($fieldname); $child = $occ->appendChild($child); $value = $doc->createTextNode($fieldvalue); $value = $child->appendChild($value); } } mysql_free_result($room1); $xml_string = $doc->saveXML(); echo $xml_string; ?> I am following a tutorial on http://www.tonymarston.net/php-mysql/dom.html I have a script which is uploading very large files into blobs (<=800MB). Now i had the max memory size in the php.ini set to 150MB and while uploading it would stop and tell me that that I exhausted all the bytes (157xxxxx can remember the exact figure but im pretty sure it equalled 150MB). Any ways I experimentally set the max memory size to 800MB just to see if that would help and now its telling me Fatal error: Out of memory (allocated 524288) (tried to allocate 804524032 bytes)? What is the meaning of this and how can one rectify the issue? Any info would be tremendous! -SB Hi guys, I have managed to get all my oAuth to work (basically), however the autorize.php is getting this error when "Allowing". Any ideas why? Only happens once I press allow and it should have redirected to the REDIRECT_URI. Thanks in advance. this code was working perfectly fine past few months. nothings changed and now i am getting this error: Quote Fatal error: Call to a member function value() on a non-object in /home/staceyxs/public_html/_includes/login.php on line 8 <table style="width: 100%" class="style17" background="../images/content.png"> <tr> <td class="style3" style="width: 266px"> <img alt="" src="../images/headers/VIPL.png" width="220" height="220" /></td> <td > <form action="../System/process.php" method="POST" style="height: 62px"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td><strong>Username:</strong></td><td><input class="txt" type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>" /></td><td><? echo $form->error("user"); ?></td></tr> <tr><td><strong>Password:</strong></td><td><input class="txt" type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>" /></td><td><? echo $form->error("pass"); ?></td></tr> <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?> /> <font size="2">Remember me next time <input type="hidden" name="sublogin" value="1" /> <input type="submit" class="btn" value="Login" style="width: 70px; height: 40px" /></td></tr> <tr><td colspan="2" align="left"><br /><font size="2">[<a href="../System/forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> <tr><td colspan="2" align="left"><br />Not registered? <a href="../Register/index.php"> Register Now!</a></td></tr> </table> [<a href="../System/help.php" onclick="window.open('../System/help.php','popup','width=480,height=230,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">Help</a>]</div> </form> </td> </tr> </table> This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=349291.0 Fatal error: Cannot redeclare class MySQLDB in /home/xservers/public_html/skylar/VIP/include/database.php on line 14 Catchable fatal error: Object of class Person could not be converted to string in D:\Program Files\AppServ\www\Project 1\FrontSide\Spawner.php on line 8 Spawner.php <html><body> <?php require_once("../Person/Person.php"); $count = $_POST['count']; $add = 0; while ($add < $count) { $one.$add = new Person('laryy'); $add++; } $one->getInfo('age'); ?> </body></html> I don't understand what's wrong. If you need more of the code please ask Hi all, sorry about the subject as I wernt sure what to call it but anyway, Ive re coded a feature on my website which gives the user a chance to race agienst the computer but ive got an error saying: Catchable fatal error: Object of class stdClass could not be converted to string in /home/www/*****/test/test.php on line 52 <?php session_start(); include ("../includes/config.php"); include ("../includes/functions.php"); logincheck(); ini_set ('display_errors', 1); error_reporting (E_ALL); $username = $_SESSION['username']; $userstuff = mysql_query ("SELECT * FROM users WHERE username = '$username'") or die (mysql_error()); $user = mysql_fetch_object($userstuff); $garstu = mysql_query ("SELECT * FROM garage WHERE owner='$username'") or die (mysql_error()); $garage = mysql_fetch_object($garstu); $usercar = mysql_query ("SELECT carid FROM users WHERE username='$username'") or die (mysql_error()); $carin = mysql_fetch_object($usercar); $time= time() + 120; // Waiting time. if ($user->lastraceone > time()){ $left = $user->lastraceone - time(); echo "<center><b><font color=white>You Must Wait $left seconds before you race agian!</font></b></center>"; exit(); } // Use function to make sure there in a car.. function carcheck(){ if (empty($carin)){ echo ("You must be in a car before doing any races."); } else{ echo ("You are currently in: $carin."); } } // End function if (isset($_POST['race'])){ $race = $_POST['radiobutton']; carcheck(); //////////////////////////////////////// RACE 1 ///////////////////////////////////////////// if ($race == "1"){ // Rep gained $rand = rand(1000,10000); // Money gained $randmoney = rand(1000,15000); // Fuel used $randfuel = rand(3,10); mysql_query ("UPDATE users SET lastraceone = '$time' AND rep = 'rep+$rand' AND money = 'money+$randmoney' WHERE username='$username'") or die (mysql_error()); mysql_query ("UPDATE garage SET fuel = 'fuel-$randfuel' WHERE id = '$carin'") or die (mysql_error()); // Line 52 echo ("Well Done! You won: £$randmoney and $rand Rep. You also used $randfuel liters of fuel."); } /////////////////////////////////////// RACE 2 //////////////////////////////////////////// if ($race == "2"){ // Rep gained $random = rand(1000,10000); // Money gained $ranmoney = rand(1000,15000); // Fuel used $randomfuel = rand(3,10); mysql_query ("UPDATE users SET lastraceone = '$time' AND rep = 'rep+$random' AND money = 'money+$ranmoney' WHERE username='$username'") or die (mysql_error()); mysql_query ("UPDATE garage SET fuel = 'fuel-$randomfuel' WHERE id = '$carin'") or die (mysql_error()); echo ("Well Done! You won: £$ranmoney and $random Rep. You also used $randomfuel liters of fuel."); } } ?> <form action='' method='post' name='thisform'> Race along the Streets: <input name='radiobutton' type='radio' value='1'><br /> Race along A Drag Strip: <input name='radiobutton' type='radio' value='2'><br /> <input type='submit' name='race' Value='Race!'> mysql_query ("UPDATE garage SET fuel = 'fuel-$randfuel' WHERE id = '$carin'") or die (mysql_error()); // Line 52 Also line 52 is stated in the script I havent fully tested my script yet, while it not completly finished. But can anyone see why its giving me that error and how / or I can sort it please? Thanks for your help. im getting this error "Catchable fatal error: Object of class variant could not be converted to string in C:\wamp\www\mdb\1mdb.php on line 36" <td><?php echo $make; ?></td> no matter what i use as the query it always shows this error on the last row even a query that has 3 results it only shows the 1st 1(every other row echo's fine). its not a problem with the data as i switch between asc and dsc in the query every row shows at some point. im thinking that maybe the looping needs to be told to stop, but i can n ot find any info that makes sense to me on google. thanks <?php $conn = new COM("ADODB.Connection") or die("Cannot start ADO"); // Microsoft Access connection string. $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\\wamp\\www\\mdb\\one.mdb"); // SQL statement to build recordset. $rs = $conn->Execute("SELECT * from OneTouchImaging where make like 'toshiba' order by sku"); ?> <table border="1"> <?php // Display all the values in the records set while (!$rs->EOF) { $make = $rs->Fields["Make"]; $model = $rs->Fields["Model"]; $cpu = $rs->Fields["Cpu"]; $disksize = $rs->Fields["DiskSize"]; $bios = $rs->Fields["BIOS"]; $sku = $rs->Fields["SKU"]; $user = $rs->Fields["User"]; $model->value."<br>\n"; $make->value."<br>\n"; $cpu->value."<br>\n"; $disksize->value."<br>\n"; $bios->value."<br>\n"; $sku->value."<br>\n"; $user->value."<br>\n"; $rs->MoveNext(); ?> <tr> <td><?php echo $make; ?></td> <td><?php echo $model; ?></td> <td><?php echo $cpu; ?></td> <td><?php echo $disksize; ?></td> <td><?php echo $bios; ?></td> <td><?php echo $sku; ?></td> <td><?php echo $user; ?></td> <?php } $rs->Close(); ?> </tr> </table> |