RE: [PHP-DB] Select a subset?

2002-07-17 Thread joakim . andersson

 From: Clive Bruton [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 16, 2002 10:24 PM

 Joakim, thanks, that sorted it. Just one note, numrows in 
 the sql query 
 should be num_rows? That's how I got it to work anyway.

Yes, that's totally correct. Just a typo.

Joakim

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




[PHP-DB] Re: change data before its sent to db?

2002-07-17 Thread Tomator

You will laugh. When you quote month, you don't sort date by month field.
You sort by month - text constant being always equal. In fact you son't
sort it at all!

 The sort code ---

 if ($orderby == 'month_num'):
 $sql = select * from releases order by 'month';
 elseif ($orderby == 'month_num2'):
 $sql = select * from releases order by 'month' desc;

Try this:

$sql = select * from releases order by month;



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




Re: [PHP-DB] DAO implementations

2002-07-17 Thread Pierre-Alain Joye

On Wed, 17 Jul 2002 10:06:11 +0200
Ulf Wendel [EMAIL PROTECTED] wrote:

 Hi,
 
 are there some DAO pattern implementations available for PHP to query 
 MySQL, Postgres and/or DB2? Which one do you preferr?
 

What mean DAO ? It can be confused (dao, ado, ...). 

Did you try PEAR::DB_DataObject from Alan ? if that match the DAO definition you wrote 
;)

pa

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




Re: [PHP-DB] DAO implementations

2002-07-17 Thread Pierre-Alain Joye

Update your vacation message, we are the 17th :)

pa


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




[PHP-DB] unixODBC

2002-07-17 Thread Marten Lehmann

Hello,

isn't anybody using unixODBC with php out there? I still hope to get help to 
solve my unixODBC problem as described in my last mail.

Regards
Marten

-- 
Variomedia IT-Service GmbH | Benzstrasse 22 | 14482 Potsdam
http://www.variomedia.de | Hotline: 0800-5588550 | Fax: 0331-7404043







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




Re: [PHP-DB] DAO implementations

2002-07-17 Thread Ulf Wendel

Pierre-Alain Joye wrote:

On Wed, 17 Jul 2002 10:06:11 +0200
Ulf Wendel [EMAIL PROTECTED] wrote:

  

Hi,

are there some DAO pattern implementations available for PHP to query 
MySQL, Postgres and/or DB2? Which one do you preferr?




What mean DAO ? It can be confused (dao, ado, ...). 

:)

Yes, I asked a very unspecific question to get as much response as 
possible. If you really need more input take this google'd link as a 
definition:

http://www.iplanet.ne.jp/developers/ias-samples/jps1.1.1/docs/patterns/DAO.html

I'm belive you know the term DAO very well, don't you? I guess it's the 
very short and open question which made you asking for more details. 
However, I don't want to restrict the answers I could get using a more 
detailed question. I'm very much intrested in getting a large list of 
(tested) implementations to find out what other PHP guys call a DAO 
pattern implementation.

Did you try PEAR::DB_DataObject from Alan ? if that match the DAO definition you 
wrote ;)


No, did you? It matches perfectly my intention. You, an an experienced 
PHP programmer, pointed me to it. And yes, I knew about it but never 
tried to work with it. Any more suggestions?

Ulf

-- 
WWE e-commerce IT GmbH, http://wwe.biz
Eiffestrasse 462, D-20537 Hamburg
Tel: 040 / 25 30 65 9-0, Fax: 040 / 25 30 65 950



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




[PHP-DB] Warnings and Error messages

2002-07-17 Thread Gabor Niederlaender

Hi all!

How can I prevent the warnings end errors to be written on the screen?

I would like to prevent the warnings end errors to be written on the
screen because I want to handle the errors with the odbc_errormsg()
function.

How do I do that?
Is there a better way?

Best regards,

Gabor

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




RE: [PHP-DB] Warnings and Error messages

2002-07-17 Thread Russ

Stick a '@' in front of the function/statement generating the error:

@unlink($filname); for example...

Russ

-Original Message-
From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 17, 2002 5:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Warnings and Error messages


Hi all!

How can I prevent the warnings end errors to be written on the screen?

