This function:
function queryDataConnec tion($query) {
return mysql_query($qu ery) or die("Oops");
}
doesn't seem to properly return the result set, since this script:
$resultSet = queryDataConnec tion("select * from articles where
id=$id");
if (mysql_num_rows ($resultSet) == 1) {
$result = mysql_fetch_arr ay($resultSet);
} else {
$result = FALSE;
}
gives the following warning:
Warning: mysql_num_rows( ): supplied argument is not a valid MySQL
result resource.
Simply replacing the call to queryDataConnec tion() with the equivalent
(?) call to mysql_query() makes the script work properly. So, why
doesn't the function work? Is there something funny about resources
that isn't covered in the manual?
Thanks in advance,
-- Craig Putnam
function queryDataConnec tion($query) {
return mysql_query($qu ery) or die("Oops");
}
doesn't seem to properly return the result set, since this script:
$resultSet = queryDataConnec tion("select * from articles where
id=$id");
if (mysql_num_rows ($resultSet) == 1) {
$result = mysql_fetch_arr ay($resultSet);
} else {
$result = FALSE;
}
gives the following warning:
Warning: mysql_num_rows( ): supplied argument is not a valid MySQL
result resource.
Simply replacing the call to queryDataConnec tion() with the equivalent
(?) call to mysql_query() makes the script work properly. So, why
doesn't the function work? Is there something funny about resources
that isn't covered in the manual?
Thanks in advance,
-- Craig Putnam