View more random threads:
- Variables in function names in php 2011
- Php Transaction 2011
- php basic tags to start with
- Php and Mysql new script of Auto Tweet Script 2011
- Need php script for online dictionary with SEO PACKAGE and...
- regular expression
- PHP with Javascript in cron 2011
- Banner Exchange PHP PHP SCRIPTS
- PHP Login page and MySql 2011
- Students should share php and mysql knowledge with each...
Code:$rollbackStatus=False; $link = mysql_connect(dbHost, dbUser, dbPassword); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(dbDatabase); if(!$db) { die("Unable to select database"); } mysqli_autocommit($link, FALSE); $selectQuery1 ="Select clientName From tblClient Where clientName='".$clientName."'"; $result1 = mysql_query($selectQuery1); if ($result1 !== TRUE) { mysqli_rollback($link); $rollbackStatus=True; } $row1 = mysql_fetch_array($result1, MYSQL_ASSOC); $n1 = mysql_num_rows($result1); if($n1>0) { $status="<span class=\"statusFailed\">: Client ".$clientName." Alread Exist.</span>"; } else { $insertQuery1 = "Insert Into tblClient Set ". "clientName='".$clientName."', ". "clientContactPerson='".$clientContactPerson."',". "clientAddress='".$clientAddress."',". "clientContactNumber='".$clientContactNumber."',". "clientStatus='a'"; $result2 = mysql_query($insertQuery1,$link); if ($result2 !== TRUE) { $status="<span class=\"statusFailed\">: Error adding adding Client:" . mysql_error() . "</span>"; mysqli_rollback($link); $rollbackStatus=True; } else { $status="<span class=\"statusOk\">: Client ".$clientName." Added Succesfully.</span>"; } } if($rollbackStatus=="False") { mysqli_commit($link); } mysqli_close($link); }
Sponsored Links
There are currently 1 users browsing this thread. (0 members and 1 guests)