I would like to prevent the warnings end errors to be written on the
screen because I want to handle the errors with the odbc_errormsg()
function.

How do I do that?
Is there a better way?

Best regards,

Gabor

-- 
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] mysql multiple query

2002-07-17 Thread cristian ditoiu

hello..
i have a pretty wired query to do with php/mysql .
i don't manage to do

mysql_query($qry,$connection); .
(query bellow)

so i found a quick and dirty solution.see bellow .
but it's no realy elegant .

any ideea how can i do multiple queries at once with mysql_query() ?

function copy_question($qid,$test_target) {
global $connection,$username,$password,$database;


$fp = fopen ('/tmp/copy_table_qry', 'w');

$qry=create temporary table q_temp as select * from questions;
create temporary table ans_temp as select * from answers;
set test_id=$test_target;
set q_id=$qid;
insert into questions select
'',test_id,t2.q_type,t2.description,t2.dimension,t2.combination,t2.checkit
from q_temp as t2 where id=@q_id;
select last:=LAST_INSERT_ID();
insert into answers select '',last,score,description from ans_temp where
id_question_fk=@q_id;;

 fputs($fp,$qry);
 fclose($fp);

$a=exec(/usr/bin/mysql -u $username -p$password $database
/tmp/copy_table_qry);
--

thnx .


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




[PHP-DB] Fw: mysql multiple query

2002-07-17 Thread ditzi



 hello..
 i have a pretty wired query to do with php/mysql .
 i don't manage to do

 mysql_query($qry,$connection); .
 (query bellow)

 so i found a quick and dirty solution.see bellow .
 but it's no realy elegant .

 any ideea how can i do multiple queries at once with mysql_query() ?

 function copy_question($qid,$test_target) {
 global $connection,$username,$password,$database;


 $fp = fopen ('/tmp/copy_table_qry', 'w');

 $qry=create temporary table q_temp as select * from questions;
 create temporary table ans_temp as select * from answers;
 set test_id=$test_target;
 set q_id=$qid;
 insert into questions select

'',test_id,t2.q_type,t2.description,t2.dimension,t2.combination,t2.checkit
 from q_temp as t2 where id=@q_id;
 select last:=LAST_INSERT_ID();
 insert into answers select '',last,score,description from ans_temp where
 id_question_fk=@q_id;;

  fputs($fp,$qry);
  fclose($fp);

 $a=exec(/usr/bin/mysql -u $username -p$password $database
 /tmp/copy_table_qry);
 --

 thnx .



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




[PHP-DB] odbc and primary key

2002-07-17 Thread j.a.z.

How can i get the information if a field on a database (in my case
Access2000) is primary key via a php-odbc-function?
or does i have to use sql for that?
thanx j.a.z.



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




[PHP-DB] TEXTAREA ...

2002-07-17 Thread José Moreira

hello ... im sorry to bother with a non-db question but i searched for this
and got 0 record :P

its all about the wrappig in textareas:

how can i convert the end of line/ line breaks ['enter' keys] that the user
hits while
filling a textarea so that when i display the record content the text does
break where the user intended ???

ex.:

textareabla blah blah
 bla blah blah/textarea

if i echo() this textarea value i will apear in a single line even if the
user pressed enter 2  break the line





Re: [PHP-DB] TEXTAREA ...

2002-07-17 Thread Martin Clifford

$content = nl2br($content);

That will convert all newline characters into br tags.

HTH

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 José Moreira [EMAIL PROTECTED] 07/17/02 09:15AM 
hello ... im sorry to bother with a non-db question but i searched for this
and got 0 record :P

its all about the wrappig in textareas:

how can i convert the end of line/ line breaks ['enter' keys] that the user
hits while
filling a textarea so that when i display the record content the text does
break where the user intended ???

ex.:

textareabla blah blah
 bla blah blah/textarea

if i echo() this textarea value i will apear in a single line even if the
user pressed enter 2  break the line




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




Re: [PHP-DB] TEXTAREA ...

2002-07-17 Thread Martin Adler

That's right but if the variable is initialised by the form and you want to
write the variable in to your html-document it's better to write this

$content = nl2br(htmlentities(stripslashes($content)));

- Original Message -
From: Martin Clifford [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, July 17, 2002 3:15 PM
Subject: Re: [PHP-DB] TEXTAREA ...


$content = nl2br($content);

That will convert all newline characters into br tags.

HTH

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 José Moreira [EMAIL PROTECTED] 07/17/02 09:15AM 
hello ... im sorry to bother with a non-db question but i searched for this
and got 0 record :P

its all about the wrappig in textareas:

how can i convert the end of line/ line breaks ['enter' keys] that the user
hits while
filling a textarea so that when i display the record content the text does
break where the user intended ???

ex.:

textareabla blah blah
 bla blah blah/textarea

if i echo() this textarea value i will apear in a single line even if the
user pressed enter 2  break the line




--
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] Construct, Q+E, QBE

2002-07-17 Thread Fernando Ortiz

I'm migrating my code from Informix 4GL to PHP, my problem now is how to
give the users the ability to make a query with the facilities that the
CONTRUCT verb gives in 4GL.

Suppose a form field name 'price' where the users can type the search
criteria

If the user type ...   I need to get ...
123.23  price = 123.23
100 price  100
=500price = 500
100..200price between 100 and 200
100,200 price in (100,200)

In a string field named city
If the user type ...I need to get
sacramento  city = 'SACRAMENTO'
sacra* city MATCHES 'SACRA*'
Wy   city  'WY
etc.

Something like ..
$qbe = qbe('city','options')
$qry = select * from customers where .$qbe;

and the qbe function can get the typed from $_POST[$parm1] and using the
options chose between char or numeric data type , upshift or as is, matches
or like, etc.

Exist something like that?

I'm reinventing the wheel?

How are you solving this kind of problem?

TIA

--
Fernando Ortiz Muñoz
Fabrica de Jabon la Corona, SA de CV
MEXICO




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




[PHP-DB] Amazon PHP API

2002-07-17 Thread Calin Uioreanu

Hi all,

As you probably know, Amazon.com released an API this morning to browse
their huge ecommerce catalogs. You don't have to be a manager to realise the
huge monetary potential here.

Here is a Amazon PHP API implementation using only the XML support in PHP I
wrote:

http://www.php9.com/index.php/section/articles/name/Amazon%20PHP%20API

Calin Uioreanu
php9.com Weblog
http://www.php9.com




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




[PHP-DB] PHP ldap_add() - null values in fields produce an value #0 invalid per syntax error on the ldap server

2002-07-17 Thread Ian_Ball

Hi,

New to the list and hoping someone might be able to help me.

I have been using PHP scripts that are to maintain a company address book
with a lot of data about contacts, both inside and outside the company.  The
scripts, which are generating html pages and reading input values back in,
have been working fine with PHP 4.2.1 as a library module for apache 1.3.26
and openldap 1.2.13.  However, openldap 2.0.23 and 25 have been generating
errors with these same PHP scripts.

The problem comes when fields in the html pages are left empty, which is
normal for this application.  For those familiar with the ldap_add/modify
functions in PHP, the array that is passed in has some values, say for
example title, fax, mobile, ... left empty, and therefore NULL (I have
checked, they really are NULL's stored in the array).  When the values make
it to the ldap server however, they appear to be no longer NULL's, but a
#0, and through debugging output on the ldap server, I have seen it is
generating an invalid per syntax error.

The ldap servers have been complied from source and installed on a SuSE linux
professional 7.3 system.  Hardware resources are no problem (640Mb RAM, 2Gb
swap, 800Mhz processor, 130Gb HDD space with 6Gb free on the working
partition with this stuff)

Does anyone have any suggestions as to how I can address this problem.  It
is important that null values can make it into the ldap server as putting in
other values to try to work around the problem will mess up other
applications that use the ldap server, as will not inserting the fields into
the ldap server.

Ian

The following code segment demonstrates the problem:

?php
$ds=ldap_connect(localhost);  // The LDAP server is on this host

if ($ds) {
// bind with appropriate dn to give update access
$r=ldap_bind($ds,cn=ShnetAdmin, o=shnetdemo, thepassword);

// prepare data
$info[cn]=John Jones;
$info[sn]=Jones;
$info[mail]=;  // - NULL VALUE HERE!!
// The following lines also produce the same result...
//$info[mail]=NULL;  // --- NULL value here!!!
//$info[mail]=\0;  // --- NULL value here!!!
//$info[mail];   // --- NULL value here!!!
$info[objectclass]=person;

// add data to directory
$r=ldap_add($ds, cn=ShnetAdmin, o=shnetdemo, $info);

ldap_close($ds);
} else {
echo Unable to connect to LDAP server;
}
?


Which produces the following segment of debugging output on the ldap server,
started with slapd -d 255.


dn2entry_r: dn: CN=SHNETADMIN,O=SHNETDEMO
= dn2id( CN=SHNETADMIN,O=SHNETDEMO )
 cache_find_entry_dn2id(CN=SHNETADMIN,O=SHNETDEMO): 3 (1 tries)
= dn2id 3 (in cache)
= id2entry_r( 3 )
 cache_find_entry_id( 3 ) cn=ShnetAdmin,o=shnetdemo (found) (1 tries)
= id2entry_r( 3 ) 0x80e72a8 (cache)
 cache_return_entry_r( 3 ): returned (0)
send_ldap_result: conn=12 op=1 p=2
send_ldap_result: 21::mail: value #0 invalid per syntax
send_ldap_response: msgid=2 tag=105 err=21
ber_flush: 47 bytes to sd 9
  :  30 2d 02 01 02 69 28 0a  01 15 04 00 04 21 6d 61   0-...i(..!ma
  0010:  69 6c 3a 20 76 61 6c 75  65 20 23 30 20 69 6e 76   il: value #0 inv
  0020:  61 6c 69 64 20 70 65 72  20 73 79 6e 74 61 78  alid per syntax
ldap_write: want=47, written=47
  :  30 2d 02 01 02 69 28 0a  01 15 04 00 04 21 6d 61   0-...i(..!ma
  0010:  69 6c 3a 20 76 61 6c 75  65 20 23 30 20 69 6e 76   il: value #0 inv
  0020:  61 6c 69 64 20 70 65 72  20 73 79 6e 74 61 78  alid per syntax
daemon: select: listen=6 active_threads=1 tvp=NULL
daemon: activity on 1 descriptors
daemon: activity on: 9r
daemon: read activity on 9
connection_get(9)
connection_get(9): got connid=12
connection_read(9): checking for input on id=12
ber_get_next
ldap_read: want=1, got=1
  :  30 0
ldap_read: want=1, got=1
  :  05 .
ldap_read: want=5, got=5
  :  02 01 03 42 00 ...B.
ber_get_next: tag 0x30 len 5 contents:
ber_dump: buf=0x080e5fe0 ptr=0x080e5fe0 end=0x080e5fe5 len=5
  :  02 01 03 42 00 ...B.
ber_get_next
ldap_read: want=1, got=0

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




RE: [PHP-DB] Keeps prompting to download php page???

2002-07-17 Thread NIPP, SCOTT V (SBCSI)

Yes.  I have the application type, and both the LoadModule and
AddModule directives for PHP in the httpd.conf file.  Here are those entries
cut and pasted from my httpd.conf:

# LoadModule foo_module libexec/mod_foo.so
LoadModule frontpage_module   libexec/mod_frontpage.so
LoadModule php4_modulelibexec/libphp4.so
IfDefine SSL
LoadModule ssl_module libexec/libssl.so
LoadModule dav_module libexec/libdav.so
/IfDefine

AddModule mod_php4.c

AddType application/x-httpd-php .htm

The AddType directive is exactly the same as another web server that
is working fine.  I know that it shows .htm, but it works fine on my other
server this way.  Thanks again.

-Original Message-
From: Beau Lebens [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 8:04 PM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Keeps prompting to download php page???


what Adam said is true, but it sounds like in the process of upgrading
Apache you have lost track of how to process PHP pages.

Check your httpd.conf file for lines similar to these, if there's nothing
close then you will need to reconfigure PHP

LoadModule php4_module modules/php4apache.dll
AddType application/x-httpd-php .php



// -Original Message-
// From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 17 July 2002 4:55 AM
// To: '[EMAIL PROTECTED]'
// Subject: [PHP-DB] Keeps prompting to download php page???
// 
// 
//  I just upgraded to Apache 1.3.26, and everything it 
// fine except PHP.
// Whenever I try to load a PHP page in the browser, the 
// browser attempts to
// download the page.  I know that I am missing something simple here.
// 
// Scott Nipp
// Phone:  (214) 858-1289
// E-mail:  [EMAIL PROTECTED]
// Web:  http:\\ldsa.sbcld.sbc.com
// 
// 
// 
// -- 
// 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] Re: PHP ldap_add() - null values in fields produce an value #0 invalid per syntax error on the ldap server

2002-07-17 Thread David Robley

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 Hi,
 
 New to the list and hoping someone might be able to help me.
 
 I have been using PHP scripts that are to maintain a company address book
 with a lot of data about contacts, both inside and outside the company.  The
 scripts, which are generating html pages and reading input values back in,
 have been working fine with PHP 4.2.1 as a library module for apache 1.3.26
 and openldap 1.2.13.  However, openldap 2.0.23 and 25 have been generating
 errors with these same PHP scripts.
 
 The problem comes when fields in the html pages are left empty, which is
 normal for this application.  For those familiar with the ldap_add/modify
 functions in PHP, the array that is passed in has some values, say for
 example title, fax, mobile, ... left empty, and therefore NULL (I have
 checked, they really are NULL's stored in the array).  When the values make
 it to the ldap server however, they appear to be no longer NULL's, but a
 #0, and through debugging output on the ldap server, I have seen it is
 generating an invalid per syntax error.
 
 The ldap servers have been complied from source and installed on a SuSE linux
 professional 7.3 system.  Hardware resources are no problem (640Mb RAM, 2Gb
 swap, 800Mhz processor, 130Gb HDD space with 6Gb free on the working
 partition with this stuff)
 
 Does anyone have any suggestions as to how I can address this problem.  It
 is important that null values can make it into the ldap server as putting in
 other values to try to work around the problem will mess up other
 applications that use the ldap server, as will not inserting the fields into
 the ldap server.
 
 Ian
 
 The following code segment demonstrates the problem:
 
 ?php
 $ds=ldap_connect(localhost);  // The LDAP server is on this host
 
 if ($ds) {
 // bind with appropriate dn to give update access
 $r=ldap_bind($ds,cn=ShnetAdmin, o=shnetdemo, thepassword);
 
 // prepare data
 $info[cn]=John Jones;
 $info[sn]=Jones;
 $info[mail]=;  // - NULL VALUE HERE!!
 // The following lines also produce the same result...
 //$info[mail]=NULL;  // --- NULL value here!!!
 //$info[mail]=\0;  // --- NULL value here!!!
 //$info[mail];   // --- NULL value here!!!

Perhaps if you were to test that the relevant values were not empty; only 
add them to the ldap database if they have a value? empty or isset are the 
functions to investigate.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP-DB] SQL Solution??

2002-07-17 Thread Russ

Hi all:

I have a simple MySQL SELECT query:





Mr Russ Michell
Web Applications Developer

Itomic.com 
Email: [EMAIL PROTECTED] 
Tel: +61 (0)8 9321 3844 
Fax: +61 (0)8 6210 1364 
Post: PO Box 228, Innaloo, WA 6918, Australia 
Street: Suite 24, 158 William St, Perth, WA 6000, Australia

No proof of existence is not proof of non-existence.
(Physicist: Stanton T. Friedman on Debunking Ufology)


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




[PHP-DB] SQL query prob

2002-07-17 Thread Russ

I'll try that one again

I have a query:
$sql = SELECT * FROM contacts ORDER BY ContactType;

There are two types of contacts: 

* Commissioners
* Staff

As they are ordered by the ContactType then 'Commissioners' are
displayed first followed by 'Staff'.
  
I'd like to be able to display a heading on the page at the point of the
FIRST instance of 'Commissioners' and at the FIRST instance of 'Staff'.
As I'm using a while loop in my PHP script then at present such a
heading would be displayed atop *each* item would it not?

I think I need to use some kind of COUNT() but am unsure how to deploy
it.
Can anyone help me out?

Cheers.
Russ

Mr Russ Michell
Web Applications Developer

Itomic.com 
Email: [EMAIL PROTECTED] 
Tel: +61 (0)8 9321 3844 
Fax: +61 (0)8 6210 1364 
Post: PO Box 228, Innaloo, WA 6918, Australia 
Street: Suite 24, 158 William St, Perth, WA 6000, Australia

No proof of existence is not proof of non-existence.
(Physicist: Stanton T. Friedman on Debunking Ufology)


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




[PHP-DB] Re: Construct, Q+E, QBE

2002-07-17 Thread Adam Royle

This sounds very interesting. As far as I know, there are no automatic functions to do 
this, although i don't think it would be too hard to write the php function to do 
this. If end up finding a solution, please email it to me (and the list), or if you 
need a hand in writing it, I'd be happy to help.

Adam



[PHP-DB] Re: MS Access - default value in create table

2002-07-17 Thread Nuttzy

FYI, I'm sending this stuff through the odbc_exec command.  Any MS Access
experts out there?

Thanks!
-Nuttzy

Nuttzy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I can create tables and perform alterations just fine.  However, if I try
to
 specify a DEFAULT value in either CREATE TABLE or ALTER TABLE, it craps
out
 on me.  For example, this works

 ALTER TABLE phpbb_mytable
ALTER COLUMN LastName TEXT(40)

 ...but this doesn't

 ALTER TABLE phpbb_mytable
ALTER COLUMN LastName TEXT(40) DEFAULT Unknown

 ...even though I believe this is the correct syntax.  Same thing happens
for
 CREATE TABLE.  Help!!!

 Thanks,
 -Nuttzy





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




RE: [PHP-DB] SQL query prob

2002-07-17 Thread Cal Evans

It would unless you told it not to. Set a flag
$lastContactType='';

Then on the first page you display something where then display it and then
if ($lastContactType != $row['contactType']){
echo $row['contactType'];
$lastContactType=$row['contactType'];
} // if ($lastContactType != $row['contactType'])


When contactType changes again, you'll display it again and reset the flag
again.

HTH,
=C=


*
* Cal Evans
* The Virtual CIO
* http://www.calevans.com
*


-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 17, 2002 8:44 PM
To: PHP DB Mailing List (E-mail)
Subject: [PHP-DB] SQL query prob


I'll try that one again

I have a query:
$sql = SELECT * FROM contacts ORDER BY ContactType;

There are two types of contacts:

* Commissioners
* Staff

As they are ordered by the ContactType then 'Commissioners' are
displayed first followed by 'Staff'.

I'd like to be able to display a heading on the page at the point of the
FIRST instance of 'Commissioners' and at the FIRST instance of 'Staff'.
As I'm using a while loop in my PHP script then at present such a
heading would be displayed atop *each* item would it not?

I think I need to use some kind of COUNT() but am unsure how to deploy
it.
Can anyone help me out?

Cheers.
Russ

Mr Russ Michell
Web Applications Developer

Itomic.com
Email: [EMAIL PROTECTED]
Tel: +61 (0)8 9321 3844
Fax: +61 (0)8 6210 1364
Post: PO Box 228, Innaloo, WA 6918, Australia
Street: Suite 24, 158 William St, Perth, WA 6000, Australia

No proof of existence is not proof of non-existence.
(Physicist: Stanton T. Friedman on Debunking Ufology)


--
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] Keeps prompting to download php page???

2002-07-17 Thread Jason Wong

On Thursday 18 July 2002 03:28, NIPP, SCOTT V (SBCSI) wrote:

 AddType application/x-httpd-php .htm

The only Apache is going to render your php pages as php is if you tell it to. 
The above line only tells Apache to render .htm pages as php.

   The AddType directive is exactly the same as another web server that
 is working fine.  I know that it shows .htm, but it works fine on my
 other server this way.  Thanks again.

You could be looking at the wrong httpd.conf in your other server, or you 
could have missed a line somewhere. The bottom line is add this line to your 
httpd.conf:

AddType application/x-httpd-php .php


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
I think your opinions are reasonable, except for the one about my mental
instability.
-- Psychology Professor, Farifield University
*/


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