[PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Muhammed Mamedov
Hello everybody,
What do you think is the best method to abstract php code from a specific database?.
Make PHP code 100% database independent?..

Waitin' for your comments.
Muhammed Mamedov


Re: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Muhammed Mamedov
Thanks Ricardo for your comments.

What do you think guys: ADODB or PEAR::DB ?

- Original Message -
From: Ricardo Lopes [EMAIL PROTECTED]
To: Muhammed Mamedov [EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 11:21 AM
Subject: Re: [PHP-DB] Database Abstraction Layer?


 You have ADODB and PEAR DB that both work as abstraction layer. I have
used
 ADODB and seems to me that is very good, yet i have not tested PEAR DB...

 To make php code 100% database independent is not very easy, depends of
what
 are you going to do with your code. Use the ADODB or PEAR functions every
 time possible, and avoid the using of sql statements in your code because
 you have to carefull design then to be database independent but that can
be
 a very difficult task.

 - Original Message -
 From: Muhammed Mamedov [EMAIL PROTECTED]
 To: phpdb [EMAIL PROTECTED]
 Sent: Wednesday, January 21, 2004 8:31 AM
 Subject: [PHP-DB] Database Abstraction Layer?


 Hello everybody,
 What do you think is the best method to abstract php code from a specific
 database?.
 Make PHP code 100% database independent?..

 Waitin' for your comments.
 Muhammed Mamedov



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHP - MsSQL - DB error connect failed

2004-01-21 Thread Alain Barthlemy
It is not directly PHP but it is Db with PHP/Linux

Linux 2.4.19-4GB
Apache: httpd-2.0.48
php-4.3.4
freetds-0.61.2

I have php pages to connect to MsSQL-2000 server

$conn = mssql_connect($server, $user, $pass)
or die ;

or (PEAR:Db)

$dsn = mssql://$user:[EMAIL PROTECTED]/$dbname;
if (DB::isError($db)) {die ($db-getMessage()); }

PHP-pages with these instructions worked this morning.
Later and still now: DB error connect failed : impossible to connect now.

I suspect the MsSQL server to be overloaded.

Other users (Windows) are connecting via piped names

Myself (on Linux) connect via IP-address 

If I reboot in Windows-2000 (Dual-boot system): no problem to access Db (piped
name).

If I make a test (on Linux) with tsql (FreeTDS): connection OK

Only problem is to try connecting through Apache/PHP on Linux via IP-Address

I had once problem making a DHCP enquiry on a Windows server from a Linux Host
and I had to increase the TimeOut thus I wondered if I do not have the same
problem now.

I checked thus /www/conf/php.ini
I uncommented the lines:

mssql.connect_timeout = 10
mssql.timeout = 60

and tried higher numbers but without success. Apache/PHP don't seem to repeat
the request till success.

If anybody knows of a way to awake or shake MsSQL (apart from blowing it). Of
course, the obvious is to install MySQL bur I am not the master here.

-- 
Alain Barthélemy
[EMAIL PROTECTED]
http://bartydeux.be
Linux User #315631

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] breaking apart data

2004-01-21 Thread Chris Boget
 Thanks Chris... that worked great.

No worries.
 
 Guess I need to spend a _lot_ more time reading the manual.

It also helps alot just lurking on the list (this and/or PHP general).
I've been coding with PHP for almost 6 years and there're still new
things I learn all the time.

Chris

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Paul Miller
There are a couple of products out there that I am about to start testing,
starting first with:

 - SQL Relay
http://sqlrelay.sourceforge.net/
This product uses its on C interfaces to interact with DBs and different
programming languages.  It addresses a bunch of items in the PHP DB calls.
Connection pooling and load balancing.

 - Propel
http://propel.phpdb.org/
Extensive templates create the SQL definition files you need to setup your
database and the classes you need to work with your data model in your PHP
scripts. The classes for your object model are generated from a simple XML
schema and any customizations are written in plain PHP.

This will effectively that add SQL and DB dependence out of your mix.  This
is PHP5 also.

HTH

- Paul

-Original Message-
From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 2:31 AM
To: phpdb
Subject: [PHP-DB] Database Abstraction Layer?


Hello everybody,
What do you think is the best method to abstract php code from a specific
database?.
Make PHP code 100% database independent?..

Waitin' for your comments.
Muhammed Mamedov

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Paul Miller
Oh ya, one more thing, I am going to integrate SQL Relay with the PHP
abstraction layer:

http://sourceforge.net/projects/sqlalphp

to give the functions a more PHP feel to them.  Plus, I will be able to
retain DB specific calls if I want with this layer.  I have used this layer
with a great deal of success in the past.  But it was never the DB calls
that got me, it was the actually SQL.  So I am building a swappable SQL
library.  The Propel solution would effectively negate me having to do that.

- Paul

-Original Message-
From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 3:41 AM
To: phpdb
Subject: Re: [PHP-DB] Database Abstraction Layer?


Thanks Ricardo for your comments.

What do you think guys: ADODB or PEAR::DB ?

- Original Message -
From: Ricardo Lopes [EMAIL PROTECTED]
To: Muhammed Mamedov [EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 11:21 AM
Subject: Re: [PHP-DB] Database Abstraction Layer?


 You have ADODB and PEAR DB that both work as abstraction layer. I have
used
 ADODB and seems to me that is very good, yet i have not tested PEAR DB...

 To make php code 100% database independent is not very easy, depends of
what
 are you going to do with your code. Use the ADODB or PEAR functions every
 time possible, and avoid the using of sql statements in your code because
 you have to carefull design then to be database independent but that can
be
 a very difficult task.

 - Original Message -
 From: Muhammed Mamedov [EMAIL PROTECTED]
 To: phpdb [EMAIL PROTECTED]
 Sent: Wednesday, January 21, 2004 8:31 AM
 Subject: [PHP-DB] Database Abstraction Layer?


 Hello everybody,
 What do you think is the best method to abstract php code from a specific
 database?.
 Make PHP code 100% database independent?..

 Waitin' for your comments.
 Muhammed Mamedov



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MSSQL stability problem

2004-01-21 Thread Stuart
I have a site that makes heavy use of a local SQL Server database. Every 
6-12 hours the site continuously reports not being able to connect to 
the database. That is the only info in the warning that's given. The 
only solution I've found is to restart the Apache and MSSQL services.

The [MSSQL] section from my php.ini is appended below. IIRC the only 
values I've changed are mssql.textlimit and mssql.textsize.

Has anyone seen this before? What causes it and how can I stop it 
happening short of restarting the services every 6 hours?

Thanks.

--
Stuart
[MSSQL]
; Allow or prevent persistent links.
mssql.allow_persistent = On
; Maximum number of persistent links.  -1 means no limit.
mssql.max_persistent = -1
; Maximum number of links (persistent+non persistent).  -1 means no limit.
mssql.max_links = -1
; Minimum error severity to display.
mssql.min_error_severity = 10
; Minimum message severity to display.
mssql.min_message_severity = 10
; Compatability mode with old versions of PHP 3.0.
mssql.compatability_mode = Off
; Connect timeout
;mssql.connect_timeout = 5
; Query timeout
;mssql.timeout = 60
; Valid range 0 - 2147483647.  Default = 4096.
mssql.textlimit = 2147483647
; Valid range 0 - 2147483647.  Default = 4096.
mssql.textsize = 2147483647
; Limits the number of records in each batch.  0 = all records in one batch.
;mssql.batchsize = 0
; Specify how datetime and datetim4 columns are returned
; On = Returns data converted to SQL server settings
; Off = Returns values as -MM-DD hh:mm:ss
;mssql.datetimeconvert = On
; Use NT authentication when connecting to the server
mssql.secure_connection = Off
; Specify max number of processes. Default = 25
;mssql.max_procs = 25
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Muhammed Mamedov
Hmm..
Thank you for you sql picks:)
But what do you guys think aabout Pear :: DB? Is it as effective as these
Paul's picks?

Thank you.
Muhammed Mamedov

- Original Message -
From: Paul Miller [EMAIL PROTECTED]
To: phpdb [EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 5:44 PM
Subject: RE: [PHP-DB] Database Abstraction Layer?


 There are a couple of products out there that I am about to start testing,
 starting first with:

  - SQL Relay
 http://sqlrelay.sourceforge.net/
 This product uses its on C interfaces to interact with DBs and different
 programming languages.  It addresses a bunch of items in the PHP DB calls.
 Connection pooling and load balancing.

  - Propel
 http://propel.phpdb.org/
 Extensive templates create the SQL definition files you need to setup your
 database and the classes you need to work with your data model in your PHP
 scripts. The classes for your object model are generated from a simple XML
 schema and any customizations are written in plain PHP.

 This will effectively that add SQL and DB dependence out of your mix.
This
 is PHP5 also.

 HTH

 - Paul

 -Original Message-
 From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 21, 2004 2:31 AM
 To: phpdb
 Subject: [PHP-DB] Database Abstraction Layer?


 Hello everybody,
 What do you think is the best method to abstract php code from a specific
 database?.
 Make PHP code 100% database independent?..

 Waitin' for your comments.
 Muhammed Mamedov

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHP crashes...

2004-01-21 Thread DiZEM PGC
I have a script called 'login.php' which worked fine until now.
Last dayz i've made a few changes at this script which ones just dealt with
if-expressions.
I've set some vars to values returned by functions and checked (if) these
values afterwards.

Now the execution of this script results in a php crash. Directly after 
return
So I've put some echo commands into the script, but noone is being printed
on screen.
The problem only occurs with this script, others work without
problems/errors.

My configuration:
APACHE V. 1.3.29
PHP V. 4.2.3
MYSQL V. 4.0.16 (Max)

Please help me! 

Peter


 


-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] PHP crashes...

2004-01-21 Thread brett king
Can you give a bit more detail as to what is happening prior to the return
statement?

Brett

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Paul Miller
PEAR is great from what I hear.  The issue you are going to run into with DB
independence is not the function calls which could be handled with something
as simple as sqlalphp.  It is the SQL calls themselves.  The two options I
have found is a SQL library with unembeded SQL or the Propel solution.

Either way adds a significant time to coding and product release initially.

- Paul

-Original Message-
From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 10:07 AM
To: [EMAIL PROTECTED]; phpdb
Subject: Re: [PHP-DB] Database Abstraction Layer?


Hmm..
Thank you for you sql picks:)
But what do you guys think aabout Pear :: DB? Is it as effective as these
Paul's picks?

