Forum Moderators: coopster
I am beggineer to the Oracle database and php. I have few question regarding my code that I have written to search from oracle database table and then prints out the information. Here is my code.
if (preg_match("/^[a-fA-F][0-9]{1,8}$/",$entry))
{
$entry = strtoupper($entry);
$dec = hex2dec($entry);
$conn = OCILogon('databasename', 'login', 'password') or die(print_r(ocierror()));
$query = "SELECT h2wt.radioaddress, h2wt.disabled, h2msisdn.devicetype, h2msisdn.deviceosversion as OS, h2msisdn.deviceappversion as APP, h2msisdn.upddate, h2msisdn.imei, h2wt.classmask FROM h2msisdn, h2wt WHERE h2wt.radioaddress like '%$dec'";
$stmt = OCIparse($conn, $query) or die(print_r(ocierror()));
OCIexecute($stmt);
echo "<link rel='stylesheet' href='./etr.css' type='text/css'>";
echo "<table border='1' width='100%'>";
while(OCIFetch($stmt))
{
echo "<tr>";
echo "<td>";
$ra = OCIResult($stmt, "RADIOADDRESS");
echo "$ra";
echo "</td> ";
echo "<td>";
echo (OCIResult($stmt, "DISABLED") == 0? "Enabled" : "Disabled");
echo "</td> ";
echo "<td>";
echo str_replace("-", " - ", OCIResult($stmt, "DEVICETYPE"));
echo "</td> ";
echo "<td>";
echo get_os_string(OCIResult($stmt, "OS"), $ra);
echo "</td>";
echo "<td>";
echo get_app_string(OCIResult($stmt, "APP"), $ra);
echo "</td>";
echo "<td nowrap>";
echo OCIResult($stmt, "UPDDATE");
echo "</td>";
echo "<td>";
echo OCIResult($stmt, "IMEI");
echo "</td>";
getClassChecks(OCIResult($stmt, "CLASSMASK"));
// getClassList(OCIResult($stmt, "CLASSMASK"));
echo "</tr>\n";
}
echo "</table>";
}else {
echo "Invalid PIN";
}
}
Here is liltte explaination what is code suppose to do. I have two table in the database called 'h2wt and h2msisdn. I have some info in the h2wt table and some info in the h2msisdn table.
What I have to do is now that i have to search for a PIN # WHICH CONTAINS 8 CHARACTERS, and it's stored in the database as decimal so..that's why am converting to decimal. When the user enters the PIN # into the search box; The search engine has to go into the database and see if those PIN # charaters are matching. If it does then it has to prints out the PIN # and it's characteristics--LIKE WHETHER THIS PIN NUMBER IS DISABLED OR ENABLE, IT'S OS VERSION APP and SO ON.
Could some please tell me where I am making mistake.
Thanks.
Suresh