Page 1 of 1

Missing first record from query in IE, firefox is fin

Posted: Fri Sep 15, 2006 10:54 am
by benxmy
JayBird | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I've run into this a couple of times and haven't been able to track down the issue.  I have a query that in firefox returns all the results, but in IE fails to retun the first result, but returns all others.

Code: Select all

$prog_sql = "SELECT c.*
		FROM catalog c
		WHERE c.catalog_index = '77'";
$prog_res = mysql_query($prog_sql) or die(mysql_error());
?>

<table style='background-color: #ffffff; color: #000000' name='main_table' id='main_table' border='1px' cellpadding='3px' width='150px'>
<tr>
<form name=self_enroll_1 id=self_enroll_1 method=POST action='vweek07_2.php'>
<td align='left'>Catalog Item</td></tr>

<tr><td><select size='7' id='catalog_index' name='catalog_index'>
<?

while($row = mysql_fetch_array($prog_res))
{
	$catalog_index=$row[catalog_index];
	$item = $row[item];
	print("<option value='$catalog_index'>$item</OPTION>");
}
?>
</select></td></tr>
<tr><td><input type=submit value='Next'></form></td></tr>
</table>
Anyone have any ideas why this might be happening? I thought maybe another set of eyes could catch something I'm missing... Thanks!


JayBird | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Sep 15, 2006 10:59 am
by GM
Best thing to do in cases like this is check the source of your page. PHP and MySQL work independently of the browser they are writing to, so it's definitely not a problem with your query or program logic.

It might be that you've got some badly formed HTML that IE won't display for some reason, but Firefox does.

Posted: Fri Sep 15, 2006 10:59 am
by JayBird

Code: Select all

<?php
$prog_sql = "SELECT c.*
                FROM catalog c
                WHERE c.catalog_index = '77'";
$prog_res = mysql_query($prog_sql) or die(mysql_error());
?>
<form name=self_enroll_1 id=self_enroll_1 method=POST action='vweek07_2.php'>
	<table style='background-color: #ffffff; color: #000000' name='main_table' id='main_table' border='1px' cellpadding='3px' width='150px'>
		<tr>
			<td align='left'>Catalog Item</td>
		</tr>
		<tr>
			<td><select size='7' id='catalog_index' name='catalog_index'>
			<?
			
			while($row = mysql_fetch_array($prog_res))
			{
					$catalog_index=$row['catalog_index'];
					$item = $row['item'];
					print("<option value='$catalog_index'>$item</OPTION>");
			}
			?>
			</select></td>
		</tr>
		<tr>
			<td><input type=submit value='Next'></td>
		</tr>
	</table>
</form>