Update query question
Posted: Wed Nov 02, 2005 11:50 am
feyd | Please use
The echo $content shows the html-code and pictures are visable, so the str_replace function worked. But the update query didn't work. What am i doing wrong? Any suggestion?
Thx for any help
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I got a table which i use to store html-code. In this code there are url of pictures with capital letters. Now i changed the directories of some of the picture folders (i took out the capitals). Since i use a unix server the pictures in the html-code will be visable and errors occur.
Now i what to write a script that replaces the capitals in the urls in the html codes. Everthing is working correct untill the update query.Code: Select all
<?php
$search= "Media";
$replace= "media";
$query_Recordset_check_content = "SELECT * FROM $tabel_content WHERE content LIKE '%".$search."%'";
$Recordset_check_content = mysql_query($query_Recordset_check_content, $connect) or die(mysql_error());
$row_Recordset_check_content = mysql_fetch_assoc($Recordset_check_content);
$totalRows_Recordset_check_content = mysql_num_rows($Recordset_check_content);
do{
$content = $row_Recordset_check_content['content'];
$content_id = $row_Recordset_check_content['id'];
$content = str_replace($search, $replace, $content);
echo $content;
mysql_query("UPDATE $tabel_content SET content = '".$content."' WHERE id = '".$content_id."'");
// mysql_query("UPDATE $tabel_content SET content = '$z' WHERE id = '$content_id'");
} while($row_Recordset_check_content = mysql_fetch_assoc($Recordset_check_content));
?>Thx for any help
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]