将PHP/Mysql迁移到PHP/Oracle


Migrate PHP/Mysql to PHP/Oracle

如何将PHP/Mysql代码转换为PHP/Oracle。这是我的代码。

$query = "SELECT name FROM employee WHERE name = '".$userName."' and email = '".$userMobile."' and salary = '".$userSalary."' and deductions = '".$userDeductions."'";
$sql = mysql_query($query);
$recResult = mysql_fetch_array($sql);
$existName = $recResult["name"];
if($existName=="") {
$insertTable= mysql_query("insert into employee (name, email, salary, deductions) values('".$userName."', '".$userMobile."', '".$userSalary."', '".$userDeductions."');");

PDO可能是一种解决方案。但是如果你想继续现有的,那么你得到的问题是什么?,对我来说似乎是简单的语法。但由于PDO是一个非常好的/DB独立的方式这样做,因此我建议,你可以在http://php.net/manual/en/ref.pdo-oci.php找到一个例子。顺便说一句,这是一个粗糙的东西,我可以做(没有得到测试),请检查它。更多信息可以在select record from oracle

中找到。
$query = "SELECT name FROM employee WHERE name = '".$userName."' and email = '".$userMobile."' and salary = '".$userSalary."' and deductions = '".$userDeductions."'";
$sql = oci_parse($conn,$query);
oci_execute($sql);
$existName = oci_result($sql, 1);
if($existName=="") {
#...
}