i am creating a function that loops through records and i want to return the array of items
if(!function_exists("TicketAttachments")) {
function TicketAttachments($update_sequence) {
global $conn, $pdo_conn;
$results = array();
$sql="SELECT * from ticket_updates where ticketnumber = '".$update_sequence."' and type = 'attachment' ";
$rs=mysql_query($sql,$conn);
while($result=mysql_fetch_array($rs)) {
$results["link"] = 'media/ticket_attachments/'.$result["notes"];
$results["name"] = $result["notes"];
}
return $results;
}
}
i am calling it here:
$attachments = TicketAttachments($TicketUpdate["sequence"]);
foreach($attachments as $att) {
echo $att["name"];
}
but this is echoing h5
whereas name = 55388-20150929124302-screen dump 28092015.docx