[PHP-DB] How to insert date into date field

2003-08-26 Thread Jack van Zanen
Hi


I have a date that is formatted in the following way
day(00-31)/Mon(Jan-Dec)/year(2003):hour(00-23):minute(00-59):sec(00-59)

I want to load this into mysql table (date column)

In oracle I can just use the to_date function but all I find about MYSQL
seems to want the date in a specific format beforehand.

Any help??



TIA


JAck

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



[PHP-DB] Re: Oracle and PHP

2003-08-26 Thread Radovan Radic
Hi Roger,

There is Oracle Commander , but it is not very good as phpMyAdmin. Try it:
http://www.bitesser.de/downloads/download.php?filename=oraclecommander

Oracle is similar to other databases used from PHP, only difference is
calling stored procedures that return resultset.
Dont use oracle functions, but oracle8 (oci) extension for Oracle, they are
better documented and easier to use.

There is PHP manual that can help you learn oracle+php. If u have some
questions you can ask here.
For example, there are couple of functions i wrote to myself:

Some ppl say you should put environment variables, before connecting:

putenv( ORACLE_HOME=/usr/oracle/product/9.2.0 );
putenv(TWO_TASK=/usr/oracle/product/9.2.0/network/admin/tnsnames.ora);
putenv(TNS_ADMIN=/usr/oracle/product/9.2.0/network/admin);
putenv(ORACLE_SID=test);

$connection = OCIPlogon($user,$pass,$dbname);

function query($sql)
{
$query=OCIParse($connection,$sql);
if ($query)
OCIExecute($query);
return $query;
}

function query_fetch_array($query)
{
if (OCIFetchInto($query,$result,OCI_ASSOC+OCI_NUM+OCI_RETURN_NULLS))
{
return $result;
}
else
{
return 0;
}
}

$sql=select * from emp;
$query=query($connection,$sql);
while ($row=query_fetch_array($query))
{
  // You can user $row[EMPNO] or $row[0]...
}

Radovan

