Johnain Posted December 29, 2007 Share Posted December 29, 2007 I really have hunted, but I cannot find the syntax for the link. As a conszquence I have put my gunction into the header of the html file and I get an arror on the line in red below, the case statement. <head> <?php $order="XXXX"; function fnshowmail($order){ mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); switch ($order) { case DATE: $query="SELECT * FROM visitoremailin" use index created or die("Bad syntax"); break; default: $query="SELECT * FROM visitoremailin"; } $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); return $num; } ?> The function is called in the <body> below by a button tht sets "$order and the vars such as $username and $password are filled in the body before the function is called for the first time. It may be the syntax in the switch staement, but I just cannot see it. The erroe message is ... Parse error: syntax error, unexpected T_USE in /home/johnain/public_html/scripts/dispmailsin.php on line 27 Regrds to all John Quote Link to comment https://forums.phpfreaks.com/topic/83594-solved-referencing-a-php-function-file-from-an-html-doc/ Share on other sites More sharing options...
rab Posted December 29, 2007 Share Posted December 29, 2007 case 'DATE': Need quotes Quote Link to comment https://forums.phpfreaks.com/topic/83594-solved-referencing-a-php-function-file-from-an-html-doc/#findComment-425285 Share on other sites More sharing options...
Johnain Posted December 29, 2007 Author Share Posted December 29, 2007 Thanks a million for that. It does puzzle me though because I have loads of others without quotes that work fine. Maybe that was beginners luck!! Do you know the syntax for a link in the header to a "library" file of functions? Regards John Quote Link to comment https://forums.phpfreaks.com/topic/83594-solved-referencing-a-php-function-file-from-an-html-doc/#findComment-425292 Share on other sites More sharing options...
rab Posted December 29, 2007 Share Posted December 29, 2007 include "lib/functions.php"; That? Quote Link to comment https://forums.phpfreaks.com/topic/83594-solved-referencing-a-php-function-file-from-an-html-doc/#findComment-425301 Share on other sites More sharing options...
Johnain Posted December 30, 2007 Author Share Posted December 30, 2007 No. Although it does seem a simple way to do it. I was looking for the equivalent of ... <link href="../css/style1.css" rel="stylesheet" type="text/css" /> ... in my own misguided way !!!! Thanks a lot ! Regards John Quote Link to comment https://forums.phpfreaks.com/topic/83594-solved-referencing-a-php-function-file-from-an-html-doc/#findComment-425844 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.