mrblonde100
Technical User
Hi all,
I hope you can help me; I’m very new to PHP but managed to pick up a fair bit over the past couple of weeks. Although I have come across a problem that I can’t seem to resolve.
I'm trying to extract some specific data from my MYSQL database using PHP, and then feed it into Flash. The Flash content then dynamically updates its text fields depending on the content of the MYSQL database.
It has taken me days to get this far and I’m finally there. Although a new problem has stumped me. The Flash is replicating the MYSQL perfectly, but including the HTML tags from within the record. These tags are being passed by the PHP.
I need the tags to remain within the original database record, as they format HTML content on other pages within the site, so removing them at source is not an option. The tags are the <p> and </p> content tags.
I’m trying to strip them out during the PHP process before the content is picked up by Flash.
I have tried strip_tags() but can’t seem to get it to work properly. Adding this function and running it on the QUERY string causes the echo function to break. I may have it in the wrong place.
I think I’m nearly there but just can’t figure it out.
I have pasted my code below, this code is working perfectly and assigning a variable to each of my extracted elements which is then assigned to Flash. The $intro variable/query is the variable that contains the tags.
The content that is being extracted is in this example format:
<p>Hello World, how are you today</p> is it possible to strip these tags out and pass Flash the rest?
Any advice of guidance would be gratefully received. I have researched this extensively and looked into the strip_tags function adding this function causing the $Intro write to fail.
Many thanks!
My PHP code is below:
<?php
$connect = mysql_connect("HOST", "USERNAME", "PASSWORD");
mysql_select_db("DATABASE");
$result = mysql_query("SELECT price, id, image1, state, locality, listdate FROM record WHERE state = 'alpha' AND featured = 1 ORDER BY listdate");
$intro = mysql_query("SELECT introtext FROM jos_content WHERE catid = 929 AND ordering = 2");
$cant = 0;
while($row=mysql_fetch_array($result)){
echo "locality$cant=$row[locality]&price$cant=$row[price]&propid$cant=$row[id]&image1$cant=$row[image1]&area$cant=$row[state]&";
$cant++;
}
while($row=mysql_fetch_array($intro)){
echo "introtext$cant=$row[introtext]&";
$cant++;
}
echo "cant=$cant";
?>
I hope you can help me; I’m very new to PHP but managed to pick up a fair bit over the past couple of weeks. Although I have come across a problem that I can’t seem to resolve.
I'm trying to extract some specific data from my MYSQL database using PHP, and then feed it into Flash. The Flash content then dynamically updates its text fields depending on the content of the MYSQL database.
It has taken me days to get this far and I’m finally there. Although a new problem has stumped me. The Flash is replicating the MYSQL perfectly, but including the HTML tags from within the record. These tags are being passed by the PHP.
I need the tags to remain within the original database record, as they format HTML content on other pages within the site, so removing them at source is not an option. The tags are the <p> and </p> content tags.
I’m trying to strip them out during the PHP process before the content is picked up by Flash.
I have tried strip_tags() but can’t seem to get it to work properly. Adding this function and running it on the QUERY string causes the echo function to break. I may have it in the wrong place.
I think I’m nearly there but just can’t figure it out.
I have pasted my code below, this code is working perfectly and assigning a variable to each of my extracted elements which is then assigned to Flash. The $intro variable/query is the variable that contains the tags.
The content that is being extracted is in this example format:
<p>Hello World, how are you today</p> is it possible to strip these tags out and pass Flash the rest?
Any advice of guidance would be gratefully received. I have researched this extensively and looked into the strip_tags function adding this function causing the $Intro write to fail.
Many thanks!
My PHP code is below:
<?php
$connect = mysql_connect("HOST", "USERNAME", "PASSWORD");
mysql_select_db("DATABASE");
$result = mysql_query("SELECT price, id, image1, state, locality, listdate FROM record WHERE state = 'alpha' AND featured = 1 ORDER BY listdate");
$intro = mysql_query("SELECT introtext FROM jos_content WHERE catid = 929 AND ordering = 2");
$cant = 0;
while($row=mysql_fetch_array($result)){
echo "locality$cant=$row[locality]&price$cant=$row[price]&propid$cant=$row[id]&image1$cant=$row[image1]&area$cant=$row[state]&";
$cant++;
}
while($row=mysql_fetch_array($intro)){
echo "introtext$cant=$row[introtext]&";
$cant++;
}
echo "cant=$cant";
?>