• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC function rowcount

bok

Member
Joined
Apr 28, 2009
Messages
332
Reaction score
6
Location
127.0.0.1/Brasil/Goias
PHP:
<?php
if ($action == ""){
$main_content .='
<div class="InnerTableContainer">
<table style="width:100%;">
<tbody>
<tr>
<td>
<div class="TableShadowContainerRightTop">
<div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);">
</div>
</div>
<div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);">
<div class="TableContentContainer">
<table width="100%" border="0" cellpadding="2" cellspacing="2" class="TableContent" style="border:1px solid #faf0d7;" ><tbody><tr>   
<tr bgcolor="#D4C0A1">
<td><b>Title</b></td>
<td><b>Tag</b></td>
<td><b>Date</b></td>
</tr>';
$gallery = $SQL->query("SELECT * FROM  `videos` ORDER BY `data` DESC LIMIT 25");
if($gallery->rowcount() == 0) {
$main_content .='<tr bgcolor="'.$config['site']['lightborder'].'"><td colspan="3"><center><i>No videos found.</i></center></td></tr>';
} else {
if(is_object($gallery)) {
foreach($gallery as $row) {
if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .='
<tr bgcolor="'.$bgcolor.'">
<td width="200px"><a href="http://'.$row['url'].'" target="_blank">'.$row['titulo'].'</a></td>
<td width="200px">'.$row['tag'].'</td>
<td width="200px">'.date("d/m/Y, H:i:s",$row['data']).'</td>
</tr>';
}
}
}
$main_content .='
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);">
<div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);"></div>
<div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);"></div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<br />';
if ($logged){$main_content .='<a href="?subtopic=gallery&action=add">New Video</a>';}
}
if ($action == "add"){
if ($logged){
$main_content .='
<form action="?subtopic=gallery&action=add_" method="post">
<input type="hidden" name="data" value="'.time().'" />
<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="5" WIDTH="100%">
<tr BGCOLOR="'.$config['site']['vdarkborder'].'">
<td CLASS="white"><b>Video Add</b></td>
</tr>
<tr BGCOLOR='.$config['site']['darkborder'].'>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><strong>Titulo</strong></td>
    <td><input type="text" id="titulo" name="titulo" /></td>
  </tr>
  <tr>
    <td><strong>Url</strong></td>
    <td><input type="text" id="url" name="url" /></td>
  </tr>
  <tr>
    <td><strong>Tag</strong></td>
    <td><select name="tag" id="tag">
<option selected="selected">(Select One)</option>
<option>War</option>
<option>Guilds</option>
<option>Others</option>
</select></td>
  </tr>
  <tr>
    <td><strong>Autor</strong></td>
    <td><select name="autor">';
$players_from_logged_acc = $account_logged->getPlayersList();
if(count($players_from_logged_acc) > 0) {
$players_from_logged_acc->orderBy('name');
foreach($players_from_logged_acc as $player) {
$main_content .= '<option>'.$player->getName().'</option>';
}
}else {
$main_content .= 'You don\'t have any character on your account.';
}
$main_content .='
</select></td>
  </tr>
  <tr>
    <td><input type="submit" value="Enviar" /></td>
    <td>&nbsp;</td>
  </tr>
</table>
</td>
</tr>
</TABLE>
</form>
';}
else{
    $link = "?subtopic=gallery&action=add";
    include("login.php");
}
}
if ($action == "add_"){
$SQL->query ("INSERT INTO `videos` (`id` ,`titulo` ,`url` ,`autor` ,`data` ,`tag`) VALUES (NULL,  '$titulo',  '$url',  '$autor',  '$data',  '$tag');");
$SQL->query ("OPTIMIZE TABLE  `videos`");
$main_content .='<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="5" WIDTH="100%">
<tr BGCOLOR="'.$config['site']['vdarkborder'].'">
<td CLASS="white"><b>Gallery Message</b></td>
</tr>
<tr BGCOLOR='.$config['site']['darkborder'].'>
<td><b>'.$titulo.'</b> added successfully!</td>
</tr>
</TABLE>
<br />
<form action="?subtopic=gallery" method="post">
<input type="image" src="'.$layout_name.'/images/buttons/sbutton_back.gif" />
</form>
';
}
?>

Fatal error: Call to a member function rowcount() on a non-object in D:\xampp\htdocs\gesior2012\pages\gallery.php on line 22
 
Solution
As the error says, $gallery is not an object.

This piece of code gave me cancer. Please format it correctly, also there is no need to use:

PHP:
f(!is_int($number_of_rows / 2)) {

We are in 2k17, you can use CSS for this:

PHP:
.zebra tbody tr:nth-child(odd) {
   background-color: #D4C0A1;
}

.zebra tbody tr:nth-child(even) {
   background-color: #F1E0C6;
}
As the error says, $gallery is not an object.

This piece of code gave me cancer. Please format it correctly, also there is no need to use:

PHP:
f(!is_int($number_of_rows / 2)) {

We are in 2k17, you can use CSS for this:

PHP:
.zebra tbody tr:nth-child(odd) {
   background-color: #D4C0A1;
}

.zebra tbody tr:nth-child(even) {
   background-color: #F1E0C6;
}
 
Solution
Back
Top