trim() doesn't trim...
Posted: Mon Mar 24, 2003 9:17 am
Hi 2 all,
I wrote a script that gets all fields out of an MySQL table and trims the contents of them.
here is the script:
What's wrong with that script?
The content of the array is not trimmed at the end....
I hope you can helpt me
I wrote a script that gets all fields out of an MySQL table and trims the contents of them.
here is the script:
Code: Select all
<?php
$host=""; $user=""; $pass="";
$vk = mysql_connect($host, $user, $pass) or die ("Verbindung zum MySQL Server konnte nicht hergestellt werden");
$database="usr_web9_1";
mysql_select_db($database, $vk) or die ("Fehler bei der DB auswahl");
$sql_query = "SELECT * FROM csc_article ORDER BY id";
$result = mysql_query($sql_query, $vk) or die ("Fehler bei der auswahl!");
if($result) {
while($row = mysql_fetch_row($result)) {
$row[1] = chop($row[1]);
$row[2] = chop($row[2]);
$row[3] = chop($row[3]);
$row[4] = chop($row[4]);
$row[5] = chop($row[5]);
$row[6] = chop($row[6]);
$row[7] = chop($row[7]);
$row[8] = chop($row[8]);
$row[9] = chop($row[9]);
$row[10] = chop($row[10]);
$row[11] = chop($row[11]);
$row[12] = chop($row[12]);
$row[13] = chop($row[13]);
$update = "UPDATE csc_article SET category='$row[1]' product_number='$row[2]' desc_short='$row[3]' desc_long='$row[4]' spcial='$row[5]' image_small='$row[6]' image_big='$row[7]' price_a='$row[8]' price_b='$row[9]' price_c='$row[10]' price_d='$row[11]' price_e='$row[12]' tax_rate='$row[13]' WHERE id='$row[0]'";
echo "|".$row[1]."|<br>";
mysql_query($update, $vk);
}
}
else {
echo "FEHLER<br>".mysql_error($vk)."<br>";
}
?>The content of the array is not trimmed at the end....
I hope you can helpt me