This dynamically produces a select box, 6 lines deep, showing all the games in the database (from the query). When you select a game, and hit submit, it transfers the game name to validate.php3 as $sel_game. Here, a game with the name of "Sarge's Heroes" will show up right, with the apostrophe in the right spot.
My validate.php3 code:
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
mysql_connect (localhost, username, password) or die("Unable to Connect to MySQL Server");
mysql_select_db (mydb) or die("Unable to select DB");
$query="select id, publisher, description FROM gameinfo WHERE game='$sel_game'";
$game_array=mysql_query($query) or die("Publisher Select Failed!");
<table border="1" width="700">
<td width="72%">You selected Game : <?php echo $sel_game ?></td>
<td width="72%">The ID for this game is : <?php echo $game_id ?></td>
<td width="72%">The Publisher for this game is : <?php echo $game_publ ?></td>
<td width="72%">The Description for this game is :<br><br> <?php echo $game_desc ?></td>
This takes the passed variable $sel_game and looks it up in the database to get the publisher, id number, and description to display it. However, when I run across a game like "Sarge's Heroes", the processing stops after the apostrophe. The HTML is still shown, however, nothing past the apostrophe is shown from the database. This code works for any other game name, and even works with apostrophes in the description field.
The game name and publisher fields are varchar's, and the description area is a blob.
Again, Any help is greatly appreciated.
[This message has been edited by mmccue (edited March 07, 2000).]
Sometimes posting the help request makes you look at things in a new light, and whammo!, 5 minutes later the problem is fixed. That has been my experience here. 5 Minutes after posting, though I've been working on this all night
My solution, which works as far as I know (as far as I see):
The problem wasn't with mysql or php, I think it was with the passing the $sel_game, which held the string that contained the apostrophe. Instead of passing that string, I changed the select list to pass the value of the 'id' number of the game, then queried for the rest of the information, including the game name, on the validate.php3 page by looking up the id. This works.
Can't tell you how much this board has helped me in my ventures! A truly autonomous support system