Re: [PHP-DB] Brick Codes

2004-02-17 Thread Ricardo Lopes
That may depend of what database server you are using, for mysql you can
use:

   WHERE (LEFT('Brick',3) = LEFT(Post Code,3))

If you are using other dbserver, check your manual.

- Original Message -
From: Shaun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 16, 2004 10:45 PM
Subject: [PHP-DB] Brick Codes


 Hi,

 I have a table of Locations around the country. My system produces reports
 based on these Locations. I also have a table containing Brick Codes e.g.

 BrickPost Code
 AB51AB51
 AB52AB52
 AB55AB55
 AB56AB56
 AL01AL1
 AL02AL2
 AL03AL3
 AL04AL4


 How can I compare the first 3 or 4 letters of the postcode in the
Locations
 table to the corresponding entry in the Brick Codes table so I can add it
to
 my report?

 Thanks for your help

 --
 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] sql, problem with join and presentation

2004-02-17 Thread Angelo Zanetti
i think the newer versions of MYSQL allow for subselects and I think that is
what you want.
see www.mysql.net



-Original Message-
From: mayo [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 15, 2004 11:56 PM
To: php-db
Subject: [PHP-DB] sql, problem with join and presentation


Currently I display a list of classes.
Simplified SQL and display below:

SELECT *
FROM classes
WHERE
classCategory='$Category' AND
classDeleted=0
ORDER BY $order $reorder

The presentation is:

+--+--++
| CLASS TITLE  | LOCATION | CLASS CODE |
+--+--++
| CLASS DESCRIPTION br/br/ |
| CLASS INSTRUCTOR br/br/  |
| CLASS TIME   |
+--+


Now, things are getting a little more complicated.  Each class is going to
have sections. So the display will be:

CLASS TITLE
CLASS DESCRIPTION

CLASS CODE : CLASS SECTION .. LOCATION .. CLASS TIME .. INSTRUCTOR

example (simplified)

+-+
| INTRO TO AAA|
+-+
| This is a really interesting    |
| |
+-+-+++
|HT-111:A | NYC | 12:00-4:00 | Albert Alkin   |
|HT-111:B | JC  | 2:00-6:00  | Bob Bailey |
|HT-111:C | BX  | 4:00-8:00  | Chris Cawley   |
+-+-+++


I'm having a really hard time coming up with the sql for this.

I want to (pseudo)

select *
from classes and classSections
where classDeleted=0
and group by classCode

tables below

CLASSES
classID
classDescription
classTexts
classCost
classDeleted

CLASSCODES

classCodeID
classID
classCodeSection
classDate
classTime
classLocation
classInstructor

I'm going nuts trying to get this. I must be missing something simple.
(using mysql)

thx for any clues

Gil

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP-DB] select in a object tables

2004-02-17 Thread Sergio
¡Hi all!
   I have a problem and I don't find the solution, my problem is when I 
try to do a select on a object table, it returns  '*Warning*: Ora_Parse 
failed (ORA-00911: carácter no válido -- while processing OCI function 
OPARSE)'
I'm working with this code in pl/sql :

create Type TArtPrueba As object

(

codigo number,

nombre varchar2(20),

cantidad number

);



Create Type TAlmPrueba As VArray (10) of TArtPrueba;



create Type TPetPrueba As object

(

ident number,

articulosPeticion TAlmPrueba

);



create table Peticiones_Prueba of TPetPrueba

(ident Primary key,

 articulosPeticion Not null);



To insert elements in the table:

insert into Peticiones_Prueba

values (333, TAlmPrueba(TArtPrueba(0,'Papel', 13),TArtPrueba(1, 
'Boligrafos', 145)));

/

And the select that I use is :

SELECT

  p.ident   identificador,

  arti.*

FROM

  Peticiones_Prueba p,

  table(p.articulosPeticion) arti;

  /

This runs well in Oracle but when I try to call in php:
$sql=Select arti.* from Peticiones_Prueba p, table(p.articulosPeticion) 
arti;;
...
$salida= ora_parse($cursor, $sql, 0);
an error happends. Anybody now how to solve this problem?

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


[PHP-DB] resultset problem

2004-02-17 Thread Angelo Zanetti
HI all,

I am querying a db and getting the resultset, then to get out each
individual field of the resultset (which is a single unique line all the
time)  as mysql_result($result2, 0, p_company). the problem is that if the
actual field has a space in it say Sun microsystems, I only get sun and
it doesnt give me anything after the first space.

