Jump to content

unknown error


hyster

Recommended Posts

im using 000webhost as a test site and when i run this code it redirects me to there err page but with no error message.

the sql query works fine in phpmyadmin and i added the rest of the code to try the php side.

i "think" the problem is the echo $rows"value's" as im unsure of what the $vars should be

 

 

<?php
include("config.php"); 

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql = "SELECT make, COUNT(*) AS total, SUM(IF(comments = \'pass\', 1, 0)) AS withComments FROM dsgi_serval GROUP BY make ORDER BY COUNT(*) DESC"; 
$result=mysql_query($sql);
echo "$sql";
echo "$result";

?>

<table><tr>
<td colspan="4"><strong>List data from mysql </strong> </td>
</tr>
<tr>
<td align="center"><strong>make</strong></td>
<td align="center"><strong>Total</strong></td>
<td align="center"><strong>Validated</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><?php echo $rows['make']; ?></td>
<td><?php echo $rows['total']; ?></td>
<td><?php echo $rows['withcomments']; ?></td>
</tr>


<?php
}
?>
</table>
<?php
mysql_close();
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.