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
https://forums.phpfreaks.com/topic/219250-unknown-error/
Share on other sites

It's hard to say. The script has no parse errors, and if you're being directed to a completely different page, that would seem to indicate an error in the filename/path instead. What does the error page say?

Link to comment
https://forums.phpfreaks.com/topic/219250-unknown-error/#findComment-1136980
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.