I have looked at the manual but as far as im concerned its really vague in
its description of alot of the mysql functions.
any idea what could be causing this??

thanx Angelo


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP-DB] Brick Codes

2004-02-17 Thread Shaun
Thanks for your reply,

but what I actually need to do is compare the first 3 or 4 digits of the
postcode stored in locations to the same in the Brick table...


Ricardo Lopes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 That may depend of what database server you are using, for mysql you can
 use:

    WHERE (LEFT('Brick',3) = LEFT(Post Code,3))

 If you are using other dbserver, check your manual.

 - Original Message -
 From: Shaun [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, February 16, 2004 10:45 PM
 Subject: [PHP-DB] Brick Codes


  Hi,
 
  I have a table of Locations around the country. My system produces
reports
  based on these Locations. I also have a table containing Brick Codes
e.g.
 
  BrickPost Code
  AB51AB51
  AB52AB52
  AB55AB55
  AB56AB56
  AL01AL1
  AL02AL2
  AL03AL3
  AL04AL4
 
 
  How can I compare the first 3 or 4 letters of the postcode in the
 Locations
  table to the corresponding entry in the Brick Codes table so I can add
it
 to
  my report?
 
  Thanks for your help
 
  --
  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] Brick Codes

2004-02-17 Thread Ricardo Lopes
I think this is what you want:

SELECT *
FROM Locations L, Brick B
WHERE (LEFT(L.'Post Code',3) = LEFT(B.Brick,3))

If you want to select 4 characters change the 3 to 4 :-)

Avoid using spaces and special characters in your column it may give you
problems.


- Original Message -
From: Shaun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 10:04 AM
Subject: Re: [PHP-DB] Brick Codes


 Thanks for your reply,

 but what I actually need to do is compare the first 3 or 4 digits of the
 postcode stored in locations to the same in the Brick table...


 Ricardo Lopes [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  That may depend of what database server you are using, for mysql you can
  use:
 
     WHERE (LEFT('Brick',3) = LEFT(Post Code,3))
 
  If you are using other dbserver, check your manual.
 
  - Original Message -
  From: Shaun [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, February 16, 2004 10:45 PM
  Subject: [PHP-DB] Brick Codes
 
 
   Hi,
  
   I have a table of Locations around the country. My system produces
 reports
   based on these Locations. I also have a table containing Brick Codes
 e.g.
  
   BrickPost Code
   AB51AB51
   AB52AB52
   AB55AB55
   AB56AB56
   AL01AL1
   AL02AL2
   AL03AL3
   AL04AL4
  
  
   How can I compare the first 3 or 4 letters of the postcode in the
  Locations
   table to the corresponding entry in the Brick Codes table so I can add
 it
  to
   my report?
  
   Thanks for your help
  
   --
   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] Brick Codes

2004-02-17 Thread Ignatius Reilly
Hmmm...

Better try:
WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3))
^^ no quotes^^ back ticks (because of the
space in the column name)

HTH
Ignatius
_
- Original Message -
From: Ricardo Lopes [EMAIL PROTECTED]
To: Shaun [EMAIL PROTECTED]
Cc: PHP DB [EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 10:23
Subject: Re: [PHP-DB] Brick Codes


 That may depend of what database server you are using, for mysql you can
 use:

    WHERE (LEFT('Brick',3) = LEFT(Post Code,3))

 If you are using other dbserver, check your manual.

 - Original Message -
 From: Shaun [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, February 16, 2004 10:45 PM
 Subject: [PHP-DB] Brick Codes


  Hi,
 
  I have a table of Locations around the country. My system produces
reports
  based on these Locations. I also have a table containing Brick Codes
e.g.
 
  BrickPost Code
  AB51AB51
  AB52AB52
  AB55AB55
  AB56AB56
  AL01AL1
  AL02AL2
  AL03AL3
  AL04AL4
 
 
  How can I compare the first 3 or 4 letters of the postcode in the
 Locations
  table to the corresponding entry in the Brick Codes table so I can add
it
 to
  my report?
 
  Thanks for your help
 
  --
  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] Brick Codes

2004-02-17 Thread Shaun
Thank you for your replies,

The brick and postcode will never match so I need to compare the Postcode in
Locations to the Postcode in Brick. Something like:

SELECT B.Brick
FROM Locations L, Brick B
WHERE (LEFT(L.Postcode,3) = LEFT(B.Postcode,3))

The problem is that some of the postcodes stored in Brick have three digits
and some have four, is there a way of capturing everything before the first
space in L.Postcode and compare that to B.Postcode?

Thanks for your help

Ignatius Reilly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hmmm...

 Better try:
 WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3))
 ^^ no quotes^^ back ticks (because of the
 space in the column name)

 HTH
 Ignatius
 _
 - Original Message -
 From: Ricardo Lopes [EMAIL PROTECTED]
 To: Shaun [EMAIL PROTECTED]
 Cc: PHP DB [EMAIL PROTECTED]
 Sent: Tuesday, February 17, 2004 10:23
 Subject: Re: [PHP-DB] Brick Codes


  That may depend of what database server you are using, for mysql you can
  use:
 
     WHERE (LEFT('Brick',3) = LEFT(Post Code,3))
 
  If you are using other dbserver, check your manual.
 
  - Original Message -
  From: Shaun [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, February 16, 2004 10:45 PM
  Subject: [PHP-DB] Brick Codes
 
 
   Hi,
  
   I have a table of Locations around the country. My system produces
 reports
   based on these Locations. I also have a table containing Brick Codes
 e.g.
  
   BrickPost Code
   AB51AB51
   AB52AB52
   AB55AB55
   AB56AB56
   AL01AL1
   AL02AL2
   AL03AL3
   AL04AL4
  
  
   How can I compare the first 3 or 4 letters of the postcode in the
  Locations
   table to the corresponding entry in the Brick Codes table so I can add
 it
  to
   my report?
  
   Thanks for your help
  
   --
   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] Problem with ODBTP

