Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> mysql_escape_string / magic_quotes, Funkcja odwrotna
My4tic
post
Post #1





Grupa: Zarejestrowani
Postów: 260
Pomógł: 0
Dołączył: 4.08.2005

Ostrzeżenie: (0%)
-----


Jest jakas funkcja odwrotna do mysql_escape_string ?

Wrzucam z CMS'a dane do SQL i pozniej chce wyświetlić tekst ale juz bez znaków unikowych.

Po kilkukrotnym przesłaniu danych mam np takie coś:

Kod
<font face=\"\\&quot;\\\\&quot;\\\\\\\\&quot;\\\\\\\\\\\\\\\\&quot;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&quot;Tahoma\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&

(IMG:http://forum.php.pl/style_emoticons/default/dry.gif)

Ten post edytował My4tic 25.09.2005, 11:33:31
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
My4tic
post
Post #2





Grupa: Zarejestrowani
Postów: 260
Pomógł: 0
Dołączył: 4.08.2005

Ostrzeżenie: (0%)
-----


CMS wrzuca to tak:

Kod
<?php
include ("config.php");

$aNaglowek = mysql_escape_string($aNaglowek);

$aDBLink = @mysql_connect( "$SQLhost", "$SQLlogin", "$SQLpass" );
  if ( !empty( $aDBLink ) )
      {
           if ( mysql_select_db( "$db", $aDBLink ) == True )
           {
             $aSQL = "select * from content";
             $aQResult = mysql_query( $aSQL, $aDBLink );
               if ( $aQResult == True )
               {
               // -------------------------------------------------------- //

$aSQL = "UPDATE content SET naglowek='$aNaglowek' WHERE id='$id'";
$aQResult = mysql_query( $aSQL );


Jak w PhpMyAdmin sprawdze co jest w komórkach to widać ze są slashe.

Pozniej wyświetlam zawartość bazy:

Kod
<?php
include ("admin/config.php");

$aDBLink = mysql_connect( "$SQLhost", "$SQLlogin", "$SQLpass" );
  if ( !empty( $aDBLink ) )
      {
           if ( mysql_select_db( "$db", $aDBLink ) == True )
           {
             $aSQL = "select * from content";
             $aQResult = mysql_query( $aSQL, $aDBLink );
               if ( $aQResult == True )
               {
                  $aSQL = "SELECT id, naglowek, wstep FROM content WHERE id=1";
                   $aQResult = mysql_query( $aSQL );
                   $aRow = mysql_fetch_array( $aQResult );
                   $aNaglowek = $aRow["naglowek"];


i pozniej normalnie:

Kod
print($aNaglowek);


Kurcze (IMG:http://forum.php.pl/style_emoticons/default/sadsmiley02.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 06:05