Petrushka Posted November 18, 2007 Share Posted November 18, 2007 Good afternoon. I was hoping for some advice or assistance on the two following points: a) I wish to have my banner and navigation system in a php include file. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head><title>Virtual Stud Book</title> <link rel="stylesheet" type="text/css" href="http://www.virtualstudbook.co.uk/style/style.css"/> </head> <?php include("http://www.virtualstudbook.co.uk/style/template.php");?> <body> <div id="main"> <b>Welcome to the Virtual Stud Book!</b> </div> </body></html> The result I get from the code above is: http://www.virtualstudbook.co.uk/index_test.php How can I correct this? Additionally, I have a table called horses, with current data as follows: http://www.virtualstudbook.co.uk/images/horses_table.jpg I would like to have a list of the breeds for each gender, showing how many results there are (if there are no results I'd still want the breed to show up with '0'). The current code is: <?php mysql_connect("*****", "*****", "*****") or die(mysql_error()); mysql_select_db("*****") or die(mysql_error()); $data = mysql_query("SELECT gender, COUNT(*) SELECT * FROM `horses` WHERE gender = 'mare' AND allowed='OK' GROUP BY breed;") or die(mysql_error()); ?> The current result is: http://www.virtualstudbook.co.uk/search/horse.php I'd appreciate any help. Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 18, 2007 Share Posted November 18, 2007 You are getting this errors Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/fhlinux159/v/virtualstudbook.co.uk/user/htdocs/index_test.php on line 6 Warning: include(http://www.virtualstudbook.co.uk/style/template.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/fhlinux159/v/virtualstudbook.co.uk/user/htdocs/index_test.php on line 6 Warning: include() [function.include]: Failed opening 'http://www.virtualstudbook.co.uk/style/template.php' for inclusion (include_path='.:/usr/share/pear-php5') in /home/fhlinux159/v/virtualstudbook.co.uk/user/htdocs/index_test.php on line 6 Check allow_url_fopen is enabled in your php.ini file, I think URL file-access is disabled in the server. you can keep this line in your page and try ini_set('allow_url_fopen', 'on'); And for that query error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM `horses` WHERE gender = 'mare' AND allowed='OK' GROUP BY ' at line 1 There is error in your query, see some examples for writing subqueries http://dev.mysql.com/doc/refman/5.0/en/subqueries.html Quote Link to comment Share on other sites More sharing options...
Petrushka Posted November 18, 2007 Author Share Posted November 18, 2007 The php include is a strange one... I have another site with the same piece of code, hosted with the same people, works no problem. I have looked up the details, which are below: allow_url_fopen On On allow_url_include Off Off So I looked up on my host's support page how to change the allow_url_include to On: Can I edit the PHP.INI file? This file is not editable on the server and we are unable to change this for you for security reasons. Bizarre. Have been playing with the count issue, and have managed to get rid of all error messages, though sadly, none of the breeds/counts show up either. $data = mysql_query("SELECT breed, COUNT(*) FROM horses WHERE gender='Mare' AND allowed='OK' GROUP BY breed") or die(mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 18, 2007 Share Posted November 18, 2007 I think your include will work if you use a path instead of a URL like virtualstudbook.co.uk/public_html/style/template.php Quote Link to comment Share on other sites More sharing options...
Petrushka Posted November 18, 2007 Author Share Posted November 18, 2007 Brilliant! Works now, many thanks! Edit: Ooops. No, sorry jumped the gun. 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.