Re: [PHP-DB] Connectivity PHP4 > mysql

2004-01-15 Thread Micah Stevens

Sounds like you don't have MySQL turned on in PHP. Check phpinfo(); to see if 
the module is listed in there. 

-Micah

On Thu January 15 2004 2:42 pm, Georg Herland wrote:
> Hi
>
> I've got two servers, one (RH9) with PHP4 and mysql-server and one (RH7.3)
> running PHP4 and mysql client only.
>
> The problem is that I get the following errormessage from PHP when trying
> to open a db-link:
>
> PHP Fatal error:  Call to undefined function:  mysql_connect() in
> /data1/www/root/test.php on line 3...
>
> Running mysql client works fine, same as PHP in general.
> I have compared the two servers and cannot find any major differences in
> PHP configuration, in fact they are identical, and the rpm php-mysq -packet
> is in place too.
>
> Is this situation familiar to anyone of you?
> All help is appreciated!
>
> Georg Herland
> Bergen, Norway

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



[PHP-DB] Connectivity PHP4 > mysql

2004-01-15 Thread Georg Herland
Hi

I've got two servers, one (RH9) with PHP4 and mysql-server and one (RH7.3)
running PHP4 and mysql client only.

The problem is that I get the following errormessage from PHP when trying to
open a db-link:

PHP Fatal error:  Call to undefined function:  mysql_connect() in
/data1/www/root/test.php on line 3...

Running mysql client works fine, same as PHP in general.
I have compared the two servers and cannot find any major differences in PHP
configuration, in fact they are identical, and the rpm php-mysq -packet is
in place too.

Is this situation familiar to anyone of you?
All help is appreciated!

Georg Herland
Bergen, Norway

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



[PHP-DB] Re: L'utente Fabio Farinelli ha cambiato indirizzo di posta elettronica.

2004-01-15 Thread Justin Patrin
Ignatius Reilly wrote:

Somebody with admin rights to this list please castrate this Farinelli user.

+1 on that!

--
paperCrane 
--
Question Everything, Reject Nothing
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: L'utente Fabio Farinelli ha cambiato indirizzo di posta elettronica.

2004-01-15 Thread Ignatius Reilly
Somebody with admin rights to this list please castrate this Farinelli user.

Thanks
_
- Original Message -
To: "Ignatius Reilly" <[EMAIL PROTECTED]>
Sent: Thursday, January 15, 2004 20:22
Subject: L'utente Fabio Farinelli ha cambiato indirizzo di posta
elettronica.


Il nuovo indirizzo è: [EMAIL PROTECTED]
La mail è stata comunque inoltrata entro 60 minuti al nuovo indirizzo di
posta.
Si consiglia sin da subito l'utilizzo del nuovo indirizzo; a breve il
vecchio indirizzo verrà inattivato.

Questa è una mail di servizio. NON rispondere.

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



[PHP-DB] Re: PHP4.2.3 and Oracle 9.2

2004-01-15 Thread Justin Patrin
Error display on browser:

Warning: SQL error: Specified driver could not be loaded due to system 
error 5 (Oracle in OraHome92)., SQL state IM003 in SQL Connect in 
c:\inetpub\wwwroot\PHP\testora.php on line 2.

Warning: odbc_exec(): Supplied argument is not a valid ODBC-Link 
resource in c:\inetpub\wwwroot\PHP\testora.php on line 5

Warning: odbc_fetch_into(): Supplied argument is not a valid ODBC result 
resource in c:\inetpub\wwwroot\PHP\testora.php on line 6

Warning: odbc_close(): Supplied argument is not a valid ODBC-Link 
resource in c:\inetpub\wwwroot\PHP\testora.php on line 14

If you're using seperate PHP compilations for command-line and Apache 
(ie. a php binary for CLI and mod_php for apache) then it is likely that 
the same things were not compiled into both.

Of course, since this is ODBC, it seems unlikely that this is the 
problem. It's probably some kind of ODBC configuration issue. Check the 
documentation for ODBC on Linux and make sure that the web version of 
PHP has the correct settings (use phpinfo()).

