House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Convert php to cfm

Author:
Tom Small
01/10/2012 10:47 AM

Hi, I need to convert php to coldfusion. Would appreciate some help, thanks.... <?php #First we include our credentials file # FileName="connect.php" $hostname = "localhost"; $database = "nimsoftslmdev"; $username = "root"; $password = "xxx"; #And now we connect to the database //connection String //connection String $con = mysql_connect($hostname, $username, $password) or die('Could not connect: ' . mysql_error()); //select database mysql_select_db($database, $con); //Select The database $bool = mysql_select_db($database, $con); if ($bool === False){     print "can't find $database"; } $start = ($_REQUEST["start"] == null)? 0 : $_REQUEST["start"]; $limit = ($_REQUEST["limit"] == null)? 200 : $_REQUEST["limit"];     // Gather all pending requests $query = "SELECT nimid, level, message, source FROM nas_alarms" ; $query .= " ORDER BY level ASC "; $query .= " LIMIT ".$start.",".$limit; $result = mysql_query($query, $con); // Here we do the count $query_c = "SELECT nimid, level, message, source FROM nas_alarms" ; //get total $count_result = mysql_query($query_c, $con); $total = mysql_num_rows($count_result); if (mysql_num_rows($result) > 0){ while($obj = mysql_fetch_object($result))     {         $arr[] = $obj;     } // Now create the json array to be sent to our datastore $myData = array('myInventory' => $arr, 'totalCount' => $total); echo json_encode($myData); return; exit(); } else { // If no requests found, we return nothing $myData = array('myInventory' => '', 'totalCount' => '0'); echo json_encode($myData); return; exit(); } ?>


Search cf-talk

November 26, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
             1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30             

Designer, Developer and mobile workflow conference