hyster Posted November 19, 2010 Share Posted November 19, 2010 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 More sharing options...
Pikachu2000 Posted November 19, 2010 Share Posted November 19, 2010 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 More sharing options...
hyster Posted November 19, 2010 Author Share Posted November 19, 2010 http://sts.hostei.com/dsgi/ list_records.php the path is correct as im using an open dir and clicking on the file. the error page says nothing, it looks like a copy on there main page. Link to comment https://forums.phpfreaks.com/topic/219250-unknown-error/#findComment-1136981 Share on other sites More sharing options...
hyster Posted November 19, 2010 Author Share Posted November 19, 2010 sorted i was using a config file from another script which used sessions and the config file had the sessions in it. Link to comment https://forums.phpfreaks.com/topic/219250-unknown-error/#findComment-1136992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.