--
paperCrane 
--
Question Everything, Reject Nothing
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] PHP4.2.3 and Oracle 9.2

2004-01-15 Thread William Cheung








I am using PHP 4.2.3 and Oracle 9.2. I
have a test file that runs successfully in command line. But when I use a
browser to open the file, it gives SQL error. Could anyone give me any insight
what could be wrong?

 

Testora.php:



$conn_ptr = odbc_connect(“ORACLEDB”,”USERID”,”USERPASSWORD”);

print $conn_ptr.”\r\n”;

ob_flush();

$SQLReturn = odbc_exec($conn_ptr,”SELECT
company_name FROM company”);

$ReturnRows = odbc_fetch_into($SQLReturn,$line,1);

 

while ($ReturnRows){

  print
$line[0].”\r\n”;

  ob_flush();

  $ReturnRows
= odbc_fetch_into($SQLReturn,$line);

}

 

odbc_close($conn_ptr);

?>

 

Command line output:

Resource id #1

Company name list…

 

Error display on browser:

Warning: SQL error: Specified driver could
not be loaded due to system error 5 (Oracle in OraHome92)., SQL state IM003 in
SQL Connect in c:\inetpub\wwwroot\PHP\testora.php on line 2.

Warning: odbc_exec(): Supplied argument is
not a valid ODBC-Link resource in c:\inetpub\wwwroot\PHP\testora.php on line 5

Warning: odbc_fetch_into(): Supplied argument
is not a valid ODBC result resource in c:\inetpub\wwwroot\PHP\testora.php on
line 6

Warning: odbc_close(): Supplied argument
is not a valid ODBC-Link resource in c:\inetpub\wwwroot\PHP\testora.php on line
14

 



William Cheung B.Sc, MCSE, MCDBA

Databyte Corp. 



 








---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 1/08/2004
 

  


Re: Re[2]: [PHP-DB] multi-language site

2004-01-15 Thread Ignatius Reilly
Quite right.

When implementing gettext, one will normally use the rule 1 string = 1
sentence (such as "please select a country").

_
- Original Message -
From: "Richard Davey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 15, 2004 19:48
Subject: Re[2]: [PHP-DB] multi-language site


> Hello Ignatius,
>
> Thursday, January 15, 2004, 6:41:44 PM, you wrote:
>
> IR> Gettext is NOT an automated translation service. What you do is mark
strings
> IR> to translate in the original application, then have them translated by
a
> IR> human. When confronted with a marked string to echo, the application
will
> IR> look up in the translated file for the corresponding translation.
>
> I use something very similar to this on a few of my sites. I had to
> get the whole sentences translated though - you cannot just get
> individual words translated and string them together because as you
> know, the order of the words varies dramatically from language to
> language.
>
> --
> Best regards,
>  Richardmailto:[EMAIL PROTECTED]
>
> --
> 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] db php question

2004-01-15 Thread Richard Davey
Hello,

Thursday, January 15, 2004, 7:09:25 PM, you wrote:

r> I have a very crude script set up that I am using to keep track of IP
r> addresses, MAC addresses, etc and it dumps into mysql.  I am using a
r> column called "id" which is my primary key and auto-increments.  My
r> question is that I want to make sure that I don't get duplicate IP
r> addresses added into the database and right now it is a varchar field
r> and anything can be put in there.  If I change the column and make it my
r> primary key will that prohibit duplicate entries?  Is there a better way
r> to do this?  I am not a programmer either so I am having to hack my way

Set the IP column type to be Unique. It doesn't have to be a Primary
Key just to be unique.

r> through this.  The second thing that I wanted to do was to be able to
r> run a simple web form search for either ip addresses or computer name
r> and return results.  From what I have seen this seems pretty complex -

Actually, it's pretty simple. If you can post your SQL table structure
here someone could show you how to write a PHP script to display that
information pretty quickly I would have thought.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] Solaris apache 2.0.47 + php 4.3.4 + oracle 9i ( oci8 support in php as shared module )

