Jump to content

[SOLVED] Referencing a PHP function file from an HTML doc


Johnain

Recommended Posts

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

 

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

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

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.