[PHP-DEV] Re: MSSQL DB Connect

2002-01-02 Thread Jerry

Thanks Jeremy, I finally found the solution:

?php
$query=SELECT * FROM DB1 JOIN DB2 ON DB1.dataid=DB2.dataid;
$queryupd=UPDATE DB1 SET dateval='20010101' where dateval='2101';
$hostname = serverdb;
$username = user;
$password = pwd;
$dbName = DB;
mssql_connect($hostname,$username,$password) or die(DATABASE FAILED TO
RESPOND.);
mssql_select_db($dbName) or DIE(Table unavailable);
$result2 = MSSQL_QUERY($queryupd); // Execute Update Statment
$result = MSSQL_QUERY($query);  // Execute Select Statment
$number = MSSQL_NUM_ROWS($result);
$i=0;
 if($number == 0) print No data?;
 elseif($number  0){
 print Number of rows: $numberBR;
while($i  $number){
 $dateval= mssql_result($result,$i,dateval);
 echo TRTDFONT color=#112266$dateval/FONT/TD;
 $i++;}
}?

And it works fine !
Now I'm looking for the same function for IBM DB2 database connection...

Jerry

Jeremy Reed [EMAIL PROTECTED] wrote:
 What was the error message you received?  Also, when passing the variables
 to the mssql_connect() function, you need not use quotes since you've
 already initialized them to the strings.  Pass them as follows:
$connection
 = mssql_connect($a,$b,$c).  Also, you aren't passing the actual sql string
 to the mssql_query() function.  You have $sql = blah but you pass
 $sql_temp.

 Jerry wrote:

  Hi

  I have PHP on windows 2000 web server
  I would like to remote to a MS SQL database on another web server.
  I tried something like:

  ?php
  $h = server adr;
  $u = user;
  $p = passw;
  $b = db;
  $connexion = mssql_connect($h, $u, $p);
  mssql_select_db($b);
  $sql_temp= select * from test;
  $result = mssql_query($sql_temp);
  mssql_close($connexion);
  ?

  But it didn't work. Please help me.

  Jerry








-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: MSSQL DB Connect

2001-12-21 Thread Jeremy Reed

What was the error message you received?  Also, when passing the variables
to the mssql_connect() function, you need not use quotes since you've
already initialized them to the strings.  Pass them as follows:  $connection
= mssql_connect($a,$b,$c).  Also, you aren't passing the actual sql string
to the mssql_query() function.  You have $sql = blah but you pass
$sql_temp.



Jerry [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 I have PHP on windows 2000 web server
 I would like to remote to a MS SQL database on another web server.
 I tried something like:

 ?php
 $h = server adr;
 $u = user;
 $p = passw;
 $b = db;
 $connexion = mssql_connect($h, $u, $p);
 mssql_select_db($b);
 $sql = select * from test;
 $result = mssql_query($sql_temp);
 mssql_close($connexion);
 ?

 But it didn't work. Please help me.

 Jerry





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]