Forum Moderators: coopster

Message Too Old, No Replies

String With Single Quote Not Being Returned By Array

Has anyone seen this or know what to do about it?

         

Demaestro

5:45 pm on May 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am not a whiz with PHP at all but I inherited a site that uses it so I have been fumbling through making updates and fixing bugs. Learned a lot so far but this one has me stumped.

There is a string in the MySql DB that contains a single quote when the following code is executed the value for dancer7 returns an empty string even though when I query the database directly it returns "O'Reilly"... Incase you are wondering URL7 has a value that is returned.... don't get me started on why there is only one row in the database with columns named url1..dancer1...url2...dancer2...url(and so on)....dancer(and so on)

<?php include("connection.php");?>

<?php
$res = mysql_query("SELECT * FROM dancers");
$o = mysql_fetch_object($res);
?>

<?php
echo "<a href=\"$o->url1\" class=dancers>$o->dancer1</a><br><br>";
echo "<a href=\"$o->url2\" class=dancers>$o->dancer2</a><br><br>";
echo "<a href=\"$o->url3\" class=dancers>$o->dancer3</a><br><br>";
echo "<a href=\"$o->url4\" class=dancers>$o->dancer4</a><br><br>";
echo "<a href=\"$o->url5\" class=dancers>$o->dancer5</a><br><br>";
echo "<a href=\"$o->url6\" class=dancers>$o->dancer6</a><br><br>";
echo "<a href=\"$o->url7\" class=dancers>$o->dancer7</a><br>";
?>

Any insight would be welcomed.

Demaestro

5:51 pm on May 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ok please don't do anything for this I am an idiot!

The table I queried to confirm the value was correct was some dumb view that was joined to a table that had the right info... the form that was inputing to the table I am submitted doesn't have the proper quotes and so the single quote in her name was terminating the field so it was getting inputting to the tables I am submitting it to.

Another bug for this site..... Why did I agree to taking it on?