Jump to content

SELECT query not working???


budimir

Recommended Posts

Hi Guys,

 

I upgraded to PHP 5.3.10 and use MSSQl Server 2008. I have everything working. Worked my butt out to connect to the server, but now I have a problem with a single query that is killing me!!!! please help me.

 

My peace of code is

try{
$conn = new PDO ("sqlsrv:server=server3\server3; database=XXXXXX", "XXXXX", "XXXXXXX");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  } catch (PDOException $e) {
    echo "<br />" . $e->getMessage() . "\n";
    exit;
  }

//Učitavanje korisnika iz EIS baze (Opći podaci)
echo "<p>Sikronizacija korisnika između NAV <------> WebShop</p>";
echo "1. Učitavanje korisnika iz EIS baze - Opći podaci<br />";

$upit = "SELECT * FROM UserTable";
$params = array();
$options =  array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$query = sqlsrv_query($conn,$upit,$params,$options) or die (sqlsrv_errors());
$broj = sqlsrv_num_rows($query);

 

the error I'm getting is

 

Warning: sqlsrv_query() expects parameter 1 to be resource, object given in C:\inetpub\wwwroot\drezga_webshop\sync\sync_users.php on line 23 Array

 

can you tell me what I'm doing wrong???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.