I'm having problems executing the code in this function. The code works but when I encapsulate it and call the function select_news('main_news') , it doesn't work. Could anyone help please?
function select_news($news_table){
global $url_page_num,$conn;
$result= mysql_query("SELECT id,company_id,title,DATE_FORMAT(date, '%D %M %Y'),country,article,main_image,image_align FROM $news_table WHERE id=$url_page_num",$conn);
while ($row = mysql_fetch_array($result))
{ $id = $row['id'];
$company_id = $row['company_id'];
$title = $row['title'];
$date = $row['3'];
$news_country =$row['country'];
$article =$row['article'];
$main_image = $row['main_image'];
$image_align=$row['image_align'];
$title=trim($title);
return;
}