I have a page that is using alot of mysql queries. Is there a way i can write one php file and call these queries into any page ?
Example : Lets say i have 50 of the below queries in a php file (there are 50 different queries)
<?php
include_once("db.php");
session_start();
if(isset($_SESSION['affID'])) {
}
$sql = "SELECT SUM(AffPaid) as c FROM toutcome WHERE affID = '" . $_SESSION['affID'] . "'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo "£" . $row['c'] ;
?>
Can i not do the following ?
**$query1 =**
<?php
include_once("db.php");
session_start();
if(isset($_SESSION['affID'])) {
}
$sql = "SELECT SUM(AffPaid) as c FROM toutcome WHERE affID = '" . $_SESSION['affID'] . "'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo "£" . $row['c'] ;
then in any page say echo $query1 ?