Page 1 of 1

Bizzare PHP + sqlserver problem

Posted: Thu Dec 18, 2003 4:05 pm
by dkizerian
Hi I'm having a problem with a query and am hoping y'all can point me in the right direction
here is the basic code

Code: Select all

$query = "SELECT * FROM InternetConnections";
$res = mssql_query($query, $dblink);
while (($row = mssql_fetch_row($res)) !== FALSE)
{
    $interVal = '';
	if ($user_internetConnection == $rowї0]) $interVal = ' selected';
	echo "<OPTION VALUE="" . $row&#1111;0] . """ . $interVal . ">" . $row&#1111;1] . "</OPTION>\n";
&#125;
the table "intenetConnections" has only 2 columns right now, and this code works as expected.

One of the engineers is testing a replication tool that adds a third column at the end of the table for a tracking ID.... when he adds this column my query no loger works. anyone have any ideas why this additional column would break this simple query?

Posted: Thu Dec 18, 2003 4:17 pm
by Weirdan
try to name your fields explicitly in your query:

Code: Select all

select somefield, some_other_field from InternetConnections

Posted: Thu Dec 18, 2003 4:47 pm
by dkizerian
Thanks weirdan! I forgot to mention that this has been tried, and it does work, but the problem is I have probably close to 300 different querys that this small change will affect, so I'd like to see if there is an easier way to fix the error than having to recode the querries

Posted: Thu Dec 18, 2003 5:30 pm
by Weirdan
seems like your engineer has added field in the beginning of the rows. It's the only reason that could broke your queries.