I'm kinda new to making my own functions and i'm having some trouble...
I made this function in a php script I included
code:
function query_db($table){
$data = mysql_fetch_array(mysql_query("SELECT * FROM `".$table."` WHERE id=".$_GET['id']));
return $data;
}
and then I wanted to execute it, and typed
code:
query_db("imdb_data_title");
after the including, but that didn't work, later a friend helped a little and we managed to make it work like this:
code:
$data = query_db("imdb_data_title");
If somone knows a better way of doing that please tell me
Then another thing that doesn't work yet...
I have another function in the same script
code:
function link_rewrite(){
//Voor op de profielen worden de films veranderd door links
//actor
$actor = str_replace("Paris Death Monkeys (2004)","<a href=\"title.php?id=2\">Paris Death Monkeys (2004)</a>", $actor);
$actor = str_replace("Ameland: The Movie (2003)","<a href=\"title.php?id=1\">Ameland: The Movie (2003)</a>", $actor);
$actor = str_replace("\"Bredero\" (2004)","<a href=\"title.php?id=0\">\"Bredero\" (2004) </a>", $actor);
//writer
$writer = str_replace("Paris Death Monkeys (2004)", "<a href=\"title.php?id=2\">Paris Death Monkeys (2004)</a>", $writer);
$writer = str_replace("Ameland: The Movie (2003)", "<a href=\"title.php?id=1\">Ameland: The Movie (2003)</a>", $writer);
$writer = str_replace("\"Bredero\" (2004)", "<a href=\"title.php?id=2\">\"Bredero\" (2004)</a>", $writer);
}
It's a little longer but they are all str_replaces with other names
then when I wanted to execute the function I typed this
code:
link_rewrite();
But it doesn't work
Can someone please help me with this??
TIA...