Home » Open Source » Programming Interfaces » How to give PHP argument to oracle select? (oracle 8.0.5.0.0)
How to give PHP argument to oracle select? [message #361129] Tue, 25 November 2008 02:13 Go to next message
tomukaz
Messages: 16
Registered: December 2007
Junior Member
Hi,

I have a PHP script with oracle script in it, like:

<?php
.. some php code...

$aaa=666;
$query="select something from somewhere where ... and xxx=$aaa and...";

... countinue php code...
?>


Of course oracle can't understand $aaa, so how do I give it to oracle? In MySQL there's something like addslashes:
$sql = "SELECT * FROM users WHERE user='".addslashes($_REQUEST['user'])."' AND pass='".md5($_REQUEST['pass'])."'"


How do I write this in oracle?
Re: How to give PHP argument to oracle select? [message #361142 is a reply to message #361129] Tue, 25 November 2008 03:02 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
There is no difference but don't concatenate string, use bind variables:
$query="select something from somewhere where ... and xxx=:bind1 and...";
Then parse and bind your statement.

Regards
Michel
Previous Topic: Oracle Lite + ADO.NET + C#
Next Topic: MS Access query to Oracle table slower than query to MS SQL Server
Goto Forum:
  


Current Time: Thu Mar 28 12:26:36 CDT 2024