hisham
IS-IT--Management
- Nov 6, 2000
- 194
I have a large switch statement to compare the $id and $link variables with many different values, and want to use the following code in this statment:
--------------------------------------------------------------
$sql = "select * from my_table where my_id = $id and my_link = '$link' ";
$result = $nav->execute($sql, $db, "mysql");
$rows = mysql_num_rows($result);
for ($y = 0; $y < $rows; $y++) {
$data = mysql_fetch_object($result);
echo "$data->my_link";
}
----------------------------------------------------------------
execute() is a command of a class included in the top of the code.
how can I can create a function contain this code to use it in the switch statement?
Thanks in advance
--------------------------------------------------------------
$sql = "select * from my_table where my_id = $id and my_link = '$link' ";
$result = $nav->execute($sql, $db, "mysql");
$rows = mysql_num_rows($result);
for ($y = 0; $y < $rows; $y++) {
$data = mysql_fetch_object($result);
echo "$data->my_link";
}
----------------------------------------------------------------
execute() is a command of a class included in the top of the code.
how can I can create a function contain this code to use it in the switch statement?
Thanks in advance