Jump to content

php function return


chriscloyd

Recommended Posts

my function is not displaying anything
okay heres my function

[code]
<?php
function 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]
<?php
session_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]
Link to comment
https://forums.phpfreaks.com/topic/35631-php-function-return/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.