大家好我有一个MySql的小问题,基本上我从一个名为addressone的表中提取一个变量,它是varchar 255!我想要实现的目标是用 + 替换单词之间的空格,但由于某种原因它没有这样做!我有 2 个页面,一个叫做 path.php,另一个叫做谢谢,我有这个......
$notokinarray = array(' ');
$okinarray = array('+');
$addressone = $row["addressone"];
$addressone = str_replace($notokinarray, $okinarray, $addressone);
然后我在那个页面的 html 中有这个
<select name="somesite" id="somesite">
<option value="">Please Choose</option>
<option value="yes">Yes</option>
<option value="no">No</option></select>
http://www.somesite.com/post.php?&field4=<?php echo '$addressone';?>
带有一个提交按钮到 Thanks.php
在我的Thanks.php页面上我有这个......
$somesite = $_POST['somesite'];
$sql = mysql_query("SELECT * FROM myMembers WHERE id='$id' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$addressone = $row["addressone"];
}
if ($somesite == "yes") {
$somesite = '<iframe src="http://www.somesite.com/post.php?&field4=<?php echo '$addressone';?> width="1" height="1"></iframe>';
} else {
$somesite = '';
}
echo
' . $somesite . '
http://www.somesite.com/post.php?&field4=<?php echo '$addressone';?>
exit();
?>
据我所知,我的所有空间都应该用 + 符号替换,但由于某种原因它不是,有人可以帮忙吗?
问候,菲利普
更新
我现在要采取不同的策略,并尝试在用户注册时放置 +,但它仍然没有好处!看一下这个.....
$sql = mysql_query("UPDATE myMembers SET field = REPLACE(field, ' ', '+'");
$sql = mysql_query("INSERT INTO myMembers (title, firstname, lastname,username, gender, birthday, email, password, housenumber, addressone, addresstwo, county, city, country, postcode, phone, ipaddress, sign_up_date)
VALUES('$title','$firstname','$lastname','$username','$gender','$full_birthday','$email1','$db_password', '$housenumber','$addressone','$addresstwo', '$county', '$city', '$country','$postcode','$phone','$ipaddress', now())")
or die (mysql_error());