Menu

#94 Improve documentation for cubrid_affected_rows()

open
nobody
None
5
2012-02-22
2012-02-22
Jira Trac
No

Please add an example on PHP manual for cubrid_affected_rows(), called with 1 parameter. It is not clear that the parameter should be the outcome of a query. For instance, this would work:

$conn = cubrid_connect('localhost', 33000, 'demodb', 'dba', '');
cubrid_execute($conn, 'DROP TABLE IF EXISTS insert_test');
cubrid_execute($conn, 'CREATE TABLE insert_test(first integer)');
cubrid_execute($conn, 'INSERT INTO insert_test(first) VALUES(1)');
cubrid_execute($conn, 'INSERT INTO insert_test(first) VALUES(2)');
#cubrid_execute($conn, 'DELETE FROM insert_test');
$cur = cubrid_execute($conn, 'UPDATE insert_test set first=33');
$r = cubrid_affected_rows($cur);
print_r($r);
print_r(\n);

Would print:

2

but if you call with cubrid_affected_rows($conn) shows a error:
Warning: cubrid_affected_rows(): supplied resource is not a valid CUBRID-Request resource in /home/cristiroma/workspace/joomla-2.5-cubrid/joomla/libraries/joomla/database/database/tests/test.php on line 21

Took me 1h to figure out that I've sent the wrong parameter.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.