Mysql:
<?PHP$code=$_post[' Code '];$status= "";$success= "";$scookies= "";Try { $dbname= "Root"; $dbpass= "Root"; $dbhost= "127.0.0.1"; $dbdatabase= "MySQL"; //Generate a connection $db _connect=mysql_connect($dbhost,$dbname,$dbpass); //Select a database to operate on mysql_select_db($dbdatabase,$db _connect); //Get query Results $strsql= "SELECT * from ' Go_member_addmoney_record ' where ' code ' = '$code' Limit 1 '; $result=mysql_query($strsql); //Loop Out Records while($row=Mysql_fetch_array($result)) { $status=$row[' Status ']; $scookies=$row[' Scookies ']; } //Freeing Resources Mysql_free_result($result); //Close Connection Mysql_close($db _connect); if($status= = "Paid"){ $success= "Success"; } Else{ $success= "Faild"; } Echo $success.";".$scookies;}Catch(Exception $e){}?>
Mysqli:
<?PHP$code=$_post[' Code '];$status= "";$success= "";$scookies= "";Try { $dbname= "Root"; $dbpass= "Root"; $dbhost= "127.0.0.1"; $dbdatabase= "MySQL"; //Generate a connection $db _connect=NewMysqli ($dbhost,$dbname,$dbpass,$dbdatabase); //Get query Results $strsql= "SELECT * from ' Go_member_addmoney_record ' where ' code ' = '$code' Limit 1 '; $result=$db _connect->query ($strsql); //Loop Out Records while($row=Mysqli_fetch_assoc($result)) { $status=$row[' Status ']; $scookies=$row[' Scookies ']; } //Freeing Resources $result-Close (); //Close Connection $db _connect-Close (); if($status= = "Paid"){ $success= "Success"; } Else{ $success= "Faild"; } Echo $success.";".$scookies;}Catch(Exception $e){}?>
PHP queries data using MySQL and mysqli connections