Pls fix this error for masterloft script

Started on the old forum in December 2013 · view the original in the archive · old links redirect here

5 replies · 226 views · started 12 years ago · 1 min read

2 participants
sakib00 Newbie · 3 posts #1

Warning: mysql_result() expects parameter 1 to be resource, boolean given in /home/u587244903/public_html/public_html/pages/mainmenu.php on line 109

Solution pls.....

something else Fellow · 2,296 posts #2

No data stored in database causing the mysql_result to be false

post line 109 here of mainmenu.php for more help 😛

sakib00 Newbie · 3 posts #3

something else wrote: No data stored in database causing the mysql_result to be false

post line 109 here of mainmenu.php for more help :P

Thats it:

 $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' AND `kiemduyet` = '1' AND kedit = '0' AND `close`!='1'"), 0);
$req = mysql_query("SELECT * FROM `forum` WHERE `type`='t'" . ($rights >= 7 ? '' : " AND `close`!='1'") . " ORDER BY `time` DESC LIMIT $start," . $settings['totalThemes']);
while (($res = mysql_fetch_assoc($req)) !== false) {
if ($res['close']) $themesOut .= '<div class="forum_del">';
else $themesOut .=  $i % 2 ? '<div class="menu">' : '<div class="menu">';
$nickUser = mysql_fetch_assoc(mysql_query("SELECT `user_id`,`from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $res['id'] . "' ORDER BY `time` DESC LIMIT 1"));
$totalPosts = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `refid`='" . $res['id'] . "'" . ($rights >= 7 ? '' : " AND `close` != '1'")), 0); 
something else Fellow · 2,296 posts #4

Try:

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' AND `kiemduyet` = '1' AND kedit = '0' AND `close`!='1'"), 0); 
if($total[0]>0){ //new if
$req = mysql_query("SELECT * FROM `forum` WHERE `type`='t'" . ($rights >= 7 ? '' : " AND `close`!='1'") . " ORDER BY `time` DESC LIMIT $start," . $settings['totalThemes']); 
while (($res = mysql_fetch_assoc($req)) !== false) { 
if ($res['close']) $themesOut .= '<div class="forum_del">'; 
else $themesOut .=  $i % 2 ? '<div class="menu">' : '<div class="menu">'; 
$nickUser = mysql_fetch_assoc(mysql_query("SELECT `user_id`,`from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $res['id'] . "' ORDER BY `time` DESC LIMIT 1")); 
$totalPosts = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `refid`='" . $res['id'] . "'" . ($rights >= 7 ? '' : " AND `close` != '1'")), 0);  

}// close if
sakib00 Newbie · 3 posts #5

No result bro... 🙁

something else wrote: Try:

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' AND `kiemduyet` = '1' AND kedit = '0' AND `close`!='1'"), 0); 
if($total[0]>0){ //new if
$req = mysql_query("SELECT * FROM `forum` WHERE `type`='t'" . ($rights >= 7 ? '' : " AND `close`!='1'") . " ORDER BY `time` DESC LIMIT $start," . $settings['totalThemes']); 
while (($res = mysql_fetch_assoc($req)) !== false) { 
if ($res['close']) $themesOut .= '<div class="forum_del">'; 
else $themesOut .=  $i % 2 ? '<div class="menu">' : '<div class="menu">'; 
$nickUser = mysql_fetch_assoc(mysql_query("SELECT `user_id`,`from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $res['id'] . "' ORDER BY `time` DESC LIMIT 1")); 
$totalPosts = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `refid`='" . $res['id'] . "'" . ($rights >= 7 ? '' : " AND `close` != '1'")), 0);  

}// close if
something else Fellow · 2,296 posts #6

oh damn blind tonight >.<

the problem with it is there is no posts in the forum making mysql_result return "false" (Boolean)

i would change the mysql_result to mysql_fetch_array eg:

$total = mysql_fetch_array((mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' AND `kiemduyet` = '1' AND kedit = '0' AND `close`!='1'"));
$total = $total[0];

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close