2004-01-15 Thread Martin Marques
Mensaje citado por Daniel Sand <[EMAIL PROTECTED]>:

> Hi Folks,
> 
> I have an generic question.
> 
> first of all. The stuff runs fine.
> 
> But ( the question ? )
> 
> If i make any DB connections from any Virtual Server that i configured 
> in apache, PHP always takes the Main Ethernet Interface. Not The Virtual 
> IP's of the card that are configure in the httpd.conf.
> 
> This isn't a real problem, maybe it's allready solved. I'm not sure.
> 
> But is their a way to declare over which ip PHP calls the Oracle Database ?

I think no.
By the way, Solaris has some obscure ways of working with multiple net interfaces.

> or even if this not exists, should their not be a way to delcare this.
> 
> Im thinking of in a secure reason, i think it should.

Why would you think that there's a risk?
If you have control over your server you shouldn't have any trouble (always speeking
as an unknowledged person to Oracle configuration).

-- 
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



[PHP-DB] db php question

2004-01-15 Thread redhat
I have a very crude script set up that I am using to keep track of IP
addresses, MAC addresses, etc and it dumps into mysql.  I am using a
column called "id" which is my primary key and auto-increments.  My
question is that I want to make sure that I don't get duplicate IP
addresses added into the database and right now it is a varchar field
and anything can be put in there.  If I change the column and make it my
primary key will that prohibit duplicate entries?  Is there a better way
to do this?  I am not a programmer either so I am having to hack my way
through this.  The second thing that I wanted to do was to be able to
run a simple web form search for either ip addresses or computer name
and return results.  From what I have seen this seems pretty complex -
any thoughts?
thanks,
DF

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



Re[2]: [PHP-DB] multi-language site

2004-01-15 Thread Richard Davey
Hello Ignatius,

Thursday, January 15, 2004, 6:41:44 PM, you wrote:

IR> Gettext is NOT an automated translation service. What you do is mark strings
IR> to translate in the original application, then have them translated by a
IR> human. When confronted with a marked string to echo, the application will
IR> look up in the translated file for the corresponding translation.

I use something very similar to this on a few of my sites. I had to
get the whole sentences translated though - you cannot just get
individual words translated and string them together because as you
know, the order of the words varies dramatically from language to
language.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] multi-language site

2004-01-15 Thread Ignatius Reilly
Hi.

Richard, you seem to be confusing gettext with something else.

Gettext is NOT an automated translation service. What you do is mark strings
to translate in the original application, then have them translated by a
human. When confronted with a marked string to echo, the application will
look up in the translated file for the corresponding translation.

Cheers

Ignatius
_
- Original Message -
From: "Hutchins, Richard" <[EMAIL PROTECTED]>
To: "Dan Hewins" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 15, 2004 19:16
Subject: RE: [PHP-DB] multi-language site


