querying mssql database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kmeen
Forum Newbie
Posts: 3
Joined: Fri Jun 16, 2006 11:30 am

querying mssql database

Post by kmeen »

The following piece of code does not work, can someone tell me why? I see an error in the log saying exit bus signal error(10) and in IE I get page cannot be displayed error.

$SQL = "BEGIN SELECT tblfirsttable.varCharData , tblSecondtable.floatData from tblfirsttable, tblSecondtable";
$query_rslt = mssql_query($SQLl);
$numrows = mssql_num_rows($query_rslt);
echo $numrows;

The strangest thing is that when I swap the selec return types(first select tblSecondtable.floatData, tblfirsttable.varCharData) it works fine, as shown below.

$SQL = "BEGIN SELECT tblSecondtable.floatData, tblfirsttable.varCharData from tblfirsttable, tblSecondtable";
$query_rslt = mssql_query($SQLl);
$numrows = mssql_num_rows($query_rslt);
echo $numrows;

Can someone please explain this behavior.

Thanks.

- Meena.


[/b]
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

I can't say for certain the SQL statement is correct, since I'm unaware of any MSSQL specifics, but I can tell you your call to mssql_query() is actually using an unknown variable $SQLl rather than the statement variable $SQL. Simple typo, methinks.
kmeen
Forum Newbie
Posts: 3
Joined: Fri Jun 16, 2006 11:30 am

Post by kmeen »

Sorry that was a typo I made for this post the script really is $SQL. Let me post my script again in order to make it clear:

$SQL = "BEGIN SELECT tblfirsttable.varCharData , tblSecondtable.floatData from tblfirsttable, tblSecondtable";
$query_rslt = mssql_query($SQL);
$numrows = mssql_num_rows($query_rslt);
echo $numrows;

The strangest thing is that when I swap the selec return types(first select tblSecondtable.floatData, tblfirsttable.varCharData) it works fine, as shown below.

$SQL = "BEGIN SELECT tblSecondtable.floatData, tblfirsttable.varCharData from tblfirsttable, tblSecondtable";
$query_rslt = mssql_query($SQL);
$numrows = mssql_num_rows($query_rslt);
echo $numrows;


Sorry about that. Any help is appreciated.
Post Reply