Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-31-2003, 03:19 PM   PM User | #1
fraknot
New Coder

 
Join Date: Jul 2003
Location: Mexico City
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
fraknot is an unknown quantity at this point
PHP + MS SQL Server...

Hi

I'm working now with PHP + Microsoft SQL Server, but it's kind of easy, because the functions are much like the mysql ones.

Anyway, I have now a problem. I have a query like this:

SELECT * FROM client ORDER BY client_name

Everything goes right in the MS SQL Query Analyzer, it returns me ALL rows and fields from that table, but when i do it in php, it seems that the '*' wildcard doesn't work...

PHP Code:
//In mysql I use either mysql_fetch_array , mysql_fetch object or mysql_fetch_row
$query_clients="SELECT id_cli,client FROM client WHERE client LIKE 'g%' ORDER BY client";
$result_clients=@mssql_query($query_clients,$con2);
if(!
$result_clients)
    echo 
"<br />Error. ".mssql_get_last_message()."<br />";
while(
$obj=mssql_fetch_object($result_clients))
{
    echo 
"<option value='".$obj->id_cli."'>".htmlentities($obj->client)."</option>\n";

As you see, I'm filling a select item with the query results and everything goes right, but when I do the same with the '*', it returns the select item like this...

Code:
<select name="select_client">
<option value="--">SELECT A CLIENT</option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
.
.
.
<!--It repeats  the line 'msssql_rows_affected' times-->
I can do this by only selecting the fields that I need, but my doubt is, why does '*' not work???

Thanks
__________________
::[ulfiX]::
fraknot is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:06 AM.


Advertisement
Log in to turn off these ads.