> $.02 from a technical writer:
>
> If you're going to translate your content from English directly to a
foreign
> language using machine translation (which is what gettext would amount to)
> be very careful. There is a difference between translation and
localization.
> The free Babelfish service is a good example of translation. You'll get a
> word-for-word translation of whatever you want to type in the English box.
> However, what shows up in the translation box is not always what you meant
> in English. Have you ever bought a Japanese product whose instructions
read:
> "Use caution when opening my box. I wormhole swimming pool orange piranha
> yesterday, sir."
>
> Your best bet may be to write all of the English text, have it translated
> and put into XML files as Ignatius suggested, then use PHP to set/retrieve
> cookie settings to display the proper language.
>
> I can personally vouch for the difference between text that has been
> machine-translated only and text that has been machine translated and
> reviewed/corrected by a human. Machine translation cannot match a human's
> ability to compensate and account for context and usage. There are quite a
> few localzation companies (SH3, VistaTec, SDL International) who
specialize
> in translating content for web sites even in XML format. Send them an
> English XML document, they'll send you a Spanish one back without messing
> with your tags - only the content gets translated.
>
> Of course, it DOES all come down to dollars and cents and how important
the
> translation really is; only you can decide that.
>
> HTH
>
> Rich
>
> > -Original Message-
> > From: Ignatius Reilly [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, January 15, 2004 1:03 PM
> > To: Dan Hewins; [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] multi-language site
> >
> >
> > I would not consider a DB-based design.
> >
> > I use two approaches (sometimes mixed):
> >
> > 1. Write content in XML files (one per language) and
> > transform them with
> > XSLT. This is nice for mostly content-based sites.
> >
> > 2. Write the complete application in English and translate it with the
> > excellent PHP gettext() extension. Makes it fast, efficient
> > and very cheap
> > to maintain. A better option for web applications.
> >
> > In any case the user's language must be stored in a session variable.
> >
> > HTH
> > Ignatius
> >
> > _
> > - Original Message -
> > From: "Dan Hewins" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, January 15, 2004 18:50
> > Subject: [PHP-DB] multi-language site
> >
> >
> > > Forgive me if this is pedestrian or has been covered
> > before.  I'm new
> > > to the list and I haven't used PHP too much (yet).
> > >
> > > Here's my question:
> > >
> > > I'm looking to use PHP for an upcoming site project where the site
> > > needs to be in either English or Spanish. Would PHP be a
> > good approach?
> > > I was envisioning having a database with every text bit and
> > image with
> > > text in it in two columns, one for English, and one for
> > Spanish. Then
> > > each web page would reference some kind of global variable
> > (a cookie?)
> > > to determine whether to pull the images and text from the English
> > > column or the Spanish column. Does this sound like a good
> > approach? Is
> > > PHP capable of something like this?
> > >
> > > Thanks for any help or suggestions you can give.
> > >
> > > Dan Hewins
> > >
> > > --
> > > 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] multi-language site

2004-01-15 Thread Hutchins, Richard
$.02 from a technical writer:

If you're going to translate your content from English directly to a foreign
language using machine translation (which is what gettext would amount to)
be very careful. There is a difference between translation and localization.
The free Babelfish service is a good example of translation. You'll get a
word-for-word translation of whatever you want to type in the English box.
However, what shows up in the translation box is not always what you meant
in English. Have you ever bought a Japanese product whose instructions read:
"Use caution when opening my box. I wormhole swimming pool orange piranha
yesterday, sir."

Your best bet may be to write all of the English text, have it translated
and put into XML files as Ignatius suggested, then use PHP to set/retrieve
cookie settings to display the proper language.

I can personally vouch for the difference between text that has been
machine-translated only and text that has been machine translated and
reviewed/corrected by a human. Machine translation cannot match a human's
ability to compensate and account for context and usage. There are quite a
few localzation companies (SH3, VistaTec, SDL International) who specialize
in translating content for web sites even in XML format. Send them an
English XML document, they'll send you a Spanish one back without messing
with your tags - only the content gets translated.

Of course, it DOES all come down to dollars and cents and how important the
translation really is; only you can decide that.

HTH

Rich

> -Original Message-
> From: Ignatius Reilly [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 15, 2004 1:03 PM
> To: Dan Hewins; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] multi-language site
> 
> 
> I would not consider a DB-based design.
> 
> I use two approaches (sometimes mixed):
> 
> 1. Write content in XML files (one per language) and 
> transform them with
> XSLT. This is nice for mostly content-based sites.
> 
> 2. Write the complete application in English and translate it with the
> excellent PHP gettext() extension. Makes it fast, efficient 
> and very cheap
> to maintain. A better option for web applications.
> 
> In any case the user's language must be stored in a session variable.
> 
> HTH
> Ignatius
> 
> _
> - Original Message -
> From: "Dan Hewins" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, January 15, 2004 18:50
> Subject: [PHP-DB] multi-language site
> 
> 
> > Forgive me if this is pedestrian or has been covered 
> before.  I'm new
> > to the list and I haven't used PHP too much (yet).
> >
> > Here's my question:
> >
> > I'm looking to use PHP for an upcoming site project where the site
> > needs to be in either English or Spanish. Would PHP be a 
> good approach?
> > I was envisioning having a database with every text bit and 
> image with
> > text in it in two columns, one for English, and one for 
> Spanish. Then
> > each web page would reference some kind of global variable 
> (a cookie?)
> > to determine whether to pull the images and text from the English
> > column or the Spanish column. Does this sound like a good 
> approach? Is
> > PHP capable of something like this?
> >
> > Thanks for any help or suggestions you can give.
> >
> > Dan Hewins
> >
> > --
> > 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] Re: multi-language site