Thank you.
Muhammed Mamedov

- Original Message -
From: Paul Miller [EMAIL PROTECTED]
To: phpdb [EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 5:44 PM
Subject: RE: [PHP-DB] Database Abstraction Layer?


 There are a couple of products out there that I am about to start testing,
 starting first with:

  - SQL Relay
 http://sqlrelay.sourceforge.net/
 This product uses its on C interfaces to interact with DBs and different
 programming languages.  It addresses a bunch of items in the PHP DB calls.
 Connection pooling and load balancing.

  - Propel
 http://propel.phpdb.org/
 Extensive templates create the SQL definition files you need to setup your
 database and the classes you need to work with your data model in your PHP
 scripts. The classes for your object model are generated from a simple XML
 schema and any customizations are written in plain PHP.

 This will effectively that add SQL and DB dependence out of your mix.
This
 is PHP5 also.

 HTH

 - Paul

 -Original Message-
 From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 21, 2004 2:31 AM
 To: phpdb
 Subject: [PHP-DB] Database Abstraction Layer?


 Hello everybody,
 What do you think is the best method to abstract php code from a specific
 database?.
 Make PHP code 100% database independent?..

 Waitin' for your comments.
 Muhammed Mamedov

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] db2 as a module

2004-01-21 Thread Jason Keltz
Hi.

We run PHP as a DSO through Apache with IBM DB2 support enabled.  We want
to be able to run the same PHP DSO module on a second machine that will
not have support for DB2.  How can I configure PHP via the configuration
file such that DB2 support is enabled on one host, and not on another?

Thanks for any help you can provide.

Jason Keltz
[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: PHP - MsSQL - DB error connect failed - mssql_pconnect?

2004-01-21 Thread Alain Barthlemy
Le mercredi 21 janvier 2004, 13:55:26 ou environ Alain Barthélemy [EMAIL PROTECTED] 
a écrit:

Still another question in my (desperate?) trials to connect to a MsSQL-2000
Server from a Linux host.

I don't work usually with MsSQL but no choice at work. Still problems to have a
connections. I went to see the SQL-server administrator and she found that the
same person had 4 connections to the server (and not having 4 jobs at the same
time). The server is quickly saturated (undersized) and I suppose that the
mssql_connect() request of my PHP script is just ignored because there is no
place left (bad configuration of the MsSQL server?).

Now I wonder if it would be possible to keep a stable connection with
mssql_pconnect()?

Can anybody enlighten me?

-- 
Alain Barthélemy
[EMAIL PROTECTED]
http://bartydeux.be
Linux User #315631

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Database Abstraction Layer?

2004-01-21 Thread Manuel Lemos
Hello,

On 01/21/2004 06:31 AM, Muhammed Mamedov wrote:
What do you think is the best method to abstract php code from a specific database?.
Make PHP code 100% database independent?..
If you really want true portability, you may want to try Metabase or 
PEAR::MDB which is a conversion of Metabase to follow PEAR coding style, 
although not all Metabase drivers have been ported to MDB.

Metabase was written with the specific goal to be truly database 
independent, so you do not have to change anything in your application 
to make it work with different applications.

This means that not only the database access is portable but also the 
schema installation and maintenance. Metabase lets you define your 
database schema in a simple XML format and then it takes care of 
creating the tables, fields, indexes and sequences in any of the 
supported databases.

If you want to change your schema, just edit the XML definition and 
Metabase is capable of figuring what changed and alter the installed 
schema according to the database you are using, without affecting any 
data that was added since the database was installed for the first time 
or after it was updated for the last time.

If you have an application working with an existing database, Metabase 
provides experimental support for migrating the installed schema to the 
database independent XML definition format.

http://www.phpclasses.org/metabase

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: PHP - MsSQL - DB error connect failed - mssql_pconnect?

2004-01-21 Thread Robert Twitty
mssql_pconnect() may add to problem of too many connections.  The reason
is because the persistent connection is associated with the Apache child
process and not the script.  This is significant because you are not
guaranteed to be served by the same child everytime the script is invoked.
Thus, over an extendend period of operation, the result will be a
persistently open connection for each active Apache child process.

-- bob

t
On Wed, 21 Jan 2004, Alain [iso-8859-15] Barthélemy wrote:

 Le mercredi 21 janvier 2004, 13:55:26 ou environ Alain Barthélemy [EMAIL 
 PROTECTED] a écrit:

 Still another question in my (desperate?) trials to connect to a MsSQL-2000
 Server from a Linux host.

 I don't work usually with MsSQL but no choice at work. Still problems to have a
 connections. I went to see the SQL-server administrator and she found that the
 same person had 4 connections to the server (and not having 4 jobs at the same
 time). The server is quickly saturated (undersized) and I suppose that the
 mssql_connect() request of my PHP script is just ignored because there is no
 place left (bad configuration of the MsSQL server?).

 Now I wonder if it would be possible to keep a stable connection with
 mssql_pconnect()?

 Can anybody enlighten me?

 --
 Alain Barthélemy
 [EMAIL PROTECTED]
 http://bartydeux.be
 Linux User #315631

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MSSQL stability problem

2004-01-21 Thread Robert Twitty
Maybe you are running out of connections.

-- bob

On Wed, 21 Jan 2004, Stuart wrote:

 I have a site that makes heavy use of a local SQL Server database. Every
 6-12 hours the site continuously reports not being able to connect to
 the database. That is the only info in the warning that's given. The
 only solution I've found is to restart the Apache and MSSQL services.

 The [MSSQL] section from my php.ini is appended below. IIRC the only
 values I've changed are mssql.textlimit and mssql.textsize.

 Has anyone seen this before? What causes it and how can I stop it
 happening short of restarting the services every 6 hours?

 Thanks.

 --
 Stuart

 [MSSQL]
 ; Allow or prevent persistent links.
 mssql.allow_persistent = On

 ; Maximum number of persistent links.  -1 means no limit.
 mssql.max_persistent = -1

 ; Maximum number of links (persistent+non persistent).  -1 means no limit.
 mssql.max_links = -1

 ; Minimum error severity to display.
 mssql.min_error_severity = 10

 ; Minimum message severity to display.
 mssql.min_message_severity = 10

 ; Compatability mode with old versions of PHP 3.0.
 mssql.compatability_mode = Off

 ; Connect timeout
 ;mssql.connect_timeout = 5

 ; Query timeout
 ;mssql.timeout = 60

 ; Valid range 0 - 2147483647.  Default = 4096.
 mssql.textlimit = 2147483647

 ; Valid range 0 - 2147483647.  Default = 4096.
 mssql.textsize = 2147483647

 ; Limits the number of records in each batch.  0 = all records in one batch.
 ;mssql.batchsize = 0

 ; Specify how datetime and datetim4 columns are returned
 ; On = Returns data converted to SQL server settings
 ; Off = Returns values as -MM-DD hh:mm:ss
 ;mssql.datetimeconvert = On

 ; Use NT authentication when connecting to the server
 mssql.secure_connection = Off

 ; Specify max number of processes. Default = 25
 ;mssql.max_procs = 25

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] using query_strings in sql

