M.O.S. Studios Posted July 12, 2008 Share Posted July 12, 2008 Hey guys I’m hoping that one of you can help. Here is my problem, I'm using a mysql database with php and have a snag, I have a value is placed from a form into the database and has another value added in front of it in the same field. Like this "<?php $a = $b . " - " . $a; ?> ", that works great the first time, however the next time I edit that value the value becomes " $b . " - " .$b . " - " . $a; " and so on and so on. Is their any way I can I can have the value check first and remove the first " $b . " - " . " if its already their? To give an example this is what structure to is. Form data entered Then Form data placed for variation (all needed values added) Then Values add to database with value $b .“ – “. Add in front of them To give an example this is what I would want the structure to be. Form data entered Then Form data placed for variation (all needed values added) Then Values are check i the $b.“ – “. value is placed infront If yes {$b.“ – “. value is removed from infront Then} Then Values add to database with value $b.“ – “. Add in front of them Any help is good help THANKS GUYS! Link to comment https://forums.phpfreaks.com/topic/114438-value-help-please/ Share on other sites More sharing options...
rarebit Posted July 12, 2008 Share Posted July 12, 2008 if(!strstr($s,"-")) { $s = $b."_".$s; } But can the form data contain "_"? If so is the prefix of a fixed length, known set of values? Link to comment https://forums.phpfreaks.com/topic/114438-value-help-please/#findComment-588447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.