2004-02-17 Thread Sascha Kaufmann
Hello everyone

I try to port an application from Windows/ODBC to Linux/ODBTP, I have a 
MSSQL Server 2000.
If I use the function odbtp_fetch_row, I get the following warn message: 
Warning: [ODBTPERR][0]Detached object in file.
Anyone a idea what this could mean? Google won't told me that :(

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


Re: [PHP-DB] Brick Codes

2004-02-17 Thread Ricardo Lopes
SELECT *
FROM Locations L, Brick B
WHERE (LEFT(L.'Post Code', LOCATE(' ', L.'Post Code') = LEFT(B.Brick,
LOCATE(' ', L.'Post Code')))

The functions if locate gives you the position of the character in the
string, if this is not what you whant you can search the mysql string
functions documentation in:

http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#Str
ing_functions


- Original Message -
From: Shaun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 10:19 AM
Subject: Re: [PHP-DB] Brick Codes


 Thank you for your replies,

 The brick and postcode will never match so I need to compare the Postcode
in
 Locations to the Postcode in Brick. Something like:

 SELECT B.Brick
 FROM Locations L, Brick B
 WHERE (LEFT(L.Postcode,3) = LEFT(B.Postcode,3))

 The problem is that some of the postcodes stored in Brick have three
digits
 and some have four, is there a way of capturing everything before the
first
 space in L.Postcode and compare that to B.Postcode?

 Thanks for your help

 Ignatius Reilly [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hmmm...
 
  Better try:
  WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3))
  ^^ no quotes^^ back ticks (because of
the
  space in the column name)
 
  HTH
  Ignatius
  _
  - Original Message -
  From: Ricardo Lopes [EMAIL PROTECTED]
  To: Shaun [EMAIL PROTECTED]
  Cc: PHP DB [EMAIL PROTECTED]
  Sent: Tuesday, February 17, 2004 10:23
  Subject: Re: [PHP-DB] Brick Codes
 
 
   That may depend of what database server you are using, for mysql you
can
   use:
  
      WHERE (LEFT('Brick',3) = LEFT(Post Code,3))
  
   If you are using other dbserver, check your manual.
  
   - Original Message -
   From: Shaun [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, February 16, 2004 10:45 PM
   Subject: [PHP-DB] Brick Codes
  
  
Hi,
   
I have a table of Locations around the country. My system produces
  reports
based on these Locations. I also have a table containing Brick Codes
  e.g.
   
BrickPost Code
AB51AB51
AB52AB52
AB55AB55
AB56AB56
AL01AL1
AL02AL2
AL03AL3
AL04AL4
   
   
How can I compare the first 3 or 4 letters of the postcode in the
   Locations
table to the corresponding entry in the Brick Codes table so I can
add
  it
   to
my report?
   
Thanks for your help
   
--
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHP oracle 9.2

2004-02-17 Thread Delfins
Hello php.db!

i have successfully installed Oracle 9.2 on Slackware 9.0
database works fine  also any other applications runs ok.
but when i compiled PHP5 with OCI8 (path i was specified as ORACLE_HOME)
but running some scrip, i have this error :
Warning: ocilogon(): _oci_open_server: Error while trying to retrieve 
text for error ORA-12154

i have 2 problems :

i.) something wrong with ora error messages
ii.) something wrong with compiled PHP
ORA-12154 is TNS could not be resolved.

