Page 1 of 1

function call

Posted: Sun Feb 13, 2005 1:32 pm
by twb
Hello everyone, I have a problem and new to php if someone could help me out. I have case statement
with a variable that is set to 'edit'. The case statement 'edit' is called however the function dosen't get called. This code is all above the html.

Code: Select all

$task_id = !empty($_REQUESTї'task_id']) ? $_REQUESTї'task_id'] : "";
$action = !empty($_REQUESTї'action']) ? $_REQUESTї'action'] : "add";

Code: Select all

switch ($action){ 
case "edit": 
        echo "test edit 1"; //this does print 
         Edit_Task($task_id); 
        echo " test edit 3 "; //this doesn't print 
        break; 
         
    }//end switch
Here in the function I have some echo statements that are not called.

Code: Select all

function Edit_Task($task_id){ 
echo "test Function Edit_Task"; ///this doesn't print 
$query = 'SELECT * FROM calander WHERE task_id = $task_id'; 
echo "<br> $query "; //this dosen't print 
$result = mysql_query($query); 
if(!$result)&#123; 
    echo "Error in Search Results". mysql_error();&#125; 
else&#123; 
$row = mysql_fetch_array($result); 
$task_name = $row&#1111;'task_name']; 
$task_description = $row&#1111;'task_description']; 
$task_date = $row&#1111;'task_date']; 
$task_time = $row&#1111;'task_time']; &#125;//close else
Thanks
twb

Posted: Sun Feb 13, 2005 2:58 pm
by jonemo
what is your error_reporting set to? i.e.: are errors like "called to undefined function" usually shown? id could just be, that the function is not found for whatever reason.

btw: have you just forgotten to copy the closing } of the function definition or is it also missing in the code?

Posted: Sun Feb 13, 2005 3:07 pm
by d3ad1ysp0rk
Is the function in the same file as the code that is calling it?

If not, are you including the file with the function in it?