2004-01-15 Thread Justin Patrin
Please don't send a new message as a reply to a previous posting. It 
breaks threading (which associates replies to the message it replied to) 
and makes it seem that your new post is a reply to an completely 
unrelated message.

Instead, please create a new message and enter the newsgroup or list 
address in the To: box.

--
paperCrane 
--
Question Everything, Reject Nothing
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] multi-language site

2004-01-15 Thread Ignatius Reilly
I would not consider a DB-based design.

I use two approaches (sometimes mixed):

1. Write content in XML files (one per language) and transform them with
XSLT. This is nice for mostly content-based sites.

2. Write the complete application in English and translate it with the
excellent PHP gettext() extension. Makes it fast, efficient and very cheap
to maintain. A better option for web applications.

In any case the user's language must be stored in a session variable.

HTH
Ignatius

_
- Original Message -
From: "Dan Hewins" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 15, 2004 18:50
Subject: [PHP-DB] multi-language site


> Forgive me if this is pedestrian or has been covered before.  I'm new
> to the list and I haven't used PHP too much (yet).
>
> Here's my question:
>
> I'm looking to use PHP for an upcoming site project where the site
> needs to be in either English or Spanish. Would PHP be a good approach?
> I was envisioning having a database with every text bit and image with
> text in it in two columns, one for English, and one for Spanish. Then
> each web page would reference some kind of global variable (a cookie?)
> to determine whether to pull the images and text from the English
> column or the Spanish column. Does this sound like a good approach? Is
> PHP capable of something like this?
>
> Thanks for any help or suggestions you can give.
>
> Dan Hewins
>
> --
> 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] Solaris apache 2.0.47 + php 4.3.4 + oracle 9i ( oci8 support in php as shared module )

2004-01-15 Thread Daniel Sand
Hi Folks,

I have an generic question.

first of all. The stuff runs fine.

But ( the question ? )

If i make any DB connections from any Virtual Server that i configured 
in apache, PHP always takes the Main Ethernet Interface. Not The Virtual 
IP's of the card that are configure in the httpd.conf.

This isn't a real problem, maybe it's allready solved. I'm not sure.

But is their a way to declare over which ip PHP calls the Oracle Database ?

or even if this not exists, should their not be a way to delcare this.

Im thinking of in a secure reason, i think it should.

So anybody knows this problem ?

Regards Daniel

--
--
Pixelpark AG . . . . . . . . . . . . . . . . . . . . . . . . .
Daniel Sand  .  Webmaster . http://www.pixelpark.com
rotherstr. 8 .  10245 Berlin  .  Germany
phone: + 49.30.505.8 - 1790
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] multi-language site

2004-01-15 Thread Dan Hewins
Forgive me if this is pedestrian or has been covered before.  I'm new 
to the list and I haven't used PHP too much (yet).

Here's my question:

I'm looking to use PHP for an upcoming site project where the site 
needs to be in either English or Spanish. Would PHP be a good approach? 
I was envisioning having a database with every text bit and image with 
text in it in two columns, one for English, and one for Spanish. Then 
each web page would reference some kind of global variable (a cookie?) 
to determine whether to pull the images and text from the English 
column or the Spanish column. Does this sound like a good approach? Is 
PHP capable of something like this?

Thanks for any help or suggestions you can give.

Dan Hewins

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


RE: [PHP-DB] Re: Multiple SQL queries

2004-01-15 Thread Arthur Pelkey
Thanks ill check that out

