I would like to implement dynamicaly generated headers for a webpage and I am stucked on the mySQL query, better said I don't understand the definition of one variable.
For the start:
each php page starts with code similar to this:
Code: Select all
<?php
$sID='x-y-z';
?>By using this definition it was possible to use following code:
Code: Select all
<img src="/img/imgname_<?=$sID[0]?>_<?=$sID[1]?>_<?=$sID[2]?>.jpg"_________________
To my problem:
I would like to use the $sID='x-y-z' variable content in an mySQL query to get data out of the database for specific pages based on its $sID value in this way:
Code: Select all
$query = 'SELECT title, description FROM meta WHERE siteID = $sID';
$results = mysql_query($query);
while ($line = mysql_fetch_assoc($results)) {
$title = $line['title'];
$description = $line['description'];
}I coulnt find any info on the variable definition with the dashed value, when I want to output it to screen using echo, I just get output: "Array"
Anyone from you have an idea how this kind of variable is working?
EDIT>>> I forgot to add one line which I found in one of the included php files:
Code: Select all
$sID = explode ("-", $sID);