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(); ?> Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.