Jump to content
php.lv forumi

Probleeminja...


spamb0x

Recommended Posts

Needojas neliels helps 2 lietaas:

 

1. Ja kaadaa laucinjaa kura saturu jaaieleik MySQL db ieraxta ' tad nekas neiet...

t.i. kaa tikt valjaa no ' (meeginaaju ar eregi_replace uz ' nesanaaca, mosh nepareizi dariiju)

 

2. Arii prob ar eregi_replace... kaa lai replaco textus kur ir ???, vinsh bljaustaas par reg. simboliem...

 

Ceru uz paliidziibu :blink:

Link to comment
Share on other sites

Visus datus, ko tu nes no lietotaaja ievadiitajiem uz DB izlaizh caur addslashes() un atpakalceljaa, tas ir, tad, kad laid atpakalj no DB uz savu lapu, tad izlaizh ar stripslashes().

<code><font color="#000000">
<font color="#0000CC"><?php
</font><font color="#006600">if (</font><font color="#0000CC">$_POST</font><font color="#006600">[</font><font color="#CC0000">'teksts'</font><font color="#006600">]) {
  </font><font color="#0000CC">saglabat_db</font><font color="#006600">(</font><font color="#0000CC">[url=http://lv.php.net/addslashes]addslashes[/url]</font><font color="#006600">(</font><font color="#0000CC">$_POST</font><font color="#006600">[</font><font color="#CC0000">'teksts'</font><font color="#006600">]));
}
</font><font color="#0000CC">?></font>
</font>
</code>

un atpakaļ ceļā

<code><font color="#000000">
<font color="#0000CC"><?php
  $teksts </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/stripslashes]stripslashes[/url]</font><font color="#006600">(</font><font color="#0000CC">nolasit_db</font><font color="#006600">(</font><font color="#CC0000">'select teksts from tabula'</font><font color="#006600">));
  echo </font><font color="#0000CC">$teksts</font><font color="#006600">;
</font><font color="#0000CC">?></font>
</font>
</code>

Link to comment
Share on other sites

×
×
  • Create New...