function call

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
twb
Forum Commoner
Posts: 27
Joined: Thu Jan 06, 2005 4:39 pm

function call

Post by twb »

Hi I am having a problem when calling a function. I have a function that populates numerous text boxes and echos the querry that was used displaying the employee_id...This all works. The problem is when I go to update it the same function is called and it cant find that employee_id... The function is still called..

Code: Select all

function Display_Employee_Details($employee_id){ 
$query = "Select * FROM employees WHERE employee_id = $employee_id"; 
$result = mysql_query($query); 
echo $query; 
if(!$result){ 
    echo 'Error in Search for Results:'.mysql_error(); 
    exit(); 
    } 
    else{ 
        //Get Results 
        global  $last_name,$first_name,$email,$city,$street,$unit_
no,$province,$country,$postal_code,$birth_date, $telephone,$oasis; 
        $row = mysql_fetch_array($result); 
        $last_name = $row['last_name']; 
        $first_name = $row['first_name']; 
        $email = $row['email']; 
        $city = $row['city']; 
        $street = $row['street']; 
        $unit_no = $row['unit_no']; 
        $province = $row['province']; 
        $country = $row['country']; 
        $postal_code = $row['postal_code']; 
        $birth_date = $row['birth_date']; 
        $telephone = $row['telephone']; 
        $oasis = $row['oasis']; 
    } 
}
Thanks
TWB
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Be a bit nicer about a failed query. If it can't find the employee, just return, say, a blank value or something.
Post Reply