PHP + ORACLE Database Select Statement, Help Me

A

Anonymous

Guest
Hi,
I don't understand your query, and the code you posted cannot produce the error you posted. However, it is worth noting that while mysql can use lowercase column names, with oracle you MUST use UPPERCASE to retrieve the column values from the row.
For example:
Code:
// You can use lowercase for the column in the sql statement:
select 'foo' as city_name from dual;
But once you have the row, you MUST use uppercase.
Code:
print $row['city_name'] // Fails with Notice: Undefined index: city_name in ...
print $row['CITY_NAME'] // Works, outputs 'foo'
If this is your first time with oracle and php, I suggest you try a very simple example, and post the results if it fails.
 
Your query is too complex to review. Post an example of a query using just one table and one column. If that works, we can go from there. If it fails, we can try to fix it.
 
Should the line...
Code:
echo "".$results ['CITY'][$i]."";
Be
Code:
echo "".$results ['CITY_NAME'][$i]."";

Also - married_statusr probably should be married_status.

You can simplify your group by to...
Code:
group by a.no_city,a.no_region

But probably order by...
Code:
order by getnamecity(a.no_city,a.no_region)
to get in alphabetical order (If that's what you want).
 
Back
Top