Escape Character & and #

Discussion in 'Javascript' started by Bilal, Jun 25, 2004.

  1. Bilal

    Bilal Guest

    Hi,
    Does anyone know the escape character for & and # like in :
    Update GDO_INFO_ER set V_COMMENTAIRE='B&A' where V_USERMODIFICATION='bilal123'
    or
    Update GDO_INFO_ER set V_COMMENTAIRE='B#A' where V_USERMODIFICATION='bilal123'
    I would like to insert & and # literally in the table.
    I appreciate any help or suggestion.
    Thanks oyu
    Bils
     
    Bilal, Jun 25, 2004
    #1
    1. Advertising

  2. On 25 Jun 2004 05:21:28 -0700, (Bilal) wrote:

    >Hi,
    >Does anyone know the escape character for & and # like in :


    echo htmlspecialchars('&') . "<br>";
    echo htmlspecialchars('#') . "<br>";

    will give you this html-source:

    &amp;<br>#<br>

    Regards

    Marian

    --
    Tipps und Tricks zu PHP, Coaching und Projektbetreuung
    http://www.heddesheimer.de/coaching/
     
    Marian Heddesheimer, Jun 25, 2004
    #2
    1. Advertising

  3. Bilal wrote:

    > Hi,
    > Does anyone know the escape character for & and # like in :
    > Update GDO_INFO_ER set V_COMMENTAIRE='B&A' where V_USERMODIFICATION='bilal123'
    > or
    > Update GDO_INFO_ER set V_COMMENTAIRE='B#A' where V_USERMODIFICATION='bilal123'
    > I would like to insert & and # literally in the table.
    > I appreciate any help or suggestion.
    > Thanks oyu
    > Bils


    I am guessing you are trying to get this from a form and insert/update a
    MySQL database?


    mysql> insert into x values ('B#H&C');
    Query OK, 1 row affected (0.07 sec)

    mysql> select * from x;
    +-------+
    | y |
    +-------+
    | B#H&C |
    +-------+
    1 row in set (0.00 sec)

    The problem is getting it from the form - through PHP to the database...
    My testing is successful. what errors do you get?

    Code segment that does the insert from the page.. basically takes an SQL
    statement from the page and executes it...

    $link = mysql_connect('localhost', $USR, $PWD);
    if( $link ) {
    mysql_select_db( $DB, $link );
    if( $sql ) {
    $sql = ereg_replace( ";$", "", $sql );
    $sql = ereg_replace( "\\\\", "", $sql );
    $result = mysql_query( $sql, $link );
    .... code for display results of query here
    }

    form:

    <form action="<?=$PHP_SELF?>" method="post">
    Enter a SQL statement:
    <input type="text" name="sql" size="25" />
    <input type="submit" />
    </form>

    Michael Austin.
     
    Michael Austin, Jun 25, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff S
    Replies:
    12
    Views:
    13,884
    Jeff S
    Nov 10, 2003
  2. George Durzi

    RegisterStartupScript / Escape Character

    George Durzi, Jul 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    635
    George Durzi
    Jul 2, 2004
  3. Sinan Nalkaya

    re and escape character

    Sinan Nalkaya, Sep 15, 2005, in forum: Python
    Replies:
    3
    Views:
    340
    Fredrik Lundh
    Sep 16, 2005
  4. slomo
    Replies:
    5
    Views:
    1,549
    Duncan Booth
    Dec 2, 2007
  5. nvangogh
    Replies:
    10
    Views:
    166
    Randy Westlund
    Mar 13, 2014
Loading...

Share This Page