Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing a function 1

Status
Not open for further replies.

camcim

Programmer
Jan 25, 2003
20
0
0
US
Hi all,
Is this the proper coding for a function?
If so, how do i call it later on in my script?
If it is not, am i able to write such a function this way?

Code:
function find_title(){
$result = mysql_query("SELECT * FROM help WHERE help_id = '$cat_id'",$db);
while  ($row = mysql_fetch_array($result)) {
$help_name = $row["help_name"];

echo "$help_name";
}
}

Cheers,
camcim
 
function find_title($cat_id){
$result = mysql_query("SELECT * FROM help WHERE help_id = '$cat_id'",$db);
while ($row = mysql_fetch_array($result)) {
$help_name = $row["help_name"];

echo "$help_name";
}
}


to call it:
find_title($cat_id); ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top