Roger Spears [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I was wondering if there are any PHP people out there that are really
 into using Oracle databases?  I've always used mysql but now I find
 myself in a situation that requires the use of an Oracle database.

 I've printed out the information posted by Thies C. Arntzen titled
 Making Efficient use of Oracle8i thru Apache and PHP 4 but I was
 wondering if I may see some other code examples.  Very basic examples
 dealing with connections, queries and the such.  Also, is there an
 application for Oracle databases that is similar to PHPMyAdmin for mysql
 databases?

 Thanks,
 Roger



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



[PHP-DB] Fw: Mysql Query

2003-08-26 Thread Mohammad Saadullah

Hi guys,

I am resending the same query again because still stuck on it.

I have been working in php/oracle for quite some time now but recently had to shift 
myself to mysql and I am struggling with a particular query here.

Scenario is, certain researchers can submit their proposals and those proposal are 
stored in a table researcher. 
proposals are of 2 types lets say type 1 and type 2.
Later they can view their own submited proposals which is working fine, but there is 
one new condition now.What my client wants is that these researchers can view all 
proposals of type 2 but only those proposals of type 1 should be displayed to a 
researcher whose submit date is greater than a certain date lets say '2003-08-01'. Now 
how do I create a single query which can return me such results. I know there is a way 
with join but cant find a solution, with oracle I would have used sub query but that 
cannot be done on mysql so I need your guys help thanks

Table name: researcher

Concerned fields
pid -- porposal id
rid -- researcher id
ptype --- proposal type
submitd -- submission date.

I would use rid = 42 and for ptype = 1 submitd should be greater than '2003-08-01' and 
there is no restriction of date with ptype =2.

Thanks again.
if there is something not clear feel free to ask

[PHP-DB] Reading File Contents

2003-08-26 Thread The Cossins Fam
Hello.

I have what should be a simple fix for the more advanced programmers out 
there.  I'm having problems with the display format of a text file.  I've 
been reading several resources, and I'm just not having much success with 
it.

How would you be able to display the following file named test.txt:

1. Test
2. Test
3. Test
...without it displaying like:

1. Test 2. Test 3. Test?

I've tried the nl2br function, as well as adding \n to the end of each 
line and using fgets to replace \n with br.  However, nothing seems to 
be working.  I'm probably missing something very simple, but if someone 
wouldn't mind helping a rookie out, I'd appreciate it.

--Joel

_
Help protect your PC: Get a free online virus scan at McAfee.com. 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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


RE: [PHP-DB] How to insert date into date field

2003-08-26 Thread Jennifer Goodie
 I have a date that is formatted in the following way
 day(00-31)/Mon(Jan-Dec)/year(2003):hour(00-23):minute(00-59):sec(00-59)

 I want to load this into mysql table (date column)

 In oracle I can just use the to_date function but all I find about MYSQL
 seems to want the date in a specific format beforehand.

If you are using PHP to insert it you can just format it before sticking it
in.  It gets a little more complicated if you are loading it in via LOAD
DATA INFILE or something like that.  What exactly are you attempting to do?

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



Re: [PHP-DB] Fw: Mysql Query

2003-08-26 Thread Sean Burlington
Mohammad Saadullah wrote:
Hi guys,

I am resending the same query again because still stuck on it.

I have been working in php/oracle for quite some time now but recently
 had to shift myself to mysql and I am struggling with a particular query here.
what is the query you would write for oracle ?


Scenario is, certain researchers can submit their proposals
 and those proposal are stored in a table researcher.
[snip]
--

Sean

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


[PHP-DB] PHP-DB Mailserver listed in spamcop?

2003-08-26 Thread colbey

http://spamcop.net/w3m?action=checkblockip=216.92.131.4

I just got a warning from PHP-DB mailserver that it cannot deliver to me
because my server is blocking..  I checked and it looks like the list
mailserver has been listed in spamcop by somebody?

One of the list managers might want to take a look at it.. I'm sure I'm
not the only person using spamcop and was suprised to see php-db listed in
it..


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



Re: [PHP-DB] Reading File Contents

2003-08-26 Thread Vince LaMonica
On Mon, 25 Aug 2003, The Cossins Fam wrote:

} I've tried the nl2br function, as well as adding \n to the end of each 
} line and using fgets to replace \n with br.  However, nothing seems to 
} be working.  I'm probably missing something very simple, but if someone 
} wouldn't mind helping a rookie out, I'd appreciate it.

If the files were written under Windows/UNIX/Mac OS 9-, you will need to 
add more than just \n to your ereg_replace:

$message = ereg_replace((\r\n|\n|\r), br\n, $message);

This should take care of all 3 kinds of line breaks/form feeds [windows, 
Mac, and UNIX based systems all define what happens when the user hits the 
return/enter key differently].

/vjl/

-- 
Vince LaMonica   UC Irvine,  School  of  Social Ecology
 W3 Developer   *  116 Social Ecology I, Irvine, CA 92697
 [EMAIL PROTECTED]  http://www.seweb.uci.edu/techsupport

You should not confuse your career with your life.

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



Re: [PHP-DB] Comparing 2 tables in the same database

2003-08-26 Thread John W. Holmes
Ron Allen wrote:
I would like to compare 2 tables in the same database so that I can find out
which records are different!
LEFT JOIN it with itself...

--
---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


Re: [PHP-DB] Comparing tables

2003-08-26 Thread David Smith
quote who=Ron Allen
 I would like to compare 2 tables in a database to determine which records
 are different!!!  Any clues out there.  Thanks in advance!

You didn't say which DBMS you are using. If you're using a DBMS which
supports INTERSECT (not MySQL), and assuming the two tables have the same
column names and types, you can do this:

  (SELECT * FROM table1) INTERSECT (SELECT * FROM table2)

For MySQL INTERSECT support, monitor this doc:

  http://www.mysql.com/doc/en/TODO_sometime.html

--Dave

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



[PHP-DB] Re: Oracle and PHP

