freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: zamily <mz.wan AT pdx.com.my>
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: Re: php example...
- Date: Thu, 10 May 2001 10:57:32 +0800
this is my php file..
------------begin of PHP file----------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
//putenv("SYBASE=/usr/local/freetds");
// YOUR tds 7.0 SERVER PARAMETERS
$hostname = "inexus21";
$username = "sa";
$password = "";
// YOUR tds 7.0 DATABASE
$dbname = "inexus21";
$tablename = "inexus_file_agent" ;
// CONNECT TO THE tds 7.0 DATABASE
$connection = tds_connect($hostname,$username,$password);
tds_select_db($dbname);
$sql_query = "select * from $tablename" ;
$query_result =tds_query($sql_query) ;
$number_rows = tds_num_rows($query_result) ;
$number_fields = tds_num_fields($query_result) ;
// TEST YOUR QUERY
if($number_rows == 0) :
print "The query does not produce any data row ! " ;
elseif ($number_rows > 0) :
print "Yes there are " . $number_rows . " rows resulting from the query. "
;
endif ;
// DISPLAY TABLE FIELD HEADERS
print "<table border><tr><th>row</th>" ;
for ($field_number = 0 ; $field_number <= $number_fields - 1 ;
$field_number++ ) {
$field_name = tds_field_name($query_result, $field_number) ;
print "<th>" . $field_name . "</th>" ;
}
print "</tr>" ;
// DISPLAY INDIVIDUAL ROWS - POPULATING THE TABLE
for ($row_number = 0 ; $row_number <= $number_rows - 1 ; $row_number++) {
print "<tr><td>" . $row_number . "</td>" ;
for ($field_number = 0 ; $field_number <= $number_fields - 1 ;
$field_number++) {
print "<td>" . tds_result($query_result, $row_number, $field_number) .
"</td>" ;
}
print "</tr>" ;
}
print "</table>" ;
tds_close($connection);
?>
</body>
</html>
-----------end of file --------------
--------begin of result--------------------
Fatal error: Call to undefined function: tds_connect() in
/var/www/inexus/test.php on line 23
-----end of result--------------
----- Original Message -----
From: "Darryl Friesen" <Darryl.Friesen AT usask.ca>
To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
Sent: Thursday, May 10, 2001 10:57 AM
Subject: [freetds] Re: php example...
>
> ----- Original Message -----
> From: "Brian Bruns" <camber AT ais.org>
> To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
> Sent: Wednesday, May 09, 2001 9:02 PM
> Subject: [freetds] Re: php example...
>
>
> > On Wed, 9 May 2001, zamilie wrote:
> >
> > > i can't connect to sql 6.5(nt4 server) from linux 7.0 using php...
> > > how??? help me..
>
> See
>
> http://www.php.net/manual/en/ref.mssql.php
> http://www.php.net/manual/en/ref.sybase.php
>
> for examples. Both the MS SQL and Sybase functions will work.
>
> Make sure the stuff in your "interfaces" file is correct (hostname or IP,
> port number), and remember NOT to use hostname in the connect statement --
> use the name from the interfaces file.
>
>
> - Darryl
>
> ----------------------------------------------------------------------
> Darryl Friesen, B.Sc., Programmer/Analyst Darryl.Friesen AT usask.ca
> Education & Research Technology Services, http://gollum.usask.ca/
> Department of Computing Services,
> University of Saskatchewan
> ----------------------------------------------------------------------
> "Go not to the Elves for counsel, for they will say both no and yes"
>
>
>
> ---
> You are currently subscribed to freetds as: [mz.wan AT pdx.com.my]
> To unsubscribe, forward this message to
$subst('Email.Unsub')
-
php example...,
zamilie, 05/09/2001
- <Possible follow-up(s)>
- php example..., zamilie, 05/09/2001
- Re: php example..., Brian Bruns, 05/09/2001
- Re: php example..., Darryl Friesen, 05/09/2001
- Re: php example..., zamily, 05/09/2001
- Re: php example..., Darryl Friesen, 05/09/2001
- Re: php example..., zamily, 05/09/2001
- Re: php example..., James K. Lowden, 05/09/2001
- Re: php example..., Darryl Friesen, 05/09/2001
Archive powered by MHonArc 2.6.24.