I am a newbie on creating my own functions but i have a problem when you use my own function with mysql
In this case i have a table with account information and i need to fetch account from the database , insert them on the other table and email them , i need to at echo my result or to show that my function works pls help me , i have done a simple array function and a simple standard function for echoing and it works fine so im getting lost with mysql queries
I have a a class funcs.php
<?php
//This is a controller file. It will include a template file and also a class
require_once ('paths.php');
// define a function
function myStandardResponse() {
echo "Get lost, jerk!<br /><br />";
}
function randarr($num,$min=0,$max=100) // Define the function.
{
// The code within these curly braces is the body of the function.
$arr = array(); // Create an array.
for($i=0; $i < $num; $i++)
$arr[] = rand($min,$max); // Add $num integers to the array.
return $arr; // Return the array created.
// End of function.
}
function fetchAccount()
{
require(CONNECTIONS.'conn.php');
$sql = "SELECT * FROM Internal_Docs_accounts";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
return $result;
}
?>
which include my functions
and i have a class returnProcDocProcess.php
<?php
require_once('funcs.php'); // Include our randarr() function
$array = randarr(5,50,80); // Create an array with five integers between 50 and 80.
print_r($array); // Output our array.
// at the party
echo "Hi, haven't I seen you somewhere before?<br />";
myStandardResponse();
//get account detail i need help with echoiung account details etc
?>