Jump to content

Php And Oracle


smartalco
 Share

Recommended Posts

I have done quite a bit of PHP with MySQL DBs, for which PHP has dozens of functions to help handle. Not so much for Oracle from what I can tell. I'm now working on adding some functionality to an app. The following is how it currently deals with Oracle queries

$query = "SELECT events.category_id, TO_CHAR(events.event_date, 'MON') as event_month"; //more to this I cut out$sql->query($query);while($sql->fetch()) { 	$category_id	=	$sql->results["CATEGORY_ID"];	$date_month	=	$sql->results["EVENT_MONTH"];

Just iterating through each item of a single row and writing them to variables.That works just fine for SELECT statements that only return a single row, what I'm doing now returns multiple rows... and I have no idea what to do.I'm want to write to an array, first level is each row, second level is each item from the row.Can anyone help with this?

Link to comment
Share on other sites

Do you not know how to build an array? That's all you're trying to do, right? Create an array before the while loop to hold the record set, and create another array inside the loop to hold the current row. At the end of the loop after building the row array, add it to the record set array. Which part of that are you having problems with?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...