Menu

#97 [PHP]cubrid_fetch_field will affect the cursor position which will influence the results of cubrid_fetch

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

[cubrid_fetch_field will|http://www.php.net/manual/en/function.cubrid-fetch-field.php] will put the cursor position at the end of the result set. This should not be the function of this method. For example:
{panel}
?php

$conn = cubrid_connect ('localhost', 33000, 'demodb', 'public', '');

$req = cubrid_execute ($conn, 'SELECT * FROM code');

$row = cubrid_fetch ($req);

echo The first row:\n;
print_r ($row);

$field = cubrid_fetch_field ($req);
print_r ($field);

$row = cubrid_fetch ($req);

echo second row\n;
print_r ($row);
?

{panel}

The output will be:
{panel}
The first row:
Array
(
[0] = X
[s_name] = X
[1] = Mixed
[f_name] = Mixed
)
stdClass Object
(
[name] = s_name
[table] = code
[def] =
[max_length] = 1
[not_null] = 0
[primary_key] = 0
[unique_key] = 0
[multiple_key] = 1
[numeric] = 0
[blob] = 0
[type] = char(1)
[unsigned] = 0
[zerofill] = 0
)
second row
{panel}

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.