Welcome Guest, Not a member yet? Register   Sign In
Get the value

Hi guys, please tell me how to get the value form these below dates:

$sql = "SELECT start_date, deadline FROM projects WHERE id =7";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        [b] echo $row["start_date"];[/b]
        [b] echo $row["deadline"];[/b]

to this:

$start = '$start_date';
$end = '$deadline';
$diff = (strtotime($end)- strtotime($start))/24/3600;
echo $diff;


Using echo or something?
Thanks for help

There's no need for a "foreach ..." structure if the result can only be one row (where id=7 will only return 1 row, right?).
Why do you ask this question in a CodeIgniter forum? None of your code proves that you use CodeIgniter in any way.

Theme © iAndrew 2016 - Forum software by © MyBB