ciao a tutti
ho dei problemi con gli apici,ho un select che mi fornisce le variabili
Codice PHP:
//query per il recupero delle info dettagliate sul cs
$sql_dettaglio="select * from camperservice where id=$id_cs";
$result_dettaglio=mysql_query($sql_dettaglio,$dbconn);
$row_dettaglio=mysql_fetch_object($result_dettaglio);
ma quando incontra gli apici mi va in palla : esempio L'Aquila come posso farla stampare giusto?
visto che nella pagina che mostra tutti i risultati (che viene prima di questa) me la mostra giusta?
Codice PHP:
<?php
include("include/connector.inc");
$ricerca = $_POST['ricerca'];
if($ricerca=="vero"){
$localita = strtolower($_POST['localita']);
$citta = strtolower($_POST['citta']);
$regione = strtolower($_POST['regione']);
$stato = strtolower($_POST['stato']);
$cs = $_POST['CS'];
$aa = $_POST['AA'];
$ps = $_POST['PS'];
$camper_stop = $_POST['CAMPER-STOP'];
$wifi = $_POST['WI-FI'];
$gratis = $_POST['GRATIS'];
$pagamento = $_POST['PAGAMENTO'];
//se ho indicato regione="tutte"... tolgo il valore dal campo regione
if($regione == "all"){
$regione = "";
}
if($citta == "all"){
$citta = "";
}
//a seconda dei parametri cremo condizioni per sql
if($localita!="") $where_localita = "and localita='$localita'";
if($citta!="") $where_citta = "and citta='$citta'";
if($regione!="") $where_regione = "and regione='$regione'";
if($stato!="") $where_stato = "and stato='$stato'";
if($cs!="") $where_cs = "and cs=1";
if($aa!="") $where_aa = "and aa=1";
if($ps!="") $where_ps = "and ps=1";
if($camper_stop!="") $where_camper_stop = "and camper_stop=1";
if($wifi!="") $where_wifi = "and wifi=1";
if($gratis!="") $where_gratis = "and gratuito=1";
if($pagamento!="") $where_pagamento = "and pagamento=1";
//sql per recuperare elenco camperservice con condizioni in ingresso....
$sql="select * from camperservice where id=id $where_localita $where_citta $where_regione $where_stato $where_cs $where_aa $where_ps $where_camper_stop $where_wifi $where_gratis $where_pagamento ";
//print "-$sql-";
//print ("-$sql-
");
$result_sql=mysql_query($sql,$dbconn);
if($result_sql!=""){
print "<table width='100%'>";
//mostro elenco risultati
while($row_sql=mysql_fetch_object($result_sql)){
//stringa di descrizione del cs
$tx_indirizzo = " $row_sql->localita, $row_sql->citta ";
if($row_sql->cs==1) $comp_cs = "[b]CS[/b]";
else $comp_cs = "";
nel database viene visualizzata giusta senza slesh ne niente (L'Aquila,l'astronauta)
grazie