chriscloyd Posted January 25, 2007 Share Posted January 25, 2007 my function is not displaying anythingokay heres my function[code] <?phpfunction get_project($i) { $get_project = mysql_query("SELECT * FROM projects WHERE id = '$i'") or die(mysql_error()); $p = mysql_fetch_assoc($get_project) or die(mysql_error()); $p_name = $p['title']; $p_type = $p['type']; $p_startdate = $p['startdate']; return $p_type; return $p_name; return $p_startdate; if ($p['status'] != 'Completed') { $p_status = 'In Progress'; return $p_status; } else { $p_status = 'Completed'; $p_enddate = $p['enddate']; return $p_status; return $p_enddate; }}?>[/code]heres my code calling the function[code]<?phpsession_start();include("config.php");include("includes/porfolio_getfunctions.php");if (isset($_GET['project'])){ $id = $_GET['project']; get_project($id); echo $p_name; echo $p_type;}?>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted January 25, 2007 Share Posted January 25, 2007 You can only call return once within a function. Quote Link to comment Share on other sites More sharing options...
sspoke Posted January 25, 2007 Share Posted January 25, 2007 once you use return inside a function the function code stops at that point the rest of the code won't be called.so.. return $p_type; return $p_name; return $p_startdate;$p_name $p_startdat won't ever get called or anything below that line Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.