Bizzare PHP + sqlserver problem

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dkizerian
Forum Newbie
Posts: 7
Joined: Thu Sep 12, 2002 3:32 pm
Location: SLC UTah

Bizzare PHP + sqlserver problem

Post 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?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

try to name your fields explicitly in your query:

Code: Select all

select somefield, some_other_field from InternetConnections
dkizerian
Forum Newbie
Posts: 7
Joined: Thu Sep 12, 2002 3:32 pm
Location: SLC UTah

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post 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.
Post Reply