-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 15, 2004 12:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Multiple SQL queries

Arthur Pelkey wrote:

> I am new this.
>  
> I have a page that has multiple queries on it, I want to do doing the
> following:
>  
> Query a mysql db multiple times in the same page, but i must be
missing
> something, I keep getting these AFTER the first queryis successful:
>  
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result resource in /path/php_file.php on line line_number
>  
> Can someone point in the right direction on how to do multiple
queries,
> some are not querying the same db btw.
>  
> -Art
>  
> 

You need to make sure that you use your statement handles and connection

handles so that the functions use the correct connection and such. Of 
course, that's a pain, so

You could try using a Database Abstraction class, such as PEAR's DB to 
help a bit with this. Even easier, though, is to use something like 
DB_DataObject which encapsulates all of this for you AND gives you a 
handy place to store all of the data.

PEAR::DB http://pear.php.net/package/DB
PEAR::DB_DataObject http://pear.php.net/package/DB_DataObject

-- 
paperCrane 
--
Question Everything, Reject Nothing

-- 
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: Multiple SQL queries

2004-01-15 Thread Justin Patrin
Arthur Pelkey wrote:

I am new this.
 
I have a page that has multiple queries on it, I want to do doing the
following:
 
Query a mysql db multiple times in the same page, but i must be missing
something, I keep getting these AFTER the first queryis successful:
 
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in /path/php_file.php on line line_number
 
Can someone point in the right direction on how to do multiple queries,
some are not querying the same db btw.
 
-Art
 

You need to make sure that you use your statement handles and connection 
handles so that the functions use the correct connection and such. Of 
course, that's a pain, so

You could try using a Database Abstraction class, such as PEAR's DB to 
help a bit with this. Even easier, though, is to use something like 
DB_DataObject which encapsulates all of this for you AND gives you a 
handy place to store all of the data.

PEAR::DB http://pear.php.net/package/DB
PEAR::DB_DataObject http://pear.php.net/package/DB_DataObject
--
paperCrane 
--
Question Everything, Reject Nothing
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: sql query, editing?

2004-01-15 Thread Justin Patrin
Louie Miranda wrote:

I have this code below, it fetches data on a mysql database. I was hoping
you could give me a code hint on where could, my goal is to display this
data on a browser which i did already and be able to edit it via a form.
edit? -> table1=value -> table2=value

I dont know where to start. please help me, i hope i can display all the
data and have a button for editing and catch which one to edit.
Well, my first suggestion is to use a database abstraction class such as 
PEAR's DB. It offers much more powerful features than the regular mysql 
extension in PHP, has better error handling, and allows you to have the 
same interface for all of the databases it supports.

My second suggestion is to use DB_DataObject and 
DB_DataObject_FormBuilder to create the forms for a table and handle 
editing the data. It really simplifies things.

My third suggestion would be to use a new package that I'm writing. It 
not only automates editing of table data, but it also shows you all of 
the records and lets you view multiple tables. Unfortunately, it's not 
out yet, but I could give you a copy if you wanted. To see the precursor 
to what I'm working on, check out RDBEdit (http://rdbedit.sf.net).

PEAR::DB http://pear.php.net/package/DB
PEAR::DB_DataObject http://pear.php.net/package/DB_DataObject
PEAR::DB_DataObject_FormBuilder 
http://pear.php.net/package/DB_DataObject_FormBuilder

--
paperCrane 
--
Question Everything, Reject Nothing
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Multiple SQL queries

2004-01-15 Thread Arthur Pelkey
I am new this.
 
I have a page that has multiple queries on it, I want to do doing the
following:
 
Query a mysql db multiple times in the same page, but i must be missing
something, I keep getting these AFTER the first queryis successful:
 
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in /path/php_file.php on line line_number
 
Can someone point in the right direction on how to do multiple queries,
some are not querying the same db btw.
 
-Art
 


Re: [PHP-DB] SQL query...

2004-01-15 Thread CPT John W. Holmes
From: "Muhammed Mamedov" <[EMAIL PROTECTED]>


