Hello,
I'm trying to retrieve data from mysql to a variable and have it return using a function.
This is what I have so far..any ideas? Thanks in advance.
I'm trying to retrieve data from mysql to a variable and have it return using a function.
This is what I have so far..any ideas? Thanks in advance.
Code:
function display_articles() {
$pid=$this->uri->segment(3, 0);
$query = "SELECT title from articles where pid='$pid'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$show_articles=$row[0];
return $show_articles;
}
}