Jump to content

[SOLVED] remove   from my string


dazzclub

Recommended Posts

Hi guys and girls..

 

I have a string in my database table that looks like this my name Is Darren

 

I would like to retrieve string but remove the   and have it displayed like this myNameIsDarren.

 

Here is my code which simply retrieves it

function trimPDFwhiteSpace()
{
global $dbc;
$query = "SELECT SubCatName FROM subcat1";
$result = mysqli_query ($dbc, $query)or die(mysqli_error() . "<p>With query:<br>$query");
while ($row = mysqli_fetch_array($result))
{
echo str_replace( "$row[subCatName]<br />");
}
}

 

would i need to go through the array removing the white space and then echoing it out?

 

Any help or advice would be good, thank you :)

Link to comment
Share on other sites

Here is the finished code

 

//gets all the pdf files related to that particular product
function getPDFs()
{
if ((isset($_GET['medical_product'])) && (isset($_GET['subcat_id'])) && (is_numeric($_GET['medical_product'])) && (is_numeric($_GET['subcat_id']))) { //correctly accessed 
$medical_product=$_GET['medical_product'];
$subcat_id=$_GET['subcat_id']; 
} else { 
$errors[] = 'You have accessed this page incorrectly.'; 
}
global $dbc;
$query="SELECT * FROM SubCat1 WHERE CategoryID = $medical_product AND SubCatID = $subcat_id";
$result = mysqli_query ($dbc, $query)or die(mysqli_error() . "<p>With query:<br>$query");
while ($row = mysqli_fetch_array($result))
{
echo '
<tr>
    <td><a href="downloads/'.str_replace(' ','',$row['SubCatName']).'_IFU.pdf" target="_blank">Instructions For Use</a></td>
  </tr>
  <tr>
    <td><a href="downloads/'.str_replace(' ','',$row['SubCatName']).'_PI.pdf" target="_blank">Product Infrmation</a></td>
  </tr>
  <tr>
    <td><a href="downloads/'.str_replace(' ','',$row['SubCatName']).'_MSDS.pdf" target="_blank">MSDS</a></td>
  </tr>
  <tr>
    <td><a href="downloads/'.str_replace(' ','',$row['SubCatName']).'_CAC.pdf" target="_blank">Clinical Article Chart</a></td>
  </tr>
  <tr>
    <td><a href="downloads/'.str_replace(' ','',$row['SubCatName']).'_SS.pdf" target="_blank">Sell Sheet</a></td>
  </tr>
  
';
}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.