2003-08-26 Thread Philippe Saladin

Roger Spears [EMAIL PROTECTED] a écrit dans le message news:
[EMAIL PROTECTED]
 Hello,

 I was wondering if there are any PHP people out there that are really
 into using Oracle databases?  I've always used mysql but now I find
 myself in a situation that requires the use of an Oracle database.

Sure, most of our developments are under Oracle/php

 I've printed out the information posted by Thies C. Arntzen titled
 Making Efficient use of Oracle8i thru Apache and PHP 4 but I was
 wondering if I may see some other code examples.  Very basic examples

In my case, I don't use directly the oci functions, but I use ADODB, which
is a wrapper, an abstraction layer. Thus, I code the same things, under
Oracle or MySQL. See http://php.weblogs.com/adodb_manual
Other abstraction layers exist : adodb, pear-db, metabase, etc.

 dealing with connections, queries and the such.  Also, is there an
 application for Oracle databases that is similar to PHPMyAdmin for mysql
 databases?

yes, you would try http:///phporacleadmin.org/


 Thanks,
 Roger

Regards,
Philippe

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



Re: [PHP-DB] problems compiling with-informix

2003-08-26 Thread Luigi Vellucci
Paul Gardiner wrote:
I run Informix (SE7.25.UC4 - UC5 had a major bug) on RH8.0. It wouldn't run
on RH9.0 because of the glibc 2.3.x conflict. I beleive Informix only
supports glibc 2.2.x. at the moment.
If it's possible, use RH8.0 as I know it works.

- Paul -

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 18, 2003 3:54 PM
Subject: [PHP-DB] problems compiling with-informix


hi, my name is matts.
when trying to compile php (as cgi or module) i get the following:
./configure --with-informix=/opt/informix

*

make

*

ext/mysql/libmysql/my_tempnam.o(.text+0x40): In function `my_tempnam':
/usr/src/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of
`tempnam' is

dangerous, better use `mkstemp'
/opt/informix/lib/esql/libifgls.so: undefined reference to `__ctype_b'
/opt/informix/lib/esql/libifgls.so: undefined reference to
`__ctype_toupper'

/opt/informix/lib/esql/libifgls.so: undefined reference to
`__ctype_tolower'

collect2: ld returned 1 exit status
make: *** [sapi/cgi/php] Error 1
i know that my_tempnam warnings are not important, but i cant figure out
what is

wrong with my libifgls.so

I'm working in a Red Hat 9.
I compiled php without informix support succefully several times.
I have installed the Informix Client SDK 2.81
(I believe)  I have all the environment variables ok (INFORMIXDIR,
INFORMIXSERVER... ETC)
I would apreciate any help 
thanks in advance.


-
This mail sent through IMP: http://mail.info.unlp.edu.ar/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







Hi I'm trying to compile php 4.1.2 with informix support from the SRPMS 
in RedHat 7.3 but I didn't get it. I downloaded the latest version of 
SDK Client 2.81.

I having the following problem when I try to compile the source:

-I/usr/src/redhat/BUILD/php-4.1.2/TSRM 
-I/usr/src/redhat/BUILD/php-4.1.2/build-cgi/TSRM -O2 -march=i386 
-mcpu=i686 -fPIC  -L/usr/kerberos/lib -o php -export-dynamicstub.lo 
libphp4.la
/usr/bin/ld: cannot find -lifsql
collect2: ld returned 1 exit status
make[1]: *** [php] Error 1
make[1]: Saliendo directorio `/usr/src/redhat/BUILD/php-4.1.2/build-cgi'
make: *** [all-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.32322 (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.32322 (%build)


Can somebody help me?

Thanks in advance.

Luigi Vellucci.

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


[PHP-DB] Logic Help...

2003-08-26 Thread NIPP, SCOTT V (SBCSI)
This isn't specifically a DB related question, but...  The following
code snippet is not functioning for me.  I keep receiving a parse error on
the if line.  Basically I want to stop execution of this page if either of
the conditions in the if statement exist.  Thanks in advance.


#  while($cntr != 0) {
#if (($shell[$cntr] eq ) || ($grp[$cntr] eq Primary Gr)) {
# echo p align=\center\font color=\#99\
size=\4\Sorry, but your request was not filled out completely.  Please
resubmit this request ensuring that you have selected a Primary Group and
Default Shell./font/p;
#  echo p align=\center\font color=\#99\ size=\4\Please
follow this a
href=\http://ldsa.sbcld.sbc.com/sa_bulletin/sa_board.htm\;link/a to
return to the beginning of the request process./font/p;
# exit;
#   }
#  }


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



Re: [PHP-DB] Logic Help...

2003-08-26 Thread CPT John W. Holmes
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]


 This isn't specifically a DB related question, but...  The following
 code snippet is not functioning for me.  I keep receiving a parse error on
 the if line.  Basically I want to stop execution of this page if either
of
 the conditions in the if statement exist.  Thanks in advance.


 #  while($cntr != 0) {
 #if (($shell[$cntr] eq ) || ($grp[$cntr] eq Primary Gr)) {

Umm... you don't use 'eq' in PHP, you use == (that's two equal signs).

---John Holmes...

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



RE: [PHP-DB] How to insert date into date field

2003-08-26 Thread Jack van Zanen
load my apache access log into a table (this is formatted wrong)

I now use a workaround by adding the date that I enter the records into the
table as well. I lose the timestamp but that's ok for now.
I then wrote an update statement to convert the old data to the correct date
and just make sure that just before midnight every day I load the data.

I'll look at my PHP insert script one day to see if I can easily change this
to pre format the date field .

Jack

-Original Message-
From: Jennifer Goodie [mailto:[EMAIL PROTECTED]
Sent: dinsdag 26 augustus 2003 1:13
To: Jack van Zanen; Php-Db
Subject: RE: [PHP-DB] How to insert date into date field


 I have a date that is formatted in the following way
 day(00-31)/Mon(Jan-Dec)/year(2003):hour(00-23):minute(00-59):sec(00-59)

 I want to load this into mysql table (date column)

 In oracle I can just use the to_date function but all I find about MYSQL
 seems to want the date in a specific format beforehand.

If you are using PHP to insert it you can just format it before sticking it
in.  It gets a little more complicated if you are loading it in via LOAD
DATA INFILE or something like that.  What exactly are you attempting to do?

--
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] timestamp formatting on display?

2003-08-26 Thread Aaron Wolski
Hi All,
 
Having a brain laps and not sure where in the manual to look and sadly I
need a QUICK solution.
 
I have a date formatted in a table like: 20030826132457
 
Now.. I went to MySQL timestamp from UNIX timestamps because I like the
readability of them when just looking at the Tables. How would I format
the date something like: August 26, 2003??
 
I could easily do this with a UNIX timestamp.. not sure if the same is
possible with this type of timestamp. Also.. I can't use the MYSQL
functions to format the data into a UNIX TimeStamp. not int his query.
 
Any ideas?
 
Thanks!
 
Aaron
 


[PHP-DB] changing datatypes in the query

2003-08-26 Thread Matt Babineau
Hi all-

Tough question (I think). I am pulling some numbers out of a data base,
currently they are stored in a blob. When I try to order by user_hits
desc it does a text ordering, not a numerical ordering. Is there a way
to get it to do a numeric ordering?

Thanks,
Matt

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



Re: [PHP-DB] changing datatypes in the query

2003-08-26 Thread Matt Babineau
I think I answered my own question, I used CAST() to set the type in the
ORDER BY statement.

cast(s11.data as unsigned)

Thx to me!
Matt

On Tue, 2003-08-26 at 11:21, Matt Babineau wrote:
 Hi all-
 
 Tough question (I think). I am pulling some numbers out of a data base,
 currently they are stored in a blob. When I try to order by user_hits
 desc it does a text ordering, not a numerical ordering. Is there a way
 to get it to do a numeric ordering?
 
 Thanks,
 Matt

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