> Try this
>
>  "SELECT DISTINCT(file_name), Count(file_name) AS cnt FROM $table_name
WHERE
> date
> > BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by cnt;
> > desc"

If you're GROUPing by "file_name" then you don't need DISTINCT(file_name)...
it's redundant.

---John Holmes...

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



Re: [PHP-DB] SQL query...

2004-01-15 Thread Muhammed Mamedov
Try this

 "SELECT DISTINCT(file_name), Count(file_name) AS cnt FROM $table_name WHERE
date
> BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by cnt;
> desc"

Regards,
Muhammed Mamedov
tmchat.com


- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 15, 2004 1:01 PM
Subject: [PHP-DB] SQL query...


> "SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date
> BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ???
> desc"
>
> In the above sql statement, I'm trying to achieve:
>
> 1. select all file names, between two dates.
> 2. list them, and order by the highest number of occurences of count()
>
> Basically, it's for a download tool we have, and my boss wants to easily
> be able to see the top downloaded files.
> It all works, but not the 'order by' bit... what do I have to order by...
> it's not 'file_name', and 'order by count(file_name0' causes an error...
>
> thoughts?
>
> Cheers,
> Tris...
>
> *
> The information contained in this e-mail message is intended only for
> the personal and confidential use of the recipient(s) named above.
> If the reader of this message is not the intended recipient or an agent
> responsible for delivering it to the intended recipient, you are hereby
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is
> strictly prohibited. If you have received this communication in error,
> please notify us immediately by e-mail, and delete the original message.
> ***
>
>

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



Re: [PHP-DB] SQL query...

2004-01-15 Thread Nitin Mehta
use alias for 'Count(file_name)' to use in order by clause

F.x.
"SELECT DISTINCT(file_name), Count(file_name) as file_count FROM $table_name
WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by
file_count desc"

Hope that solves it
Nitin

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 15, 2004 4:31 PM
Subject: [PHP-DB] SQL query...


> "SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date
> BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ???
> desc"
>
> In the above sql statement, I'm trying to achieve:
>
> 1. select all file names, between two dates.
> 2. list them, and order by the highest number of occurences of count()
>
> Basically, it's for a download tool we have, and my boss wants to easily
> be able to see the top downloaded files.
> It all works, but not the 'order by' bit... what do I have to order by...
> it's not 'file_name', and 'order by count(file_name0' causes an error...
>
> thoughts?
>
> Cheers,
> Tris...
>
> *
> The information contained in this e-mail message is intended only for
> the personal and confidential use of the recipient(s) named above.
> If the reader of this message is not the intended recipient or an agent
> responsible for delivering it to the intended recipient, you are hereby
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is
> strictly prohibited. If you have received this communication in error,
> please notify us immediately by e-mail, and delete the original message.
> ***
>
>

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



RE: [PHP-DB] SQL query...

2004-01-15 Thread Tristan . Pretty
Ah...
you can name the count()..
live and learn, cheers dude...




"brett king" <[EMAIL PROTECTED]> 
15/01/2004 11:17
Please respond to
<[EMAIL PROTECTED]>


To
<[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc

Subject
RE: [PHP-DB] SQL query...






"SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date
BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ???
desc"

In the above sql statement, I'm trying to achieve:

1. select all file names, between two dates.
2. list them, and order by the highest number of occurences of count()

Basically, it's for a download tool we have, and my boss wants to easily
be able to see the top downloaded files.
It all works, but not the 'order by' bit... what do I have to order by...
it's not 'file_name', and 'order by count(file_name0' causes an error...

thoughts?

Cheers,
Tris...

-

can you not do this?

"SELECT DISTINCT(file_name), Count(file_name)fcount FROM $table_name WHERE
date
BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by fcount
desc"

Please note that I have named count(file_name) fcount in the sql statement

Hope this helps?

Brett

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




*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



RE: [PHP-DB] SQL query...

2004-01-15 Thread brett king
"SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date
BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ???
desc"

In the above sql statement, I'm trying to achieve:

1. select all file names, between two dates.
2. list them, and order by the highest number of occurences of count()

Basically, it's for a download tool we have, and my boss wants to easily
be able to see the top downloaded files.
It all works, but not the 'order by' bit... what do I have to order by...
it's not 'file_name', and 'order by count(file_name0' causes an error...

thoughts?

Cheers,
Tris...

-

can you not do this?

"SELECT DISTINCT(file_name), Count(file_name)fcount FROM $table_name WHERE
date
BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by fcount
desc"

Please note that I have named count(file_name) fcount in the sql statement

Hope this helps?

Brett

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



[PHP-DB] SQL query...

2004-01-15 Thread Tristan . Pretty
"SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date 
BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ??? 
desc"

In the above sql statement, I'm trying to achieve:

1. select all file names, between two dates.
2. list them, and order by the highest number of occurences of count()

Basically, it's for a download tool we have, and my boss wants to easily 
be able to see the top downloaded files.
It all works, but not the 'order by' bit... what do I have to order by... 
it's not 'file_name', and 'order by count(file_name0' causes an error...

thoughts?

Cheers,
Tris...

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



RE: [PHP-DB] sql query, editing?

2004-01-15 Thread Humberto Silva
Create a form for editing the record
Then on the display funtion just put a link on each record to that form
and pass the id of that record like edit
On the edit form just grab the data of the $id passed on the url and put
those values on the input fields like 
Than just save the form result into the database with an UPDATE
tablename SET filed1='$field1' ... WHERE id='$id'); ...

Dont' forget the bit of code here are just examples and very insecure
... 
Need to work on the validation etc... 
 
Humberto Silva
World Editing
Portugal
 


-Original Message-
From: Louie Miranda [mailto:[EMAIL PROTECTED] 
Sent: quinta-feira, 15 de Janeiro de 2004 8:00
To: [EMAIL PROTECTED]
Subject: [PHP-DB] sql query, editing?


I have this code below, it fetches data on a mysql database. I was
hoping you could give me a code hint on where could, my goal is to
display this data on a browser which i did already and be able to edit
it via a form.

edit? -> table1=value -> table2=value

I dont know where to start. please help me, i hope i can display all the
data and have a button for editing and catch which one to edit.


## code ##
$result = mysql_query("select
product_code,title,language,issue,category,cost from iip_t_cp where
issue = $issue and category = '$category' and language = '$language' and
depleted = '$depleted'", $connect); $num_rows = mysql_num_rows($result);

function display($result)
  {
echo "pricelist records\n";
echo "";
echo "\n\n\n" .
 "\nproduct
codetitlelanguageissuecategory<
th>c
ost" .
 "\n";

  while ($row = @ mysql_fetch_row($result))
{
  echo "\n";
  foreach($row as $data)
  echo "\n\t $data ";
  echo "\n";
}

echo "\n";
}
display($result);
## code ##




-- -
Louie Miranda
http://www.axishift.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] sql query, editing?

2004-01-15 Thread Louie Miranda
I have this code below, it fetches data on a mysql database. I was hoping
you could give me a code hint on where could, my goal is to display this
data on a browser which i did already and be able to edit it via a form.

edit? -> table1=value -> table2=value

I dont know where to start. please help me, i hope i can display all the
data and have a button for editing and catch which one to edit.


## code ##
$result = mysql_query("select
product_code,title,language,issue,category,cost from iip_t_cp where issue =
$issue and category = '$category' and language = '$language' and depleted =
'$depleted'", $connect);
$num_rows = mysql_num_rows($result);

function display($result)
  {
echo "pricelist records\n";
echo "";
echo "\n\n\n" .
 "\nproduct
codetitlelanguageissuecategoryc
ost" .
 "\n";

  while ($row = @ mysql_fetch_row($result))
{
  echo "\n";
  foreach($row as $data)
  echo "\n\t $data ";
  echo "\n";
}

echo "\n";
}
display($result);
## code ##




-- -
Louie Miranda
http://www.axishift.com

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