Jump to content

Select Case help


kemnet

Recommended Posts

Hello Forums.

I have this query

           $mt = $this->db->prepare('SELECT id,type,rigFROM table WHERE form_name=?');
$mt->bind_param("s",$form_name);
     $mt->execute();
        $mt->bind_result($id,$type,$rig);  

This works fine... but i want to say incase the current date is => expires date(which is a column) write expired or not expired to another column

like this

        $mt = $this->db->prepare('SELECT id,type,rig,CASE WHEN CURDATE( ) >= `expires` THEN 'Expired'ELSE 'Not Expired'END AS status FROM table WHERE form_name=?');
$mt->bind_param("s",$form_name);
     $mt->execute();
        $mt->bind_result($id,$type,$rig,$status);

This code works fine in PHP admin but when i pull it onto my webscripts it doesnt seem to work...would love if someone could point out my error..thanks

Link to comment
https://forums.phpfreaks.com/topic/262839-select-case-help/
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.