caran
Posts: 15
|
| Posted: 09/07/2012, 5:49 AM |
|
Hy there!
Can somebody help to solve my problem:
I have a Text in a db-file called 'vtr_kopftext'
In this text ther is a sign '#'
I want to replace this with a name
global $DBWLPG01;
$vtrnr = $vertrag1->vtr_nr->GetValue();
$betreuernn = CCDLookUp("psn_nachname","personen","psn_id=".$DBWLPG01->ToSQL($vertrag1->vtr_betreuer->GetValue(), ccsInteger), $DBWLPG01);
$betreuervn = CCDLookUp("psn_vorname","personen","psn_id=".$DBWLPG01->ToSQL($vertrag1->vtr_betreuer->GetValue(), ccsInteger), $DBWLPG01);
$betreueran = CCDLookUp("psn_anrede","personen","psn_id=".$DBWLPG01->ToSQL($vertrag1->vtr_betreuer->GetValue(), ccsInteger), $DBWLPG01);
$betreuerarray = array($betreueran, $betreuervn, $betreuernn);
$betreuertext = implode(" ",$betreuerarray);
So i have the Name and now i want to replace it:
// preg_replace($suchmuster, $ersetzungen, $zeichenkette);
$suchmuster = '#';
$vtrkopftext1 = CCDLookUp("vtr_kopftext","vertrag","vtr_id=".$DBWLPG01->ToSQL($vertrag1->vtr_id->GetValue(), ccsInteger), $DBWLPG01);
$vtrkopftext = preg_replace($suchmuster, $betreuertext, vtrkopftext1);
$result = $DBWLPG01->query("update vertrag set vtr_kopftext = '$vtrkopftext' where vtr_nr = " .$vtrnr);
My text would be completly deleted....
Is my way wrong? Is there a better way?
|
 |
 |
bannedone
Posts: 273
|
| Posted: 09/07/2012, 7:03 AM |
|
Hi
Reading this in German is a little difficult for me.. LOL
If I understand the issue here, why not use str_replace()??
Usually the first parameter to preg_replace() is a regular expression.
Have you tried this??
$vtrkopftext = str_replace($suchmuster, $betreuertext, vtrkopftext1);

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
 |
 |
caran
Posts: 15
|
| Posted: 09/07/2012, 7:28 AM |
|
just the variables are german... 
but thanks for your tip with str_replace, now i have my solution!
|
 |
 |
bannedone
Posts: 273
|
| Posted: 09/08/2012, 10:37 PM |
|
LOL
It was just a little harder figuring out what U were doing with German Variables since mnemonically to me I could not follow easily.
Glad that helped you....
Have fun
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
 |
 |
|