var pausecontent=new Array() pausecontent[0]= 'Coding Forums Web coding and development forums.' pausecontent[1]='Coding Forums Web coding and development forums.' pausecontent[2]='CSS Drive Categorized CSS gallery and examples.'
while($res = mysql_fetch_object($req)) { echo $res->id; echo $res->title; }
while($res = mysql_fetch_object($req)) { $id = $res->id; $title = $res->title; // je stocke mes infos dans mes variables }
var pausecontent=new Array() pausecontent[0]= '<?=$title?>' // et voici la syntaxe utilisée pour récupérer ma variable php dans ma fonction javascript.
<script> //les reste du script js var pausecontent=new Array(); <?php $i=0; while($res = mysql_fetch_object($req)) { //echo $res->id; //echo $res->title; echo 'pausecontent['.$i.']=\''.$res->title.'\'; '; $i++; } ?> </script>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question$i = 1; while($res = mysql_fetch_object($req)) { $texte[$i] = $res->text; //$texte[$i] = str_replace(" ","",$texte[$i]); $texte[$i] = str_replace("\r\n", " ", $texte[$i]); echo $texte[$i]; $i++; }