is resource function in php example

php example code : is_resource function in php function in php

is-resource-php-example.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <title>php example code : is_resource function in php</title>
 </head>
 <body>
  <h3>php example code : is_resource function in php</h3>
  <?php
   /*
    ----------------------------------------------------------------------------
    let us make a resource and test it wheather it is resource or not
    by using php is_resource function
    ----------------------------------------------------------------------------
   */
   $myResource = @mysql_select_db('SampleDBSource');
   
   $resourceFlag = is_resource($myResource);
   
   if($resourceFlag == true)
   {
    echo 'it is a resource';
   }
   else
   {
    echo "<p style='background:red; color:white;'>it is not a resource</p>";
   }
  ?>
 </body>
</html>


php example code : is_resource function in php function in php - output in the browser

No comments:

Post a Comment

leave your comments here..