Error Handling Issuing Queries and Processing the Results

NULL { val is a NULL value } Alt ernat ively, use isset : if isset val { val is a NULL value } At t his point , enough m achinery is present in t he class int erface t hat it is usable for writ ing script s t hat issue queries and process t he result s: instantiate connection object include Cookbook_DB_Access.php; conn = new Cookbook_DB_Access; issue query that returns no result set query = UPDATE profile SET cats=cats+1 WHERE name = Fred; conn-issue_query query; print conn-num_rows . rows were updated\n; issue queries that fetch rows, using each row-fetching method query = SELECT id, name, cats FROM profile; conn-issue_query query; while row = conn-fetch_row print id: row[0], name: row[1], cats: row[2]\n; conn-issue_query query; while row = conn-fetch_array { print id: row[0], name: row[1], cats: row[2]\n; print id: row[id], name: row[name], cats: row[cats]\n; } conn-issue_query query; while row = conn-fetch_object print id: row-id, name: row-name, cats: row-cats\n;

2.10.8 Quoting and Placeholder Support