but i __know__, what with this configuration (i have used) string i have 
success connection for other applications (net manager, etc)

how to fix ? is it bug or my hands did something wrong ? :)

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


Re: [PHP-DB] Brick Codes

2004-02-17 Thread Ricardo Lopes
Ignore the previous post it has an error. This is the corrected sql:

SELECT *
FROM Locations L, Brick B
WHERE (LEFT(L.'Post Code', LOCATE(' ', L.'Post Code'))  =  B.Brick)

This should do it.

- Original Message -
From: Ricardo Lopes [EMAIL PROTECTED]
To: Shaun [EMAIL PROTECTED]
Cc: PHP DB [EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 10:32 AM
Subject: Re: [PHP-DB] Brick Codes


 SELECT *
 FROM Locations L, Brick B
 WHERE (LEFT(L.'Post Code', LOCATE(' ', L.'Post Code') = LEFT(B.Brick,
 LOCATE(' ', L.'Post Code')))

 The functions if locate gives you the position of the character in the
 string, if this is not what you whant you can search the mysql string
 functions documentation in:


http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#Str
 ing_functions


 - Original Message -
 From: Shaun [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, February 17, 2004 10:19 AM
 Subject: Re: [PHP-DB] Brick Codes


  Thank you for your replies,
 
  The brick and postcode will never match so I need to compare the
Postcode
 in
  Locations to the Postcode in Brick. Something like:
 
  SELECT B.Brick
  FROM Locations L, Brick B
  WHERE (LEFT(L.Postcode,3) = LEFT(B.Postcode,3))
 
  The problem is that some of the postcodes stored in Brick have three
 digits
  and some have four, is there a way of capturing everything before the
 first
  space in L.Postcode and compare that to B.Postcode?
 
  Thanks for your help
 
  Ignatius Reilly [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   Hmmm...
  
   Better try:
   WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3))
   ^^ no quotes^^ back ticks (because of
 the
   space in the column name)
  
   HTH
   Ignatius
   _
   - Original Message -
   From: Ricardo Lopes [EMAIL PROTECTED]
   To: Shaun [EMAIL PROTECTED]
   Cc: PHP DB [EMAIL PROTECTED]
   Sent: Tuesday, February 17, 2004 10:23
   Subject: Re: [PHP-DB] Brick Codes
  
  
That may depend of what database server you are using, for mysql you
 can
use:
   
   WHERE (LEFT('Brick',3) = LEFT(Post Code,3))
   
If you are using other dbserver, check your manual.
   
- Original Message -
From: Shaun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 16, 2004 10:45 PM
Subject: [PHP-DB] Brick Codes
   
   
 Hi,

 I have a table of Locations around the country. My system produces
   reports
 based on these Locations. I also have a table containing Brick
Codes
   e.g.

 BrickPost Code
 AB51AB51
 AB52AB52
 AB55AB55
 AB56AB56
 AL01AL1
 AL02AL2
 AL03AL3
 AL04AL4


 How can I compare the first 3 or 4 letters of the postcode in the
Locations
 table to the corresponding entry in the Brick Codes table so I can
 add
   it
to
 my report?

 Thanks for your help

 --
 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 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] PHP oracle 9.2

2004-02-17 Thread Christopher Jones


Delfins wrote:

i have successfully installed Oracle 9.2 on Slackware 9.0
database works fine  also any other applications runs ok.
but when i compiled PHP5 with OCI8 (path i was specified as ORACLE_HOME)
but running some scrip, i have this error :
Warning: ocilogon(): _oci_open_server: Error while trying to retrieve 
text for error ORA-12154
There is some information in:

  http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars

The error you are getting is mentioned part way down in that section.

A google search especially in recent google groups postings may pick up
other causes, problem investigation tips, and solutions.
Chris

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


Re: [PHP-DB] Problem with ODBTP

2004-02-17 Thread Robert Twitty
Your query resource was detached from the connection.  Can you supply the
code prior to calling odbtp_fetch_row() and starting from odbtp_query()?

-- bob

On Tue, 17 Feb 2004, Sascha Kaufmann wrote:
l
 Hello everyone

 I try to port an application from Windows/ODBC to Linux/ODBTP, I have a
 MSSQL Server 2000.
 If I use the function odbtp_fetch_row, I get the following warn message:
 Warning: [ODBTPERR][0]Detached object in file.
 Anyone a idea what this could mean? Google won't told me that :(

 best regards
 Sascha

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

2004-02-17 Thread Hiro
hi!

I am using pg_escape_bytea to store large object into PostgresSQL.
Fortunaly, I can insert and retrieve the binary file
in postgresql. I would like to research the text from  mictosoft word
documentaion and PDF and so on inside postgresql database. Do anyone
know how to find text from  which word documentation or other binary
file are stored?


Regards,
hiro

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



Re: [PHP-DB] sql, problem with join and presentation

2004-02-17 Thread Frank Flynn
There are two ways to do what you ask:

1 - run your first query (just the classes no sections) and before the loop
to display the results open a new - different connection to the DB then
in the loop where you are displaying the results after displaying each class
run a query to find all of it's sections and display them.  Possible
weakness is many connections to the DB (not a big deal but may not scale
well) and if there is a class that has no section this quarter then you
would only find that out after you displayed the class (could be fixed in
your first query or by checking for sections before you displayed the class)

2 - Select everything (classes and sections) in one query
 SELECT *
   FROM classes, CLASSCODES
   WHERE classCategory='$Category'
AND classDeleted=0
AND CLASSCODES.classID = CLASSES classID


   ORDER BY $order $reorder -- not sure what you are doing here but you
will need to add classID at the end of this list.

Now you will get back these columns:
 classID classDescription classTexts classCost classDeleted classCodeID

 classID classCodeSection classDate classTime classLocation classInstructor

And the columns from the CLASSES table will be duplicated for each section
(this is why you must sort by classID to keep them all together).

So before the loop to display the results you set $thisClassID = 0;

And first thing in the loop you check:

   if ($thisClassID != result[classID])
{
/*This is a new class, display it's info*/
echo result[classDescription] 
/* don't forget to reset this */
$thisClassID = result[classID];
}

/* now display the section info... */

Good Luck,
Frank

On 2/17/04 9:49 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 From: mayo [mailto:[EMAIL PROTECTED]
 Sent: Sunday, February 15, 2004 11:56 PM
 To: php-db
 Subject: [PHP-DB] sql, problem with join and presentation
 
 
 Currently I display a list of classes.
 Simplified SQL and display below:
 
 SELECT *
 FROM classes
 WHERE
 classCategory='$Category' AND
 classDeleted=0
 ORDER BY $order $reorder
 
 The presentation is:
 
 +--+--++
 | CLASS TITLE  | LOCATION | CLASS CODE |
 +--+--++
 | CLASS DESCRIPTION br/br/ |
 | CLASS INSTRUCTOR br/br/  |
 | CLASS TIME   |
 +--+
 
 
 Now, things are getting a little more complicated.  Each class is going to
 have sections. So the display will be:
 
 CLASS TITLE
 CLASS DESCRIPTION
 
 CLASS CODE : CLASS SECTION .. LOCATION .. CLASS TIME .. INSTRUCTOR
 
 example (simplified)
 
 +-+
 | INTRO TO AAA|
 +-+
 | This is a really interesting    |
 | |
 +-+-+++
 |HT-111:A | NYC | 12:00-4:00 | Albert Alkin   |
 |HT-111:B | JC  | 2:00-6:00  | Bob Bailey |
 |HT-111:C | BX  | 4:00-8:00  | Chris Cawley   |
 +-+-+++
 
 
 I'm having a really hard time coming up with the sql for this.
 
 I want to (pseudo)
 
 select *
 from classes and classSections
 where classDeleted=0
 and group by classCode
 
 tables below
 
 CLASSES
 classID
 classDescription
 classTexts
 classCost
 classDeleted
 
 CLASSCODES
 
 classCodeID
 classID
 classCodeSection
 classDate
 classTime
 classLocation
 classInstructor
 
 I'm going nuts trying to get this. I must be missing something simple.
 (using mysql)
 
 thx for any clues
 
 Gil


-- 
Frank Flynn
Poet, Artist  Mystic

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



[PHP-DB] php/mysql weblog - addnews function problems

2004-02-17 Thread Slippyaah
hey,

I've been working on a PHP/MYSQL weblog and I've got most of it working
apart from the adding new news function and a login section.   I've set the
form up but it is coming up with a few errors and the actual submitting of
data doesn't work as of yet.  The code is too long to include in this post
and its hard to explain exactly where it is going wrong because I'm fairly
new to PHP and MYSQL - this is my first stab at them both.

Just wandering if anyone could take a couple of minutes to look at my php
code and tell me what is wrong with it? (it's probably something blindingly
obvious;))

thanks very much

slippy

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



[PHP-DB] Update Statement

2004-02-17 Thread Ng Hwee Hwee
hi all,

I would like to do the following:

update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no = Table2.no

however, i found that multiple updates can only work for MySQL version 4.0.4 but mine 
is 3.23.54... can anyone enlighten me on how I can achieve the same results with this 
older MySQL version? or can PHP 4.2.2 help me in any way?

Thank you so much!

Hwee

[PHP-DB] Is it safe to do this?

2004-02-17 Thread JeRRy
Hi,

Is it safe to do this:

snip

foreach ($addresses as $email) {
$body = str_replace($email, $comp_uri, $body);
   mysql_query (update users SET email_setting='-1'
WHERE email='$email') or die (Can't set
email_setting);
   mysql_query (UPDATE users SET email_setting='-1'
WHERE email_setting  -5) or die (Unable );

/snip

Or would I be better to do this?:

snip

foreach ($addresses as $email) {
$body = str_replace($email, $comp_uri, $body);
   mysql_query (update users SET emailerror='+1'
WHERE email='$email') or die (Can't update
email_setting);
   mysql_query (UPDATE users SET email_setting='-1'
WHERE emailerror  5) or die (Unable );

/snip

Suggestions welcome.

Jerry

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



[PHP-DB] Re: Is it safe to do this?

2004-02-17 Thread Justin Patrin
That depends on what you're doing. Here's why I can't provide feedback:
  1) Your code isn't at all complete, the foreach isn't even finished.
  2) Where does the $addresses variable come from and what are you 
trying todo with it?
  3) What is the mysql table and its columns supposed to represent?
  4) What is this code supposed to accomplish?

