I've been trying to do this for a while but to no avail basically I have a function SelectRowByName that returns the mysql array result and I want to validate if it returns a record or not but it's not working. My code is:
$fileInfo = selectRowByName("SELECT ID,Mime,IconIMG FROM tblattachment_filetypes WHERE Active=1 AND Extension = '".$extension."'");
// I want to validate that $fileInfo got filled before trying to fill the below variables to avoid errors
$fileType = $fileInfo[1];
$fileTypeID = $fileInfo[0];
$fileIcon = $fileInfo[2];
I have tried using empty, isset and array count functions but they don't seem to work. Basically the query might not return any records and $fileInfo might not be filled and I want to 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;
}