-1

I am trying to create update function for logged user but I get this kind of error:

"mysql_result() expects parameter 1 to be resource, boolean given"

can someone help me identify the problem?

$pagee_query = mysql_query("SELECT COUNT(*) FROM order");
                                        $pages = ceil(mysql_result($pagee_query, 0) / $per_pagee);
$pagee = (isset($_GET['pagee'])) ? (int)$_GET['pagee'] : 1;
$start = ($pagee - 1) * $per_pagee;

$query = mysql_query("SELECT * FROM `order` LIMIT $start, $per_pagee");

while ($data = mysql_fetch_array($query)) {
?>
<tr>
<td><?php echo $data['order_id']; ?></td>
<td><?php echo $data['id']; ?></td>
<td><?php echo $data['name']; ?></td>
<td><?php echo $data['address']; ?></td>
<td><?php echo $data['code']; ?></td>
<td><?php echo $data['name_nl']; ?></td>
<td><a href="delete-pesan.php?id=<?php echo $data['order_id'];?>"class="btn" onclick="return confirm('Are you Sure ?')")><i class="icon-trash"></i></a></td>
</tr>
<?php   
}
?>

.

<?php
if($pages >= 1 && $pagee <= $pages)
{
for($x=1; $x<=$pages; $x++)
{

if($x == $pagee)
echo ' <b><a href="?pagee='.$x.'">'.$x.'</a></b> | ';
else
echo ' <a href="?pagee='.$x.'">'.$x.'</a> |';
}
}
?>
awang
  • 13
  • 1
  • 6

1 Answers1

0

As you cannot put your table as the reserved keyword of MySQL, as the "order" is a reserved keyword. Try using it like

SELECT COUNT(*) FROM `order`

By adding ` symbol you can escape this, but it is not a good practice.

DASH
  • 302
  • 1
  • 3
  • 10