Jerry wrote:

Hi,

Is it safe to do this:

snip

foreach ($addresses as $email) {
$body = str_replace($email, $comp_uri, $body);
   mysql_query (update users SET email_setting='-1'
WHERE email='$email') or die (Can't set
email_setting);
   mysql_query (UPDATE users SET email_setting='-1'
WHERE email_setting  -5) or die (Unable );
/snip

Or would I be better to do this?:

snip

foreach ($addresses as $email) {
$body = str_replace($email, $comp_uri, $body);
   mysql_query (update users SET emailerror='+1'
WHERE email='$email') or die (Can't update
email_setting);
   mysql_query (UPDATE users SET email_setting='-1'
WHERE emailerror  5) or die (Unable );
/snip

Suggestions welcome.

Jerry

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com


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


[PHP-DB] Re: resultset problem

2004-02-17 Thread David Robley
In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 HI all,
 
 I am querying a db and getting the resultset, then to get out each
 individual field of the resultset (which is a single unique line all the
 time)  as mysql_result($result2, 0, p_company). the problem is that if the
 actual field has a space in it say Sun microsystems, I only get sun and
 it doesnt give me anything after the first space.
 
 I have looked at the manual but as far as im concerned its really vague in
 its description of alot of the mysql functions.
 any idea what could be causing this??
 
 thanx Angelo

How do you _know_ you are only getting back up to the first space? 
Depending on how you are trying to display the results, your html may be 
incorrect, giving the false impression that you have missing information.

If, for example, you are displaying in a text field like this:

INPUT TYPE=TEXT VALUE=php echo $value

then you need to quote the value to avoid the problem you describe.

If this is not the case, perhaps a snippet of code that illustrates the 
problem might help us to help you.

-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP-DB] Re: php/mysql weblog - addnews function problems

2004-02-17 Thread David Robley
In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 hey,
 
 I've been working on a PHP/MYSQL weblog and I've got most of it working
 apart from the adding new news function and a login section.   I've set the
 form up but it is coming up with a few errors and the actual submitting of
 data doesn't work as of yet.  The code is too long to include in this post
 and its hard to explain exactly where it is going wrong because I'm fairly
 new to PHP and MYSQL - this is my first stab at them both.
 
 Just wandering if anyone could take a couple of minutes to look at my php
 code and tell me what is wrong with it? (it's probably something blindingly
 obvious;))
 
 thanks very much
 
 slippy
 

Perhaps if you were to post the errors returned and the few lines of code 
leading up to the line where the error occurs...


-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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