October 23rd, 2003, 01:13 PM
mysql_result() --> to postgreSQL?
Hey there guys,
I'm migrating a set of PHPs from MySQL to postgreSQL. However, I still haven't found the answer to my question: what's the equivalent of the mysql_result() command in postgreSQL?
How should I rewrite that for postgreSQL?
Thanks a lot.
October 23rd, 2003, 06:14 PM
RTF PHP M!
pg_fetch_result(resource result, int row, mixed field)
October 23rd, 2003, 08:18 PM
there are many different ways also
I like the fetch_array the best. Depends on whay you're doing, and also which version of php you're going to use
October 24th, 2003, 08:59 AM
Yes, but fetching a scalar result is a logically different operation from these other functions you link to.
Specifically, mysql_result and pg_fetch_result allow you to simply "get" one value from a query without messing around with loops or arrays--nice for one-liners like:
$sales_total = pg_fetch_result(pg_query($conn, "SELECT SUM(amount) FROM sales_history"),0,0);