Hi,
I have a bug in a program I wrote and cannot solve it. The problem is probably not very big for a good programmer though. I have a concert database in mysql. Visitors can submit concerts to this database by a simple form written in php. The database can be seen on the web in php too. This all works fine. I also port my database to wap. It's possible to make wml (the wap language) in php, so I used this language to port my mysql database entries to wml. There is however one bug. If people submit bands to my concert list they often use "&". For example This Band & That Band. This works fine in the database and in php, but not in wml/wap. I guess I need a string replacement function to solve this bug. I read the php manual and everything and tried various lines of code, but I cannot get around it. Can someone help? It's probably really easy to make a string replacement in php isn't it?
My wap page is at:
http://www.wreckingpit.com/wap
The code where I need the string replacement is:
<?php
$naamtabel="xxx";
$naamuser="xxx";
$password="xxx";
$naamdatabase="xxx";
mysql_connect ("localhost", $naamuser, $password);
mysql_select_db ($naamdatabase);
$result = mysql_query ("SELECT * FROM $naamtabel
WHERE country = 'holland'
ORDER BY year, month, day
");
if ($row = mysql_fetch_array($result)) {
do {
print "<p><small>";
print $row["day"];
print "-";
print $row["month"];
print "-";
print $row["year"];
print "<br/>";
print $row["city"];
print "</small><br/>";
print $row["bands"];
// I need to make some adjustments here
print "<small><br/>";
print $row["venue"];
print "<br/>";
print $row["phone"];
print "</small><br/>";
print "<br/>";
print "</p>";
} while($row = mysql_fetch_array($result));
} else {print "<p>Sorry no records were found</p>";}
?>
// My Idea was: I need to rewrite the code that it reads the string of $row[band] in such a // way that any possible & is written as a \& or a + or as a And. How do I do that?