|
Posted by Steve JORDI on 07/18/06 13:11
Hi,
I have a strange behavior when using IExplorer over FireFox.
There is an html form that asks for the name of a city and has
a dedicated field for that with a submit button next to it.
In IExplorer, if I hit return instead of clicking the button,
the PHP query on MySQL fails when reaching the mysql_fetch_object
function. It's ok if I click the button.
FireFox always works in both cases.
I suspect that IExplorer interprets the return as a carriage return
and inserts a control character in the query, whereas FireFox
interprets the return as a click on the submit button.
The PHP code seems ok. Here is the excerpt:
<?php
if( isset($_POST['submit'])) {
$city= $_POST['city'];
/* Connect to MySQL server and select database. */
$linkID = @mysql_connect("localhost","myuser","mypassword")
or die("Could not connect to MySQL server");
@mysql_select_db("mydatabase")
or die("Could not select database");
/* Create and execute query. */
$query = "SELECT DISTINCT CS.recID, CS.COMM,
CS.PROPRIETAIRE_DONNEE, CS.NO_REF,
CS.GENRE, CS.ESPECE, CL.NomF
FROM ChauvesSouris CS
LEFT JOIN ChauvesLangages AS CL ON CS.GENRE = CL.GENRE
AND CS.ESPECE = CL.ESPECE
WHERE CS.COMM LIKE '$city%' ORDER BY CS.COMM ;" ;
$result = mysql_query(strip_tags(htmlspecialchars($query)));
}
?>
<table cellspacing="2" cellpadding="1" border="0">
<tr>
<th class="id">ID</td>
<th class="noref">N° Ref</th>
<th class="commune">Commune</th>
<th class="proprio">Proprio</th>
<th class="genre">Genre</th>
<th class="espece">Espèce</th>
<th class="espece">Nom</th>
</tr>
<?php
while( $row = mysql_fetch_object($result) ) {
... display code here
}
---> IExplorer crashes on this while line stating that:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL
result resource in /home/www/apache/jorditests/thefile.php on line 38
Any clue why???
Thanks for any help
Sincerely,
Steve JORDI
(Remove the K_I_L_LSPAM from my email address)
------------------------------------------------
1197 Prangins Email: stevejordiK_I_L_LSPAM@hotmail.com
Switzerland WWW: www.sjordi.com
------------------------------------------------
Volcanoes at www.sjordi.com/volcanoes
MovieDB at www.sjmoviedb.com
------------------------------------------------
Navigation:
[Reply to this message]
|