0

How can i rename a part from a cell in a data table

i have the folowing table

id -------------- 35
albumdescription -------------- test 1
name -------------- 001.jpg
type -------------- image
size -------------- 97182
location -------------- test 1/thumbs/thumb001.jpg
location1 -------------- test 1/slides/001.jpg

I can change albumdescription and folder with

if(isset($_POST['change_name_alb_wein']))
{
	$namealbum= $_POST['change_album_name'];
	$idalb=$_POST['id_wein_album'];	
	$namechange = $_POST['andere_namen_wein_album'];
	$change_name = trim($namechange);

	if (file_exists($namealbum)) {
	rename ($namealbum, $change_name); 

	$db="blabla";
$connect = mysql_connect("localhost","blabla","blabla");
if (! $connect)die("Couldn't connect to MySQL");
mysql_select_db($db , $connect)or die("Couldn't open $db: ".mysql_error());


mysql_query(" UPDATE narr_weinachtfeier SET albumdescription='$change_name','location=' WHERE id='$idalb");

But how can i change
location test 1/thumbs/thumb001.jpg
location1 test 1/slides/001.jpg

everywhere location and location1 begins with test1/thumbs/thumb001.jpg

i only want to change - test 1 - into something else shal we say - album 1/thumbs/thumb001.jpg - and for location1 into album 1/slides/001.jpg.

thanks in advice John

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by johnnyd1963
0

carefully use this code, before running this query, keep back up of table

mysql_query("UPDATE narr_weinachtfeier SET albumdescription='$change_name',
location=  concat('$change_name',substr(location,instr(location,'/'))) ,
location1=  concat('$change_name',substr(location1,instr(location1,'/')))
WHERE id='$idalb'"
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.