2004-01-21 Thread mayo
I'm a cold fusion refugee and am having incredible problems with something
that I think is relatively easy -- so I must be missing something basic.

I would like to pull info from a query string and use it inside a database
call.

I can pull the query string into a general variable:

?php echo $section;  ?

now I would like to use it in a SQL statement, or in 
if/else clauses to modifiy results from queries.

examples below:


USE query_string in SQL :

?php

function whatever(){

$username = ;
...

// setting the default variables

if(!isset($category)){$category=Something;}
if(!isset($section)){$section=SomethingElse;}

[EMAIL PROTECTED]($hostname,$username,$password);
mysql_select_db($database);
$selection = mysql_query(
SELECT *
FROM classes
WHERE
classCategory = '$category'
ORDER BY $reorder $order
)

...

?

The PHP SQL call below work nicely:

while ($row = mysql_fetch_array($selection)){

echo $row[sectionName];

}

now I would like to do an if/else to modifiy it:



while ($row = mysql_fetch_array($selection)){

if (section == $sectionName){
echo b . $row[sectionName] . /b;
}else{
echo $row[sectionName];
}

Nothing is working. I must be missing something basic over here.

thx, Gil

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] using query_strings in sql

2004-01-21 Thread Micah Stevens

I may be misunderstanding you, but your first statement about pulling from a 
query string is throwing me. 

?php echo $section; ? will only display the value of $section on the screen. 
You will need to build a form to get a value into $section. 

form action=soemthing.php
input type=text name=section
/form

something.php:

?php echo This is what was submitted in the form: .$section; ?

Now you can do your query:

$selection = mysql_query(SELECT *
FROM classes
WHERE
classCategory = '$section'
)

you'll notice I pulled the other variables out since you had not defined them 
yet, like your ordering variables. Otherwise the SQL would end with ORDER 
which will cause an error.. 

-Micah


On Wed January 21 2004 10:41 am, mayo wrote:
 I'm a cold fusion refugee and am having incredible problems with something
 that I think is relatively easy -- so I must be missing something basic.

 I would like to pull info from a query string and use it inside a database
 call.

 I can pull the query string into a general variable:

 ?php echo $section;  ?

 now I would like to use it in a SQL statement, or in
 if/else clauses to modifiy results from queries.

 examples below:


 USE query_string in SQL :

 ?php

   function whatever(){

   $username = ;
   ...

   // setting the default variables

   if(!isset($category)){$category=Something;}
   if(!isset($section)){$section=SomethingElse;}

   [EMAIL PROTECTED]($hostname,$username,$password);
   mysql_select_db($database);
   $selection = mysql_query(
   SELECT *
   FROM classes
   WHERE
   classCategory = '$category'
   ORDER BY $reorder $order
   )

   ...

 ?

 The PHP SQL call below work nicely:

 while ($row = mysql_fetch_array($selection)){

 echo $row[sectionName];

 }

 now I would like to do an if/else to modifiy it:



 while ($row = mysql_fetch_array($selection)){

 if (section == $sectionName){
   echo b . $row[sectionName] . /b;
 }else{
   echo $row[sectionName];
 }

 Nothing is working. I must be missing something basic over here.

 thx, Gil

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread mayo
I have a table displaying data. The column headers are links that allow the
users to order the content in ASC or DESC.

basic version is:

a href=somefile.php?order=ASCTitle/a


a closer to reality version is (or would be if it worked)

a href=somefile.php?order=
if ($order == ASC){
echo DESC;
}else{
echo ASC;
}


(Actually that would be a switch/case :-)  )


The sql call is

 $selection = mysql_query(
SELECT *
FROM classes
ORDER BY title $order
)


And since there is no query string when someone lands on the page there
needs to be a default value set:


// setting the default variables

if(!isset($order)){$order=ASC;}

Unfortunately its not working :(


thx, gil


  -Original Message-
  From: Micah Stevens [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 21, 2004 1:59 PM
  To: [EMAIL PROTECTED]
  Cc: mayo
  Subject: Re: [PHP-DB] using query_strings in sql
 
 
 
  I may be misunderstanding you, but your first statement about
  pulling from a
  query string is throwing me.
 
  ?php echo $section; ? will only display the value of $section
  on the screen.
  You will need to build a form to get a value into $section.
 
  form action=soemthing.php
  input type=text name=section
  /form
 
  something.php:
 
  ?php echo This is what was submitted in the form: .$section; ?
 
  Now you can do your query:
 
  $selection = mysql_query(SELECT *
   FROM classes
   WHERE
   classCategory = '$section'
   )
 
  you'll notice I pulled the other variables out since you had not
  defined them
  yet, like your ordering variables. Otherwise the SQL would end
  with ORDER
  which will cause an error..
 
  -Micah
 
 
  On Wed January 21 2004 10:41 am, mayo wrote:
   I'm a cold fusion refugee and am having incredible problems
  with something
   that I think is relatively easy -- so I must be missing
  something basic.
  
   I would like to pull info from a query string and use it
  inside a database
   call.
  
   I can pull the query string into a general variable:
  
   ?php echo $section;  ?
  
   now I would like to use it in a SQL statement, or in
   if/else clauses to modifiy results from queries.
  
   examples below:
  
  
   USE query_string in SQL :
  
   ?php
  
  function whatever(){
  
  $username = ;
  ...
  
  // setting the default variables
  
  if(!isset($category)){$category=Something;}
  if(!isset($section)){$section=SomethingElse;}
  
  [EMAIL PROTECTED]($hostname,$username,$password);
  mysql_select_db($database);
  $selection = mysql_query(
  SELECT *
  FROM classes
  WHERE
  classCategory = '$category'
  ORDER BY $reorder $order
  )
  
  ...
  
   ?
  
   The PHP SQL call below work nicely:
  
   while ($row = mysql_fetch_array($selection)){
  
   echo $row[sectionName];
  
   }
  
   now I would like to do an if/else to modifiy it:
  
  
  
   while ($row = mysql_fetch_array($selection)){
  
   if (section == $sectionName){
  echo b . $row[sectionName] . /b;
   }else{
  echo $row[sectionName];
   }
  
   Nothing is working. I must be missing something basic over here.
  
   thx, Gil
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] using query_strings in sql

2004-01-21 Thread Micah Stevens

What error is it giving you? What's not happening? Saying 'It doesn't work' 
doesn't help much especially when you don't give all the code. 

-Micah

On Wed January 21 2004 11:10 am, mayo wrote:
 I have a table displaying data. The column headers are links that allow the
 users to order the content in ASC or DESC.

 basic version is:

 a href=somefile.php?order=ASCTitle/a


 a closer to reality version is (or would be if it worked)

 a href=somefile.php?order=
   if ($order == ASC){
   echo DESC;
   }else{
   echo ASC;
   }
 

 (Actually that would be a switch/case :-)  )


 The sql call is

  $selection = mysql_query(
   SELECT *
   FROM classes
   ORDER BY title $order
   )


 And since there is no query string when someone lands on the page there
 needs to be a default value set:


 // setting the default variables

 if(!isset($order)){$order=ASC;}

 Unfortunately its not working :(


 thx, gil

   -Original Message-
   From: Micah Stevens [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, January 21, 2004 1:59 PM
   To: [EMAIL PROTECTED]
   Cc: mayo
   Subject: Re: [PHP-DB] using query_strings in sql
  
  
  
   I may be misunderstanding you, but your first statement about
   pulling from a
   query string is throwing me.
  
   ?php echo $section; ? will only display the value of $section
   on the screen.
   You will need to build a form to get a value into $section.
  
   form action=soemthing.php
   input type=text name=section
   /form
  
   something.php:
  
   ?php echo This is what was submitted in the form: .$section; ?
  
   Now you can do your query:
  
   $selection = mysql_query(SELECT *
  FROM classes
  WHERE
  classCategory = '$section'
  )
  
   you'll notice I pulled the other variables out since you had not
   defined them
   yet, like your ordering variables. Otherwise the SQL would end
   with ORDER
   which will cause an error..
  
   -Micah
  
   On Wed January 21 2004 10:41 am, mayo wrote:
I'm a cold fusion refugee and am having incredible problems
  
   with something
  
that I think is relatively easy -- so I must be missing
  
   something basic.
  
I would like to pull info from a query string and use it
  
   inside a database
  
call.
   
I can pull the query string into a general variable:
   
?php echo $section;  ?
   
now I would like to use it in a SQL statement, or in
if/else clauses to modifiy results from queries.
   
examples below:
   
   
USE query_string in SQL :
   
?php
   
 function whatever(){
   
 $username = ;
 ...
   
 // setting the default variables
   
 if(!isset($category)){$category=Something;}
 if(!isset($section)){$section=SomethingElse;}
   
 [EMAIL PROTECTED]($hostname,$username,$password);
 mysql_select_db($database);
 $selection = mysql_query(
 SELECT *
 FROM classes
 WHERE
 classCategory = '$category'
 ORDER BY $reorder $order
 )
   
 ...
   
?
   
The PHP SQL call below work nicely:
   
while ($row = mysql_fetch_array($selection)){
   
echo $row[sectionName];
   
}
   
now I would like to do an if/else to modifiy it:
   
   
   
while ($row = mysql_fetch_array($selection)){
   
if (section == $sectionName){
 echo b . $row[sectionName] . /b;
}else{
 echo $row[sectionName];
}
   
Nothing is working. I must be missing something basic over here.
   
thx, Gil

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] using query_strings in sql

2004-01-21 Thread Rick Dahl
Looking at that.  You are combining html and php without distinguishing
between the two.  I am assuming you are in php mode because html wouldn't
give you errors.  try this:

echo a href='somefile.php?order=;
if ($order == ASC){
echo DESC;
}else{
echo ASC;
}
echo ';


- Original Message -
From: mayo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 1:10 PM
Subject: RE: [PHP-DB] using query_strings in sql


 I have a table displaying data. The column headers are links that allow
the
 users to order the content in ASC or DESC.

 basic version is:

 a href=somefile.php?order=ASCTitle/a


 a closer to reality version is (or would be if it worked)

 a href=somefile.php?order=
 if ($order == ASC){
 echo DESC;
 }else{
 echo ASC;
 }
 

 (Actually that would be a switch/case :-)  )


 The sql call is

  $selection = mysql_query(
 SELECT *
FROM classes
ORDER BY title $order
)


 And since there is no query string when someone lands on the page there
 needs to be a default value set:


 // setting the default variables

 if(!isset($order)){$order=ASC;}

 Unfortunately its not working :(


 thx, gil


   -Original Message-
   From: Micah Stevens [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, January 21, 2004 1:59 PM
   To: [EMAIL PROTECTED]
   Cc: mayo
   Subject: Re: [PHP-DB] using query_strings in sql
  
  
  
   I may be misunderstanding you, but your first statement about
   pulling from a
   query string is throwing me.
  
   ?php echo $section; ? will only display the value of $section
   on the screen.
   You will need to build a form to get a value into $section.
  
   form action=soemthing.php
   input type=text name=section
   /form
  
   something.php:
  
   ?php echo This is what was submitted in the form: .$section; ?
  
   Now you can do your query:
  
   $selection = mysql_query(SELECT *
FROM classes
WHERE
classCategory = '$section'
)
  
   you'll notice I pulled the other variables out since you had not
   defined them
   yet, like your ordering variables. Otherwise the SQL would end
   with ORDER
   which will cause an error..
  
   -Micah
  
  
   On Wed January 21 2004 10:41 am, mayo wrote:
I'm a cold fusion refugee and am having incredible problems
   with something
that I think is relatively easy -- so I must be missing
   something basic.
   
I would like to pull info from a query string and use it
   inside a database
call.
   
I can pull the query string into a general variable:
   
?php echo $section;  ?
   
now I would like to use it in a SQL statement, or in
if/else clauses to modifiy results from queries.
   
examples below:
   
   
USE query_string in SQL :
   
?php
   
function whatever(){
   
$username = ;
...
   
// setting the default variables
   
if(!isset($category)){$category=Something;}
if(!isset($section)){$section=SomethingElse;}
   
[EMAIL PROTECTED]($hostname,$username,$password);
mysql_select_db($database);
$selection = mysql_query(
SELECT *
FROM classes
WHERE
classCategory = '$category'
ORDER BY $reorder $order
)
   
...
   
?
   
The PHP SQL call below work nicely:
   
while ($row = mysql_fetch_array($selection)){
   
echo $row[sectionName];
   
}
   
now I would like to do an if/else to modifiy it:
   
   
   
while ($row = mysql_fetch_array($selection)){
   
if (section == $sectionName){
echo b . $row[sectionName] . /b;
}else{
echo $row[sectionName];
}
   
Nothing is working. I must be missing something basic over here.
   
thx, Gil
  

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread mayo
my bad: I typed in the script and forgot the echo.

-- gil



  -Original Message-
  From: Rick Dahl [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 21, 2004 2:28 PM
  To: mayo; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] using query_strings in sql
 
 
  Looking at that.  You are combining html and php without distinguishing
  between the two.  I am assuming you are in php mode because
  html wouldn't
  give you errors.  try this:
 
  echo a href='somefile.php?order=;
  if ($order == ASC){
  echo DESC;
  }else{
  echo ASC;
  }
  echo ';
 
 
  - Original Message -
  From: mayo [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, January 21, 2004 1:10 PM
  Subject: RE: [PHP-DB] using query_strings in sql
 
 
   I have a table displaying data. The column headers are links that allow
  the
   users to order the content in ASC or DESC.
  
   basic version is:
  
   a href=somefile.php?order=ASCTitle/a
  
  
   a closer to reality version is (or would be if it worked)
  
   a href=somefile.php?order=
   if ($order == ASC){
   echo DESC;
   }else{
   echo ASC;
   }
   
  
   (Actually that would be a switch/case :-)  )
  
  
   The sql call is
  
$selection = mysql_query(
   SELECT *
  FROM classes
  ORDER BY title $order
  )
  
  
   And since there is no query string when someone lands on the page there
   needs to be a default value set:
  
  
   // setting the default variables
  
   if(!isset($order)){$order=ASC;}
  
   Unfortunately its not working :(
  
  
   thx, gil
  
  
 -Original Message-
 From: Micah Stevens [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 21, 2004 1:59 PM
 To: [EMAIL PROTECTED]
 Cc: mayo
 Subject: Re: [PHP-DB] using query_strings in sql



 I may be misunderstanding you, but your first statement about
 pulling from a
 query string is throwing me.

 ?php echo $section; ? will only display the value of $section
 on the screen.
 You will need to build a form to get a value into $section.

 form action=soemthing.php
 input type=text name=section
 /form

 something.php:

 ?php echo This is what was submitted in the form: .$section; ?

 Now you can do your query:

 $selection = mysql_query(SELECT *
  FROM classes
  WHERE
  classCategory = '$section'
  )

 you'll notice I pulled the other variables out since you had not
 defined them
 yet, like your ordering variables. Otherwise the SQL would end
 with ORDER
 which will cause an error..

 -Micah


 On Wed January 21 2004 10:41 am, mayo wrote:
  I'm a cold fusion refugee and am having incredible problems
 with something
  that I think is relatively easy -- so I must be missing
 something basic.
 
  I would like to pull info from a query string and use it
 inside a database
  call.
 
  I can pull the query string into a general variable:
 
  ?php echo $section;  ?
 
  now I would like to use it in a SQL statement, or in
  if/else clauses to modifiy results from queries.
 
  examples below:
 
 
  USE query_string in SQL :
 
  ?php
 
  function whatever(){
 
  $username = ;
  ...
 
  // setting the default variables
 
  if(!isset($category)){$category=Something;}
  if(!isset($section)){$section=SomethingElse;}
 
  [EMAIL PROTECTED]($hostname,$username,$password);
  mysql_select_db($database);
  $selection = mysql_query(
  SELECT *
  FROM classes
  WHERE
  classCategory = '$category'
  ORDER BY $reorder $order
  )
 
  ...
 
  ?
 
  The PHP SQL call below work nicely:
 
  while ($row = mysql_fetch_array($selection)){
 
  echo $row[sectionName];
 
  }
 
  now I would like to do an if/else to modifiy it:
 
 
 
  while ($row = mysql_fetch_array($selection)){
 
  if (section == $sectionName){
  echo b . $row[sectionName] . /b;
  }else{
  echo $row[sectionName];
  }
 
  Nothing is working. I must be missing something basic over here.
 
  thx, Gil

  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Selecting last record only

2004-01-21 Thread -{ Rene Brehmer }-
Hi gang

this is probably ridicously simple, but I'm new at this SQL stuff, so am a
bit stumped.

It's pretty simple: how do I get only the last record from a single table?

Trying to convert my file-based website into DB-based, but can't quite
figure out how to do this simple task.

Table name is history, and only have 3 fields:
histID, date, entry

I need it to pick the last record without knowing the date of it. Got
picking specific records down good, but be damned if I can figure this one
out...

TIA

Rene
Rene Brehmer
aka Metalbunny

http://metalbunny.net/
References, tools, and other useful stuff...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Selecting last record only

2004-01-21 Thread Micah Stevens
Reverse the order and limit the result to 1. 

For example, change:
SELECT date, item from some_table

To:

Select date, item from some_table ORDER BY date DESC LIMIT 1

to get the latest dated item. 

-Micah

On Wed January 21 2004 11:49 am, -{ Rene Brehmer }- wrote:
 Hi gang

 this is probably ridicously simple, but I'm new at this SQL stuff, so am a
 bit stumped.

 It's pretty simple: how do I get only the last record from a single table?

 Trying to convert my file-based website into DB-based, but can't quite
 figure out how to do this simple task.

 Table name is history, and only have 3 fields:
 histID, date, entry

 I need it to pick the last record without knowing the date of it. Got
 picking specific records down good, but be damned if I can figure this one
 out...

 TIA

 Rene
 Rene Brehmer
 aka Metalbunny

 http://metalbunny.net/
 References, tools, and other useful stuff...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread mayo
good point Micah !! :-)

I don't get an error msg. Nothing happens.

included is the file

Below are the three issues I have with query_strings and sql. The formatting
is of the .php page is awful. I'm not certain it's legible.


1. Main issue -- be able to use a query_string variable in a sql statement

SELECT *
FROM whatever
WHERE someField = '$queryString_variable'

2. Be able to set defaults in case variable doesn't exist.

if(!isset($category)){$category=Shop;}

3. be able to modify results from a sql query with a query_string variable

$selection = mysql_query(
while ($row = mysql_fetch_array($selection)){

if (query_variable is X){

echo $row[classID];
}else{
echo b . $row[classID] . /b;
}


thanks all, this is driving me crazy. My bad for taking this project. Easy
for me in Cold Fusion, driving me nuts in PHP.

?php


function getClasses(){

$username=;
$password=;
$database=XXX;
$hostname=localhost;

global $category;
global $Section;
global $reorder;
global $order;
global $location;


if(!isset($category)){$category=Shop;}
if(!isset($section)){$section=All;}
if(!isset($reorder)){$reorder=classCode;}
if(!isset($order)){$order=DESC;}
if(!isset($location)){$location=ALL;}


[EMAIL PROTECTED]($hostname,$username,$password);
mysql_select_db($database);

$selection = mysql_query(
SELECT *
FROM classes
WHERE
classCategory 
='$category' AND
classDeleted = 0
ORDER BY $reorder $order

);


echo table border\n;
echo tr\n;
echo th class=\header\nbsp;/th\n;
echo th class=\header\nbsp;/th\n;
echo th class=\header\nbsp;/th\n;

echo th class=\header\Section;

/* *** AREA WITH PROBLEM *
if ($section == All){

print $category;

if ($reorder == classSection  $order == ASC){
echo a
href=\eventsAdminList.php?category=KnittingSection=Allreorder=classSectio
norder=DESC\ class=\header\Section -up img
src=\/knittinghands/graphics/arrow-up.gif\ border=\0\ alt=\\/a;
}elseif($reorder == classSection  $order == DESC){
echo a
href=\eventsAdminList.php?category=KnittingSection=Allreorder=classSectio
norder=ASC\ class=\header\ class=\header\Sectionimg
src=\/knittinghands/graphics/arrow-down.gif\ border=\0\ alt=\\/a;

}else{
echo a
href=\eventsAdminList.php?category=KnittingSection=Allreorder=classSectio
norder=ASC\ class=\header\Section - noimg
src=\/knittinghands/graphics/arrow-none.gif\ border=\0\ alt=\\/a ;
}

}else{

if ($reorder == classSection  $order == ASC){
echo a
href=\eventsAdminList.php?category=Knittingsection=Allreorder=classSectio
norder=DESC\ class=\header\Sectionimg
src=\/knittinghands/graphics/arrow-up.gif\ border=\0\ alt=\\/a;
}elseif($reorder == classSection  $order == DESC){
echo a
href=\eventsAdminList.php?category=Knittingsection=Allreorder=classSectio
norder=ASC\ class=\header\ class=\header\Sectionimg
src=\/knittinghands/graphics/arrow-down.gif\ border=\0\ alt=\\/a;

}else{
echo a
href=\eventsAdminList.php?category=Knittingsection=Allreorder=classSectio
norder=ASC\ class=\header\Sectionimg
src=\/knittinghands/graphics/arrow-none.gif\ border=\0\ alt=\\/a ;

}
}

 */
echo /th\n;

echo th class=\header\Code/th\n;
echo th class=\header\Class Title/th\n;
echo th class=\header\Cost/th\n;

while ($row = mysql_fetch_array($selection)){
echo tr\n \n;
echo tda href=\eventsAdminEdit.php?class= . $row[classID] .
\EDIT/a/td;
echo tda href=\eventsAdminDelete.php?class= . $row[classID] .
\DEL/a/td;

if ($row[classHide] == 0){
echo tda href=\eventsAdminHide.php?act=hideclass= . 
$row[classID]
. \HIDE/a/td;
}else{
echo td class=\hide\a 
href=\eventsAdminHide.php?act=unhideclass=
. $row[classID] . \unhide/a/td;
}
// if ($section == All){
//  echo tdnobr . $row[classSection] . /nobr/td;
//  }
echo td . $row[classCode] . /td;
echo tda href=\eventsAdminListMore.php?category= .
$row[classCategory] . section= . $row[classSection] . id= .
$row[classID] . \ class=\none\ . $row[classTitle] . /a/td;

echo td align=\right\ $. $row[classCost] . 

Re: [PHP-DB] using query_strings in sql

2004-01-21 Thread Micah Stevens

Here goes: 

1) That should work fine. Be sure and enclose the SQL in double quotes or the 
variable will not get translated into its value.

2) That's fine too, nothing wrong there.

3) this is wrong, but it looks like you just ommited the SQL statement. Be 
sure and use the or die statement as it will forward any SQL errors to the 
screen. 

$selection = mysql_query(SELECT *
 FROM whatever
 WHERE someField = '$queryString_variable') or die(mysql_error()); 
while ($row = mysql_fetch_array($selection)){

if (query_variable is X){

echo $row[classID];
}else{
echo b . $row[classID] . /b;
}

There isn't anything obviously wrong with the code, it should be doing 
something, at least printing out the html heading information. Try looking at 
the page source for errors as well.  Change the query to include the or 
die(mysql_error()); code because the script might be dying with a SQL error 
and you just aren't seeing it printed out. 

-Micah 

On Wed January 21 2004 11:49 am, mayo wrote:
 good point Micah !! :-)

 I don't get an error msg. Nothing happens.

 included is the file

 Below are the three issues I have with query_strings and sql. The
 formatting is of the .php page is awful. I'm not certain it's legible.


 1. Main issue -- be able to use a query_string variable in a sql statement

 SELECT *
 FROM whatever
 WHERE someField = '$queryString_variable'

 2. Be able to set defaults in case variable doesn't exist.

 if(!isset($category)){$category=Shop;}

 3. be able to modify results from a sql query with a query_string variable

 $selection = mysql_query(
   while ($row = mysql_fetch_array($selection)){

   if (query_variable is X){

   echo $row[classID];
   }else{
   echo b . $row[classID] . /b;
   }


 thanks all, this is driving me crazy. My bad for taking this project. Easy
 for me in Cold Fusion, driving me nuts in PHP.

 ?php


 function getClasses(){

 $username=;
 $password=;
 $database=XXX;
 $hostname=localhost;

 global $category;
 global $Section;
 global $reorder;
 global $order;
 global $location;



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: PHP - MsSQL - DB error connect failed - mssql_pconnect?

2004-01-21 Thread Alain Barthlemy
Le mercredi 21 janvier 2004, 13:07:24 ou environ Robert Twitty [EMAIL PROTECTED] a 
écrit:
 mssql_pconnect() may add to problem of too many connections.  The reason
 is because the persistent connection is associated with the Apache child
 process and not the script.  This is significant because you are not
 guaranteed to be served by the same child everytime the script is invoked.
 Thus, over an extendend period of operation, the result will be a
 persistently open connection for each active Apache child process.
 
 -- bob

Thank you for this explanation. That is well what I supposed. I guess the other
MsSQL clients (Windows) are doing something like a permanent connection. I
can't force my way through with my Linux/PHP host. I secretly hoped that
mssql_pconnect would allow me to have a materially permanent connection and
prevent anybody to take my place. Well! It was just a hope. I hoped too to
launch plenty of permanent connections and prevent the others to connect in
order to force the administrator to think how to solve the problem if there was
a way to solve it. I must say I am doing a development work of connection of a
Linux server with Apache/PHP to a MsSQL-2000 server in an environment dominated
by Windows/IIS/ASP. IIS/ASP are for me a pain in the ass (I respect the others
with another opinion) but I have to understand very well the inner working of
the MsSQL server without having access to the configuration of it (personnaly I
don't think the administrator understands it which is another problem). Thus
any hint is welcome.

Thank you again.

Alain 

 
 t
 On Wed, 21 Jan 2004, Alain [iso-8859-15] Barthélemy wrote:
 
  Le mercredi 21 janvier 2004, 13:55:26 ou environ Alain Barthélemy [EMAIL 
  PROTECTED] a écrit:
 
  Still another question in my (desperate?) trials to connect to a MsSQL-2000
  Server from a Linux host.
 
  I don't work usually with MsSQL but no choice at work. Still problems to have a
  connections. I went to see the SQL-server administrator and she found that the
  same person had 4 connections to the server (and not having 4 jobs at the same
  time). The server is quickly saturated (undersized) and I suppose that the
  mssql_connect() request of my PHP script is just ignored because there is no
  place left (bad configuration of the MsSQL server?).
 
  Now I wonder if it would be possible to keep a stable connection with
  mssql_pconnect()?
 
  Can anybody enlighten me?
 
  --
  Alain Barthélemy
  [EMAIL PROTECTED]
  http://bartydeux.be
  Linux User #315631
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 ###
 This message has been checked against known virusses and was found to be virus-free.
 Dit bericht werd gecontroleerd op bekende virussen en werd virusvrij bevonden
 Ce message a été vérifié et est certifié exempt de virus connus.
 
 Scientific Institute of Public Health, J.Wytsmanstreet 14, B-1050 Brussels, Belgium
 Wetenschappelijk Instituut Volksgezondheid, J.Wytsmanstraat 14, B-1050 Brussel, 
 België
 Institut scientifique de santé Publique, 14 rue J.Wytsman, B-1050 Bruxelles, Belgique
 Visit our website: http://www.iph.fgov.be
 Tel: +32 2 642 51 11   Fax: +32 2 642 50 01
 ###

-- 
Alain Barthélemy
[EMAIL PROTECTED]
http://bartydeux.be
Linux User #315631

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP - MsSQL - DB error connect failed

2004-01-21 Thread Alain Barthlemy
Le Wednesday 21 January 2004, 12:54:18 ou environ Robert Twitty [EMAIL PROTECTED] a 
écrit:

Hi again Bob,

It was about 13h00 (13 pm) when you sent this mail and about 8 pm here. Thus
give me time to go back to work tomorrow morning and to study the question. If
interested I contact again.

Good Night,

Alain

 Hi Alain
 
 ODBTP is a protocol that provides remote access to WIn32-based ODBC
 drivers. More details are available at http://odbtp.sourceforge.net.  I
 created it because PHP's mssql ext did not adequately support SQL Server
 7.0 and 2000.  The main problem with this ext is that on UNIX it was built
 with FreeTDS, a reengineered and sometimes faulty version of the TDS
 protocol.  On Windows it was built with the obsolete and unsupported
 DB-Library, which does not support ntext or varchar(255) data types.
 
 ODBTP provides the best access to MSSQL because it uses the ODBC driver
 for SQL Server by Microsoft.  It is faster than the FreeTDS version, and
 is equal in speed to the DB-Library version.
 
 Version 1.0 is publically available at SourceForge.  Version 1.1 will be
 released soon.  This version should interest you because it provides
 support for all of the mssql_* functions.
 
 Let me know if you want to try it.
 
 -- bob
 
 
 
 On Wed, 21 Jan 2004, Alain [iso-8859-15] Barthélemy wrote:
 
  Le Wednesday 21 January 2004, 10:33:38 ou environ Robert Twitty [EMAIL 
  PROTECTED] a écrit:
 
  Hi Bob,
 
  ODBC - ODBTP?
 
  I thought of installing the ODBC driver but I read it was still in development
  and not fully operational and as long as FreeTDS worked ...
 
  Of course, I have not heard of ODBTP yet but I am not a specialist of Windows.
 
   Hi Alain
  
   Would you like to try a better solution for connecting to MSSQL?  It does
   not use FreeTDS, and will not require you to change your code. It's called
   ODBTP.
  
   -- bob
  
   On Wed, 21 Jan 2004, Alain [iso-8859-15] Barthélemy wrote:
  
It is not directly PHP but it is Db with PHP/Linux
   
Linux 2.4.19-4GB
Apache: httpd-2.0.48
php-4.3.4
freetds-0.61.2
   
I have php pages to connect to MsSQL-2000 server
   
$conn = mssql_connect($server, $user, $pass)
or die ;
   
or (PEAR:Db)
   
$dsn = mssql://$user:[EMAIL PROTECTED]/$dbname;
if (DB::isError($db)) {die ($db-getMessage()); }
   
PHP-pages with these instructions worked this morning.
Later and still now: DB error connect failed : impossible to connect now.
   
I suspect the MsSQL server to be overloaded.
   
Other users (Windows) are connecting via piped names
   
Myself (on Linux) connect via IP-address
   
If I reboot in Windows-2000 (Dual-boot system): no problem to access Db (piped
name).
   
If I make a test (on Linux) with tsql (FreeTDS): connection OK
   
Only problem is to try connecting through Apache/PHP on Linux via IP-Address
   
I had once problem making a DHCP enquiry on a Windows server from a Linux Host
and I had to increase the TimeOut thus I wondered if I do not have the same
problem now.
   
I checked thus /www/conf/php.ini
I uncommented the lines:
   
mssql.connect_timeout = 10
mssql.timeout = 60
   
and tried higher numbers but without success. Apache/PHP don't seem to repeat
the request till success.
   
If anybody knows of a way to awake or shake MsSQL (apart from blowing it). Of
course, the obvious is to install MySQL bur I am not the master here.
   

-- 
Alain Barthélemy
[EMAIL PROTECTED]
http://bartydeux.be
Linux User #315631

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread mayo
oops. I guess I was too loose with my words ---

something does happen, just not what I want!   :-)

The page displays. The sql works, the or die doesn't return anything.

I'm able to change the sql by changing the default values.

WHAT DOESN'T HAPPEN is that the query_string values DO NOT trump the default
variables.

so query_string = ?class=Xsection=Yorder=ASC

I can't input these variables : $class,$section,$order into the SQL
statement

SELECT *
FROM classes
WHERE section=$section
ORDER BY $class $order

-- gil

thx for all your patience



  -Original Message-
  From: Micah Stevens [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 21, 2004 3:12 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] using query_strings in sql
 
 
 
  Here goes:
 
  1) That should work fine. Be sure and enclose the SQL in double
  quotes or the
  variable will not get translated into its value.
 
  2) That's fine too, nothing wrong there.
 
  3) this is wrong, but it looks like you just ommited the SQL
  statement. Be
  sure and use the or die statement as it will forward any SQL
  errors to the
  screen.
 
  $selection = mysql_query(SELECT *
   FROM whatever
   WHERE someField = '$queryString_variable') or die(mysql_error());
  while ($row = mysql_fetch_array($selection)){
 
  if (query_variable is X){
 
  echo $row[classID];
  }else{
  echo b . $row[classID] . /b;
  }
 
  There isn't anything obviously wrong with the code, it should be doing
  something, at least printing out the html heading information.
  Try looking at
  the page source for errors as well.  Change the query to include the or
  die(mysql_error()); code because the script might be dying with
  a SQL error
  and you just aren't seeing it printed out.
 
  -Micah
 
  On Wed January 21 2004 11:49 am, mayo wrote:
   good point Micah !! :-)
  
   I don't get an error msg. Nothing happens.
  
   included is the file
  
   Below are the three issues I have with query_strings and sql. The
   formatting is of the .php page is awful. I'm not certain it's legible.
  
  
   1. Main issue -- be able to use a query_string variable in a
  sql statement
  
   SELECT *
   FROM whatever
   WHERE someField = '$queryString_variable'
  
   2. Be able to set defaults in case variable doesn't exist.
  
   if(!isset($category)){$category=Shop;}
  
   3. be able to modify results from a sql query with a
  query_string variable
  
   $selection = mysql_query(
  while ($row = mysql_fetch_array($selection)){
  
  if (query_variable is X){
  
  echo $row[classID];
  }else{
  echo b . $row[classID] . /b;
  }
  
  
   thanks all, this is driving me crazy. My bad for taking this
  project. Easy
   for me in Cold Fusion, driving me nuts in PHP.
  
   ?php
  
  
   function getClasses(){
  
   $username=;
   $password=;
   $database=XXX;
   $hostname=localhost;
  
   global $category;
   global $Section;
   global $reorder;
   global $order;
   global $location;
  
  
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread Matt Matijevich
snip
WHAT DOESN'T HAPPEN is that the query_string values DO NOT trump the
default
variables.

so query_string = ?class=Xsection=Yorder=ASC

I can't input these variables : $class,$section,$order into the SQL
statement

SELECT *
FROM classes
WHERE section=$section
ORDER BY $class $order
/snip

I am getting in really late in this disussion so I apologize if I am
off base here but if you have register_globals off

$section, $class, and $order wont get set.

try this:
$section = $_GET['section'];
$class = $_GET['class'];
$order = $_GET['order'];

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] using query_strings in sql

2004-01-21 Thread Micah Stevens

You may have register Globals turned off in php.ini.

Try adding:

 extract($_GET)

in the code before the function gets called. That's not a very secure method, 
but it will prove whether or not that's the problem. 

-Micah


On Wed January 21 2004 12:43 pm, mayo wrote:
 oops. I guess I was too loose with my words ---

 something does happen, just not what I want!   :-)

 The page displays. The sql works, the or die doesn't return anything.

 I'm able to change the sql by changing the default values.

 WHAT DOESN'T HAPPEN is that the query_string values DO NOT trump the
 default variables.

 so query_string = ?class=Xsection=Yorder=ASC

 I can't input these variables : $class,$section,$order into the SQL
 statement

 SELECT *
 FROM classes
 WHERE section=$section
 ORDER BY $class $order

 -- gil

 thx for all your patience

   -Original Message-
   From: Micah Stevens [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, January 21, 2004 3:12 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] using query_strings in sql
  
  
  
   Here goes:
  
   1) That should work fine. Be sure and enclose the SQL in double
   quotes or the
   variable will not get translated into its value.
  
   2) That's fine too, nothing wrong there.
  
   3) this is wrong, but it looks like you just ommited the SQL
   statement. Be
   sure and use the or die statement as it will forward any SQL
   errors to the
   screen.
  
   $selection = mysql_query(SELECT *
FROM whatever
WHERE someField = '$queryString_variable') or die(mysql_error());
   while ($row = mysql_fetch_array($selection)){
  
   if (query_variable is X){
  
   echo $row[classID];
   }else{
   echo b . $row[classID] . /b;
   }
  
   There isn't anything obviously wrong with the code, it should be doing
   something, at least printing out the html heading information.
   Try looking at
   the page source for errors as well.  Change the query to include the or
   die(mysql_error()); code because the script might be dying with
   a SQL error
   and you just aren't seeing it printed out.
  
   -Micah
  
   On Wed January 21 2004 11:49 am, mayo wrote:
good point Micah !! :-)
   
I don't get an error msg. Nothing happens.
   
included is the file
   
Below are the three issues I have with query_strings and sql. The
formatting is of the .php page is awful. I'm not certain it's legible.
   
   
1. Main issue -- be able to use a query_string variable in a
  
   sql statement
  
SELECT *
FROM whatever
WHERE someField = '$queryString_variable'
   
2. Be able to set defaults in case variable doesn't exist.
   
if(!isset($category)){$category=Shop;}
   
3. be able to modify results from a sql query with a
  
   query_string variable
  
$selection = mysql_query(
 while ($row = mysql_fetch_array($selection)){
   
 if (query_variable is X){
   
 echo $row[classID];
 }else{
 echo b . $row[classID] . /b;
 }
   
   
thanks all, this is driving me crazy. My bad for taking this
  
   project. Easy
  
for me in Cold Fusion, driving me nuts in PHP.
   
?php
   
   
function getClasses(){
   
$username=;
$password=;
$database=XXX;
$hostname=localhost;
   
global $category;
global $Section;
global $reorder;
global $order;
global $location;
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread mayo
brother that was it

at least as far as putting a query_string variable into a sql statement.

thx

I'll have to see how it works regarding if-else clauses

-gil

  -Original Message-
  From: Matt Matijevich [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 21, 2004 3:53 PM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] using query_strings in sql
  
  
  snip
  WHAT DOESN'T HAPPEN is that the query_string values DO NOT trump the
  default
  variables.
  
  so query_string = ?class=Xsection=Yorder=ASC
  
  I can't input these variables : $class,$section,$order into the SQL
  statement
  
  SELECT *
  FROM classes
  WHERE section=$section
  ORDER BY $class $order
  /snip
  
  I am getting in really late in this disussion so I apologize if I am
  off base here but if you have register_globals off
  
  $section, $class, and $order wont get set.
  
  try this:
  $section = $_GET['section'];
  $class = $_GET['class'];
  $order = $_GET['order'];
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread mayo
it works

thx Micah (and Matt)

I have no knowledge (YET) of how to prevent sql injection attacks with php.
For this project I'm not too concerned as it is in a password protected area
and only 2 or 3 people have access to it.

I hope this works with the rest of the issues...

:-)

-- gil



  -Original Message-
  From: Micah Stevens [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 21, 2004 4:01 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] using query_strings in sql
 
 
 
  You may have register Globals turned off in php.ini.
 
  Try adding:
 
   extract($_GET)
 
  in the code before the function gets called. That's not a very
  secure method,
  but it will prove whether or not that's the problem.
 
  -Micah
 
 
  On Wed January 21 2004 12:43 pm, mayo wrote:
   oops. I guess I was too loose with my words ---
  
   something does happen, just not what I want!   :-)
  
   The page displays. The sql works, the or die doesn't return anything.
  
   I'm able to change the sql by changing the default values.
  
   WHAT DOESN'T HAPPEN is that the query_string values DO NOT trump the
   default variables.
  
   so query_string = ?class=Xsection=Yorder=ASC
  
   I can't input these variables : $class,$section,$order into the SQL
   statement
  
   SELECT *
   FROM classes
   WHERE section=$section
   ORDER BY $class $order
  
   -- gil
  
   thx for all your patience
  
 -Original Message-
 From: Micah Stevens [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 21, 2004 3:12 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] using query_strings in sql



 Here goes:

 1) That should work fine. Be sure and enclose the SQL in double
 quotes or the
 variable will not get translated into its value.

 2) That's fine too, nothing wrong there.

 3) this is wrong, but it looks like you just ommited the SQL
 statement. Be
 sure and use the or die statement as it will forward any SQL
 errors to the
 screen.

 $selection = mysql_query(SELECT *
  FROM whatever
  WHERE someField = '$queryString_variable') or die(mysql_error());
 while ($row = mysql_fetch_array($selection)){

 if (query_variable is X){

 echo $row[classID];
 }else{
 echo b . $row[classID] . /b;
 }

 There isn't anything obviously wrong with the code, it
  should be doing
 something, at least printing out the html heading information.
 Try looking at
 the page source for errors as well.  Change the query to
  include the or
 die(mysql_error()); code because the script might be dying with
 a SQL error
 and you just aren't seeing it printed out.

 -Micah

 On Wed January 21 2004 11:49 am, mayo wrote:
  good point Micah !! :-)
 
  I don't get an error msg. Nothing happens.
 
  included is the file
 
  Below are the three issues I have with query_strings and sql. The
  formatting is of the .php page is awful. I'm not certain
  it's legible.
 
 
  1. Main issue -- be able to use a query_string variable in a

 sql statement

  SELECT *
  FROM whatever
  WHERE someField = '$queryString_variable'
 
  2. Be able to set defaults in case variable doesn't exist.
 
  if(!isset($category)){$category=Shop;}
 
  3. be able to modify results from a sql query with a

 query_string variable

  $selection = mysql_query(
while ($row = mysql_fetch_array($selection)){
 
if (query_variable is X){
 
echo $row[classID];
}else{
echo b . $row[classID] . /b;
}
 
 
  thanks all, this is driving me crazy. My bad for taking this

 project. Easy

  for me in Cold Fusion, driving me nuts in PHP.
 
  ?php
 
 
  function getClasses(){
 
  $username=;
  $password=;
  $database=XXX;
  $hostname=localhost;
 
  global $category;
  global $Section;
  global $reorder;
  global $order;
  global $location;

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] using query_strings in sql

2004-01-21 Thread Matt Matijevich
snip
I have no knowledge (YET) of how to prevent sql injection attacks with
php.
/snip

Just yesterday I read a short tutorial on http://www.dotgeek.org on how
to prevent sql injection.

The site is down right now for maintenance otherwise I would have a
direct link to the article for you.

try searching google: php prevent sql injection

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Selecting last record only

2004-01-21 Thread -{ Rene Brehmer }-
thx a bunch :) ... figured it would be something simple ... :p

Rene

Fate would have it, that on Wed, 21 Jan 2004 11:55:23 -0800, Micah Stevens
wrote:

Reverse the order and limit the result to 1. 

For example, change:
SELECT date, item from some_table

To:

Select date, item from some_table ORDER BY date DESC LIMIT 1

to get the latest dated item. 

-Micah

Rene Brehmer
aka Metalbunny

http://metalbunny.net/
References, tools, and other useful stuff...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] CREATE TABLE problem

2004-01-21 Thread js
ok im making this page and every single time i try to execute it, it tells me it was 
not successful. the database name, user,pw,and local host are all correct. i have no 
idea what do do, and i have 2 more tables besides this one i wanted to create but this 
was kind of my template for it and i cant even get it to work. im still really bad 
with this kind of stuff so any help i could get from you is really appreciated. 
thanks. here is the code:

html
head
titleUntitled Document/title
/head

body
?php

$host = localhost;
$user = user;
$password = ;
$dbname = swwdb;

$link = mysql_connect($host,$user,$password);

$query = CREATE TABLE staff (
 staffid INT(3) NOT NULL AUTO_INCREMENT UNSIGNED,
 name VARCHAR(255) NOT NULL,
 login VARCHAR(10) NOT NULL,
 password VARCHAR(8) NOT NULL,
 picaddy VARCHAR(255) NOT NULL,
 email VARCHAR(255)  NOT NULL,
 staffbio TEXT NOT NULL,
 createdate DATE NOT NULL,
 tagline VARCHAR(255) NOT NULL,
 PRIMARY KEY(staffid,login) );

if (mysql_db_query ($dbname,$query,$link)) {
 print (the query was successfull);
} else {
 print (the query was NOT success);
 }
 
mysql_close($link);
?



/body
/html


Re: [PHP-DB] CREATE TABLE problem

2004-01-21 Thread Micah Stevens
mysql_db_query ($dbname,$query,$link) or die(myself_error());

will help you more than your if/then statement.. change that, and check out 
the error message. 


On Wed January 21 2004 2:33 pm, js wrote:
 ok im making this page and every single time i try to execute it, it tells
 me it was not successful. the database name, user,pw,and local host are all
 correct. i have no idea what do do, and i have 2 more tables besides this
 one i wanted to create but this was kind of my template for it and i cant
 even get it to work. im still really bad with this kind of stuff so any
 help i could get from you is really appreciated. thanks. here is the code:

 html
 head
 titleUntitled Document/title
 /head

 body
 ?php

 $host = localhost;
 $user = user;
 $password = ;
 $dbname = swwdb;

 $link = mysql_connect($host,$user,$password);

 $query = CREATE TABLE staff (
  staffid INT(3) NOT NULL AUTO_INCREMENT UNSIGNED,
  name VARCHAR(255) NOT NULL,
  login VARCHAR(10) NOT NULL,
  password VARCHAR(8) NOT NULL,
  picaddy VARCHAR(255) NOT NULL,
  email VARCHAR(255)  NOT NULL,
  staffbio TEXT NOT NULL,
  createdate DATE NOT NULL,
  tagline VARCHAR(255) NOT NULL,
  PRIMARY KEY(staffid,login) );

 if (mysql_db_query ($dbname,$query,$link)) {
  print (the query was successfull);
 } else {
  print (the query was NOT success);
  }

 mysql_close($link);
 ?



 /body
 /html

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] A site mapped in a database / xml

2004-01-21 Thread Shaun
Hi,

I have an question on how to create a completely database / xml driven site
i.e. the page names, links, the site map etc are held in the database. I
think I have solved most problems but what I would really like to do is
limit the number of pages I need. Can I manipulate the server such that if I
have links to a pages; a href=red_hats.phpred_hats.php/a and a
href=yellow_hats.phpyellow_hats.php/a can both these pages and others
link to a different page that dynamically constructs whilst the links aren't
altered. Maybe is there some way that a default php page is called that
reads the link of the page called etc.

I would be most grateful for your input on this.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] CREATE TABLE problem redefined

2004-01-21 Thread js
ok i did the mysql_error DIE thing, and now it tells me this: 

You have an error in your SQL syntax near 'UNSIGNED, name VARCHAR(255) NOT NULL, login 
VARCHAR(10) NOT NULL, password' at line 2

i have no idea what it means. i dont think any of those are taken or reserved by PHP 
or mySQL. any further help would be great. thank you.
-james

[PHP-DB] Re: A site mapped in a database / xml

2004-01-21 Thread Manuel Lemos
Hello,

On 01/21/2004 08:52 PM, Shaun wrote:
I have an question on how to create a completely database / xml driven site
i.e. the page names, links, the site map etc are held in the database. I
think I have solved most problems but what I would really like to do is
limit the number of pages I need. Can I manipulate the server such that if I
have links to a pages; a href=red_hats.phpred_hats.php/a and a
href=yellow_hats.phpyellow_hats.php/a can both these pages and others
link to a different page that dynamically constructs whilst the links aren't
altered. Maybe is there some way that a default php page is called that
reads the link of the page called etc.
I think this class does exactly what you ask:

Class: XMap
http://www.phpclasses.org/xmap
--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] CREATE TABLE problem redefined

2004-01-21 Thread John W. Holmes
js wrote:

You have an error in your SQL syntax near 'UNSIGNED, 
name VARCHAR(255) NOT NULL, login VARCHAR(10) NOT NULL, 
password' at line 2
Print (echo) out your entire query. You have a syntax error before the 
point the error message mentions.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Truncated fields

2004-01-21 Thread Michael Lewis
I'm having a problem with retrieving field data from SQL SERVER 2000 and am
not sure where the problem lies. I have a variable length field (from 100 -
1 characters). When I retrieve the field using a select statement, then
into a PHP variable such as $text=$r['body_text'], then the field seems to
be truncated after a good bit of it has been returned (at least 1000
characters). I am using PHP 4.3.4 and FREETDS 0.62 on a Red Hat 9.0 system
to access SQL Server. The question is, is there a returned field size
maximum defaulting or defined in SQL Server, PHP, or FREETDS and/or has
anyone else had this problem?

Thanks.

Michael

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Truncated fields

2004-01-21 Thread Michael Lewis
John,

I'm getting much more than 255 characters. The field is not varchar but a
text field. I've looked into FREETDS as the most likely source of the
problem but haven't found anything yet.

Michael

 Michael Lewis wrote:

  I'm having a problem with retrieving field data from SQL SERVER 2000 and
am
  not sure where the problem lies. I have a variable length field (from
100 -
  1 characters). When I retrieve the field using a select statement,
then
  into a PHP variable such as $text=$r['body_text'], then the field seems
to
  be truncated after a good bit of it has been returned (at least 1000
  characters). I am using PHP 4.3.4 and FREETDS 0.62 on a Red Hat 9.0
system
  to access SQL Server. The question is, is there a returned field size
  maximum defaulting or defined in SQL Server, PHP, or FREETDS and/or has
  anyone else had this problem?

 Not sure where the problem is exactly (I think it's FREETDS), but you
 can only use 255 characters in a variable character column. Newer
 versions of FREETDS may solve this, otherwise change your column type.

 --
 ---John Holmes...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Truncated fields

2004-01-21 Thread Robert Twitty
You may need to set mssql.textlimit to a value greater than the default of
4096 characters.

-- bob

On Wed, 21 Jan 2004, Michael Lewis wrote:

 John,

 I'm getting much more than 255 characters. The field is not varchar but a
 text field. I've looked into FREETDS as the most likely source of the
 problem but haven't found anything yet.

 Michael

  Michael Lewis wrote:
 
   I'm having a problem with retrieving field data from SQL SERVER 2000 and
 am
   not sure where the problem lies. I have a variable length field (from
 100 -
   1 characters). When I retrieve the field using a select statement,
 then
   into a PHP variable such as $text=$r['body_text'], then the field seems
 to
   be truncated after a good bit of it has been returned (at least 1000
   characters). I am using PHP 4.3.4 and FREETDS 0.62 on a Red Hat 9.0
 system
   to access SQL Server. The question is, is there a returned field size
   maximum defaulting or defined in SQL Server, PHP, or FREETDS and/or has
   anyone else had this problem?
 
  Not sure where the problem is exactly (I think it's FREETDS), but you
  can only use 255 characters in a variable character column. Newer
  versions of FREETDS may solve this, otherwise change your column type.
 
  --
  ---John Holmes...

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php