Forum Moderators: coopster

Message Too Old, No Replies

Insert rows - not as expected-

could not set my mind to it!

         

henry0

3:44 pm on Mar 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a massive amount of similar rows to be inserted via PHPmyAdmin

in the DB it is entered as:
INSERT INTO my_table VALUES (1, '<? echo"<li><a href=\"aaaaa.php?state=".alaska." \"> Alaska</a></li>";?>');

if I insert it in a PHP file it works fine.
<? echo"<li><a href=\"aaaaa.php?state=".alaska." \"> Alaska</a></li>";?>

if I call it from a query it results in "blank" and view source shows:
<? echo"<li><a href="aaaaa.php?state=".alaska." "> Alaska</a></li>";?>
then I know that escaping \" are gone

if I manually edit the DB and add the slahes back then it partially works
and show an activated link like that one but also echos the end of the line.
Alaska";?>

what should I do?

joelgreen

4:36 pm on Mar 5, 2007 (gmt 0)

10+ Year Member



some servers are setup to use <?php as php code starter, and you have just <?

Why are you inserting <? and?> into database? will you parse (i.e. eval) php code at a later stage? If not then in phpmyadmin you should insert it like

INSERT INTO my_table VALUES (1, '<li><a href="aaaaa.php?state=alaska"> Alaska</a></li>');

henry0

5:00 pm on Mar 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My php.ini is set to accept the short tags

My problem was that I added the beginning and ending tags.
Now it works; I did not pay enough attention to my query which is included in a html file set to be parsed as php and that is already wrapped by the opening and ending tags
Thanks