i've been trying while no avail have function selectrowbyname returns mysql array result , want validate if returns record or not it's not working. code is:
$fileinfo = selectrowbyname("select id,mime,iconimg tblattachment_filetypes active=1 , extension = '".$extension."'"); // want validate $fileinfo got filled before trying fill below variables avoid errors
$filetype = $fileinfo[1]; $filetypeid = $fileinfo[0]; $fileicon = $fileinfo[2]; i have tried using empty, isset , array count functions don't seem work. query might not return records , $fileinfo might not filled , want validate that.
selectrowbyname code is:
function selectrowbyname($query) { global $server,$dbusername,$dbpassword,$db,$connection,$dbcon; $thequery = mysql_query($query); $result = mysql_fetch_array($thequery) or die(mysql_error()); return $result; }
inside selectrowbyname function may use 1 of following (depending on way access mysql):
mysql_num_rows() mysqli_stmt_num_rows() pdostatement::rowcount() to number of rows returned.
Comments
Post a Comment