vividona Posted November 16, 2008 Share Posted November 16, 2008 mysql_error hi experts, I programmed this small article script I got this mysql error http://bhl.43i.net/ but in my apache there is no error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/dothost.eu/vhosts/bhl.43i.net/index.php on line 69 Link to comment https://forums.phpfreaks.com/topic/132947-mysql_error-in-my-script/ Share on other sites More sharing options...
gevans Posted November 16, 2008 Share Posted November 16, 2008 Going to need a bit more details than that, can you paste the code from the problem area? Link to comment https://forums.phpfreaks.com/topic/132947-mysql_error-in-my-script/#findComment-691351 Share on other sites More sharing options...
Mchl Posted November 16, 2008 Share Posted November 16, 2008 This usually means, that the query you used before did not run (probably encountered an error). Try echoing mysql_error() to see what is wrong with query. Link to comment https://forums.phpfreaks.com/topic/132947-mysql_error-in-my-script/#findComment-691355 Share on other sites More sharing options...
vividona Posted November 16, 2008 Author Share Posted November 16, 2008 but it works in my apache this is what is make the error public function LoadHtml(){ try{ if(!$_SESSION['uid'] == true){ require_once('Themes/default/header.php'); $checkactive = sprintf( "SELECT * FROM %s ", parent::BhlPermitTbl); $ActiveQuery = mysql_query($checkactive); $row = mysql_fetch_array($ActiveQuery); $CloseBhl = $row['bhlclose']; if(!$CloseBhl == 0){ throw new Exception("<br/>الموقع مغلق من قبل الإدارة لغرض الصيانة الرجاء الزيارة لاحقاً<br/><br/>"); } Link to comment https://forums.phpfreaks.com/topic/132947-mysql_error-in-my-script/#findComment-691373 Share on other sites More sharing options...
Mchl Posted November 16, 2008 Share Posted November 16, 2008 Change: $ActiveQuery = mysql_query($checkactive); to $ActiveQuery = mysql_query($checkactive) or die(mysql_error().": ".$checkactive); This will echo any mysql errors. Link to comment https://forums.phpfreaks.com/topic/132947-mysql_error-in-my-script/#findComment-691379 Share on other sites More sharing options...
vividona Posted November 16, 2008 Author Share Posted November 16, 2008 this is the full code <?PHP # ------------------------------------------------------------------------------------------# # BHLsimpleTool - PHP Content Management System # # Copyright (c) 2008 bhl.org # # <http://www.bhl.org/> # # -----------------------------------------------------------------------------------------# # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # #-------------------------------------------------------------------------------------------# # This program is distributed in the hope tat it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # -----------------------------------------------------------------------------------------# $classname = "BHL_login"; $path = "classes/{$classname}.php"; try{ if ( ! file_exists( $path ) ) { throw new Exception( "No such file as {$path}" ); } require_once( $path ); if ( ! class_exists( $classname ) ) { throw new Exception( "No such class as $classname" ); } } catch ( Exception $e ) { echo "Error : ".$e->getMessage(); } class RunIndex extends BHL_login{ private $DirInstall; public function __construct($DirInstall=""){ parent::__construct(); $this->setDir($DirInstall); echo '<html dir="rtl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1256"> <title>BHLsimpleTool v1.0 - index page</title> </head>'; echo '<table width="860" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#996600"> <tr> <th >'; require_once('lang/BHL_english.php'); } public function getDir(){ return $this->DirInstall; } public function setDir($DirInstall){ $this->DirInstall = dirname(__FILE__); } public function ReqInstall($DirInstall){ if (file_exists($this->getDir()) && file_exists(dirname(__FILE__) . '/install.php') && file_exists(dirname(__FILE__) . '/readme.php')) header("Location: install.php"); } public function LoadHtml(){ try{ if(!$_SESSION['uid'] == true){ require_once('Themes/default/header.php'); $checkactive = sprintf( "SELECT * FROM %s ", parent::BhlPermitTbl); $ActiveQuery = mysql_query($checkactive); $row = mysql_fetch_array($ActiveQuery); $CloseBhl = $row['bhlclose']; if(!$CloseBhl == 0){ throw new Exception("<br/>الموقع مغلق من قبل الإدارة لغرض الصيانة الرجاء الزيارة لاحقاً<br/><br/>"); } echo '<table width="860" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><th scope="col"> <tr> <th scope="col"><table width="150" border="1" align="right" cellpadding="0" cellspacing="0"> <tr> <th scope="col"><a href="index.php"><img src="Themes/default/images/main2.png" width="150" height="40" /></th> </tr> <tr> <th scope="col"><a href="oper/article.php"><img src="Themes/default/images/article.png" width="150" height="40" /></th> </tr> <tr> <th scope="col"><a href="callus.php"><img src="Themes/default/images/callus.png" width="150" height="40" /></th> </tr> <tr> <th scope="col">';parent::IndexLoginningIn( $UserName, $UserPswd ); echo '</th> </tr> <tr> <th scope="col">';parent::BhlStats(); echo '</th> </tr> <tr> <th scope="col">';parent::ViewLastMems($UserId, $UserName, $Uregcode); echo '</th> </tr> </table> <table width="700" border="0" align="right" cellpadding="0" cellspacing="0" bordercolor="#996600"> <tr> <th scope="col">'; parent::ViewThread($ArtiSub, $ArtiBod); echo '</th> </tr> <tr> <th align="right" scope="col"></th> </tr> <tr> <th scope="col">'; parent::ViewLastArtis($ArtiSub, $ArtiBod); echo '</th></tr> </table></th> </tr> </table>'; }elseif($_SESSION['idgroup'] == true){ require_once('Themes/default/header2.php'); echo '<table width="860" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><th scope="col">'; echo '<table width="860" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#996600"> <tr> <th scope="col"><table width="150" border="1" align="right" cellpadding="0" cellspacing="0"> <tr> <th scope="col"><a href="index.php"><img src="Themes/default/images/main2.png" width="150" height="40" /></th> </tr> <tr> <th scope="col"><a href="oper/article.php"><img src="Themes/default/images/article.png" width="150" height="40" /></th> </tr> <tr> <th scope="col"><a href="callus.php"><img src="Themes/default/images/callus.png" width="150" height="40" /></th> </tr> <tr>'; if($_SESSION['idgroup'] == 1){ echo '<th scope="col"><a href="administrator/index.php"><img src="Themes/default/images/admin.png" width="150" height="40" /></th> </tr>'; } echo '<tr> <th scope="col">';parent::BhlStats(); echo '</th> </tr>'; echo '<tr> <th scope="col">';parent::ViewLastMems($UserId, $UserName, $Uregcode); echo '</th> </tr>'; echo '</table> <table width="700" border="0" align="right" cellpadding="0" cellspacing="0" bordercolor="#996600"> <tr> <th scope="col">'; parent::ViewThread($ArtiSub, $ArtiBod); echo '</th> </tr> <tr> <th align="right" scope="col"> </th> </tr> <tr> <th scope="col">'; parent::ViewLastArtis($ArtiSub, $ArtiBod); echo '</th></tr> </table></th> </tr> </table>'; }else{ require_once('Themes/default/header2.php'); $checkactive = sprintf( "SELECT * FROM %s ", parent::BhlPermitTbl); $ActiveQuery = mysql_query($checkactive); $row = mysql_fetch_array($ActiveQuery); $CloseBhl = $row['bhlclose']; if(!$CloseBhl == 0){ throw new Exception("<br/>الموقع مغلق من قبل الإدارة لغرض الصيانة الرجاء الزيارة لاحقاً<br/><br/>"); } echo '<table width="860" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><th scope="col">'; echo '<table width="860" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#996600"> <tr> <th scope="col"><table width="150" border="1" align="right" cellpadding="0" cellspacing="0"> <tr> <th scope="col"><a href="index.php"><img src="Themes/default/images/main2.png" width="150" height="40" /></th> </tr> <tr> <th scope="col"><a href="oper/article.php"><img src="Themes/default/images/article.png" width="150" height="40" /></th> </tr> <tr> <th scope="col"><a href="callus.php"><img src="Themes/default/images/callus.png" width="150" height="40" /></th> </tr> <tr>'; if($_SESSION['idgroup'] == 1){ echo '<th scope="col"><a href="administrator/index.php"><img src="Themes/default/images/admin.png" width="150" height="40" /></th> </tr>'; } echo '<tr> <th scope="col">';parent::BhlStats(); echo '</th> </tr>'; echo '<tr> <th scope="col">';parent::ViewLastMems($UserId, $UserName, $Uregcode); echo '</th> </tr>'; echo '</table> <table width="700" border="0" align="right" cellpadding="0" cellspacing="0" bordercolor="#996600"> <tr> <th scope="col">'; parent::ViewThread($ArtiSub, $ArtiBod); echo '</th> </tr> <tr> <th align="right" scope="col"> </th> </tr> <tr> <th scope="col">'; parent::ViewLastArtis($ArtiSub, $ArtiBod); echo '</th></tr> </table></th> </tr> </table>'; } } catch ( Exception $e ) { echo $e->getMessage(); } } } $Index = new RunIndex(); $Index->getDir(); $Index->setDir($DirInstall); $Index->ReqInstall($DirInstall); $Index->LoadHtml(); require_once('Themes/default/footer.php'); require_once('Themes/default/style.css'); echo '</th> </tr> </table>'; ?> Link to comment https://forums.phpfreaks.com/topic/132947-mysql_error-in-my-script/#findComment-691400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.