Jump to content

Adding an extension to a filename


jdimino

Recommended Posts

Hi Everyone

 

I would like to an extension to a value.

for example .$BloomName. I would like to add either .jpg, jpe, .gif or Leaf.jpg

can someone Help me please

 

$query="insert into ihsreg (SubmitEmail,Bloom_Name,Pod_Name,Pollen_Name,Hybridiser,Origin,Grower,Color_Group,Bloom_Type,Reg_Mini,Size_Range,Propagation,Bloom_Color,Bloom_Characteristics,Leaf_Characteristics,Bush_Characteristics,Photo_Credit,Bloom_Image,Pod_Image,Pollen_Image,Hybridiser_Image,Leaf_Image,Cross_Made,Registrant_Name,date) values ('".$SubmitEmail."','".$BloomName."','".$PodName."','".$PollenName."','".$Hybridiser."','".$Origin."','".$Grower."','".$ColorGroup."','".$BloomType."','".$RegMini."','".$SizeRange."','".$Propagation."','".$BloomColor."','".$BloomCharacteristics."','".$LeafCharacteristics."','".$BushCharacteristics."','".$PhotoCredit."','".$BloomName."','".$PodName."','".$PollenName."','".$Hybridiser."','".$BloomName."','".$CrossMade."','".$RegistrantName."','".$date."')";

mysql_query($query); 

 

         

 

Link to comment
https://forums.phpfreaks.com/topic/120487-adding-an-extension-to-a-filename/
Share on other sites

If this is as easy as it seems to be, you just need to use string concatenation.

 

<?php
$bloomName = 'somevalue'; //the original variable
$ext = 'jpg'; //the extension
$bloomName = $bloomName . '.' . $ext; //concatenate the two variables with a dot to separate the extension
//then insert it into the db
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.