Page 1 of 1

escaping text problem ?

Posted: Fri May 30, 2008 2:50 am
by fresbee
Hello everybody,
pescando dati dal db
i'm getting datas from DB in this way :

'USA.Milwaukee.2005.
Abbey','USA.Milwaukee.2005.
Adam','USA.Milwaukee.2005.
Christine','USA.Milwaukee.2005.
Dan','USA.Milwaukee.2005.
Dan','USA.Milwaukee.2005.
Grant','USA.Milwaukee.2005.
Kyle','USA.Milwaukee.2005.
Molly','USA.Milwaukee.2005.
Paul'

i would like to be just on 1 line !!

the code i'm using is :

$query="SELECT DISTINCT immagini.caption FROM immagini JOIN projects WHERE (immagini.idprogetto = projects.idprogetto AND immagini.idprogetto = '$p')";
$risultato=mysql_query($query,$link);

while ($riga = mysql_fetch_row($risultato)) {
if ($caption=="") {
$caption .= "'".$riga[0]."'";
} else {
$caption .= ",'".$riga[0]."'";
}
}
var photos = [<?PHP echo $caption; ?>];


The " var photos" is part of a javascript code where i get the query result

Can you please help me to fix this ?

Thanks a lot in advance.

Best,

F.