Unstoppable Domains

Small help needed on Php

Spacemail by SpaceshipSpacemail by Spaceship
Watch

baris22

Established Member
Impact
1
this is th code:

PHP:
<td><textarea name="fullpage[]" cols="140" rows="16" id="fullpage"><?=stripslashes ($rows['fullpage']) ?></textarea></td>

PHP:
<?phpif($Submit){
for($i=0;$i<$count;$i++){
$sql1="UPDATE $tbl_name SET title='$title[$i]', fullpage='$fullpage[$i]' WHERE id='$id[$i]'";
$result1=mysql_query($sql1);
}
}
if($result1){
echo "<meta http-equiv=\"refresh\" content=\"0\">";
}
mysql_close();?>

all i want to do is use str_replace to replace "</td>" with " </td>" on fullpage='$fullpage[$i]'

Thanks for help.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Code:
$sql1="UPDATE $tbl_name SET title='$title[$i]', fullpage='".mysql_real_escape_string(str_replace('</td>', ' </td>', $fullpage[$i]))."' WHERE id='$id[$i]'";

You need the mysql_real_escape_string since $fullpage is user input. You should probaby be using $_GET/$_POST/$_REQUEST instead, e.g.

Code:
$sql1="UPDATE $tbl_name SET title='$title[$i]', fullpage='".mysql_real_escape_string(str_replace('</td>', ' </td>', $_REQUEST['fullpage'][$i]))."' WHERE id='$id[$i]'";
 
Last edited:
0
•••
qbert220 said:
Code:
$sql1="UPDATE $tbl_name SET title='$title[$i]', fullpage='".str_replace('</td>', ' </td>', $fullpage[$i])."' WHERE id='$id[$i]'";

what about if i want to replace "<br/>" with " <br />" as well as </td>

thanks
 
0
•••
baris22 said:
what about if i want to replace "<br/>" with " <br />" as well as </td>
Code:
$sql1="UPDATE $tbl_name SET title='$title[$i]', fullpage='".mysql_real_escape_string(str_replace('<br/>', ' <br />', str_replace('</td>', ' </td>',  $_REQUEST['fullpage'][$i])))."' WHERE id='$id[$i]'";
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back