I need some help cutting out a line from a path that’s returned from my database.
The results of “ImagePath” in the database return /share/images/Gif/XXX/XXXXXX/ (XX being filler for whatever is actually returned)
I need to cut off “/share/images/” from the results of ImagePath so I would just get /Gif/XXX/XXXXXX/
The reason is that this instance of the database is one way > updated from another server that has a different location for the images so I don’t really want to go through and delete those lines from the database since the next time it’s updated it would revert to the other path I just want to cut out those lines from the results.
<?php
define('INCLUDE_CHECK',1);
require "connect.php";
require_once("class.php");
mb_internal_encoding("UTF-8");
// $product_id = intval($_GET['product']); //no default
$UPC = intval($_GET['upc']); //no default
$result = mysql_query("SELECT ImagePath, AlphaName, brand_name, FullName, ingredients FROM Images, Products WHERE ImageType='gif' AND images.ProductID = products.ProductID AND ViewCode='CF' AND products.UPC = '$UPC'");
$count=mysql_affected_rows();
$objJSON=new mysql2json();
print(trim($objJSON->getJSON($result,$count)));
/* disconnect from the db */
@mysql_close($link);
?>
Well you can always do
substring:Or
replace, if yourImagePathvalues aren’t all the same: