[PHP-DB] Re: pg_fetch_result returns something other than boolean???

2002-09-04 Thread Yasuo Ohgaki

Matthew Newby wrote:
 I am having trouble with the pg_fetch_result function when trying to access
 a boolean field in a PostgreSQL database.  Here's the code snippet:

It's a spec.

PostgresSQL's boolean is returned as 't' or 'f' and both are string.
Test as string.

--
Yasuo Ohgaki


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




[PHP-DB] MySQL order by in greek

2002-09-04 Thread Achilleas Maroulis

Hi, I have a MySQL problem but due to small problem of my email I can't subscribe to a 
MySQL list so I wonder if someone from you can answer (actually I'm sure about it...)
My problem is that I have a query that fetches all data from a table in alphabetical 
order using the ...order by col_name asc... command. The problem is that the data in 
this column is not in english but in greek (as I am Greek!!) and they are not coming 
in the right order.
I don't know where to start searching for the solution... 
Is it the operating sysytem (SuSE LINUX 8.0 in greek) or the MySQL installation (v3.23 
which came with the SuSE installation)?

Thanx in advance...



RE: [PHP-DB] Upload csv file into mysql

2002-09-04 Thread rhelms

Hi Dr. Indera, 

 
 Is there a way to upload data in a csv file into a mysql table?

Try phpMyadmin.

Regards,
Ruprecht

---
Ruprecht Helms  -   IT-Service und Softwareentwicklung

Homepage: http://www.rheyn.de
email: [EMAIL PROTECTED]
=
E-Mail: Ruprecht Helms [EMAIL PROTECTED]
Date: 04-Sep-02
Time: 10:10:56

This message was sent by XFMail
---

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




Re: [PHP-DB] Upload csv file into mysql

2002-09-04 Thread Ignatius Reilly

Hi Dr,

try:

LOAD DATA INFILE myfile.csv INTO TABLE mytable
FIELDS TERMINATED BY ,
LINES TERMINATED BY \r\n ;

of course, the structure of your CSV file must match exactly that of your
table.

hth

- Original Message -
From: Dr. Indera [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 04, 2002 6:20 AM
Subject: [PHP-DB] Upload csv file into mysql


 Hello,

 Is there a way to upload data in a csv file into a mysql table?

 Thanks
 Indera



 --
 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] Upload csv file into mysql

2002-09-04 Thread Karel

Hi this was very helpful to me, just now trying that

what if i have TABLE (id_item, rate1, rate2, rate3, rate4)

and

CSV file like foll

id_item,rate1,rate2
1,250,260
2,270,280
5,290,290

and what exactly mean \r in a TERMINATED BY?

thx kaja



S prátelským pozdravem
Karel Príbramský
AbiaNet, s.r.o.-www.abianet.cz---


-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 04, 2002 9:51 AM
To: [EMAIL PROTECTED]; Dr. Indera
Subject: Re: [PHP-DB] Upload csv file into mysql


Hi Dr,

try:

LOAD DATA INFILE myfile.csv INTO TABLE mytable
FIELDS TERMINATED BY ,
LINES TERMINATED BY \r\n ;

of course, the structure of your CSV file must match exactly that of your
table.

hth

- Original Message -
From: Dr. Indera [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 04, 2002 6:20 AM
Subject: [PHP-DB] Upload csv file into mysql


 Hello,

 Is there a way to upload data in a csv file into a mysql table?

 Thanks
 Indera



 --
 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] mysql_fetch_assoc question

2002-09-04 Thread Graeme McLaren

Hey all,

I managed to find that if I do:

$MemberID = mysql_query(SELECT ID FROM SiteMember WHERE Username =
'$valid_user');
$array = mysql_fetch_assoc($MemberID);
print_r($array);

this will produce:

Array ( [ID] = 3 )

All I want is the value 3 so that I can go ahead and insert that into the
Lookup table.

Any ideas how I can just extract this value?  I'm also not 100% clear on
what mysql_fetch_assoc does, can anyone explain it?


Cheers in advance,

Graeme :)


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




Re: [PHP-DB] Upload csv file into mysql

2002-09-04 Thread Ignatius Reilly

You have to create your CSV by escaping the real data commas (eg
1\,250\,260) when creating your CSV file - \ usually works, but you can
choose sth else if you have \ actual data characters (usually not
recommended!).

and add
ESCAPED BY \ to your LOAD statement

HTH

Ignatius

- Original Message -
From: Karel Pøíbramský [EMAIL PROTECTED]
To: Ignatius Reilly [EMAIL PROTECTED]; [EMAIL PROTECTED];
Dr. Indera [EMAIL PROTECTED]
Sent: Wednesday, September 04, 2002 10:33 AM
Subject: RE: [PHP-DB] Upload csv file into mysql


 Hi this is very helpful to me

 what if i have TABLE (id_item, rate1, rate2, rate3, rate4)

 and

 CSV file like foll

 id_item,rate1,rate2
 1,250,260
 2,270,280
 5,290,290

 ?

 thx kaja



 S prátelským pozdravem
 Karel Príbramský
 AbiaNet, s.r.o.-www.abianet.cz---


 -Original Message-
 From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 04, 2002 9:51 AM
 To: [EMAIL PROTECTED]; Dr. Indera
 Subject: Re: [PHP-DB] Upload csv file into mysql


 Hi Dr,

 try:

 LOAD DATA INFILE myfile.csv INTO TABLE mytable
 FIELDS TERMINATED BY ,
 LINES TERMINATED BY \r\n ;

 of course, the structure of your CSV file must match exactly that of your
 table.

 hth

 - Original Message -
 From: Dr. Indera [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, September 04, 2002 6:20 AM
 Subject: [PHP-DB] Upload csv file into mysql


  Hello,
 
  Is there a way to upload data in a csv file into a mysql table?
 
  Thanks
  Indera
 
 
 
  --
  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] mysql_fetch_assoc question

2002-09-04 Thread DL Neil

Hey Graeme,

 $MemberID = mysql_query(SELECT ID FROM SiteMember WHERE Username =
 '$valid_user');
 $array = mysql_fetch_assoc($MemberID);
 print_r($array);
 this will produce:
 Array ( [ID] = 3 )

 All I want is the value 3 so that I can go ahead and insert that into the
 Lookup table.
 Any ideas how I can just extract this value?  I'm also not 100% clear on
 what mysql_fetch_assoc does, can anyone explain it?


mysql_fetch_assoc() takes the response from MySQL (the query resultset) and
hands it to PHP as an associative array. This array only consists of one
element: $array['ID'] - which in your example has the value 3. So echo
$array['ID']; or similar use will give you what you seem to be asking for.

Please read the manual:
mysql_fetch_assoc() and the whole appendix on MySQL functions
array processing and associative arrays

Of course if you are resolving the value (3) in order to submit that to
another query (Lookup table), then you should be looking at relational
database methodology and table joins!

Regards,
=dn



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




[PHP-DB] [mysql] query atomicity

2002-09-04 Thread :B nerdy

how would i go about making a few queries into a transaction - that is, if
one of them fails, the previous queries get rolled back...

cheers




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




Re: [PHP-DB] Using a variable as a variable name

2002-09-04 Thread Pierre-Alain Joye

hello,

You can find syntax description in the documentation (variable variables section)

$myvar1  = MYVAR1 CONTENT;
$myvar2  = MYVAR2 CONTENT;
$i = 0;
$myvar = 'myvar'.++$i;
echo \n;
echo $$myvar;
echo \n;
$myvar = 'myvar'.++$i;
echo \n;
echo $$myvar;
echo \n;

can do it

hth

pa

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




[PHP-DB] Re: pg_fetch_result returns something other than boolean???

2002-09-04 Thread Matthew Newby

Yasuo Ohgaki [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Matthew Newby wrote:
  I am having trouble with the pg_fetch_result function when trying to
access
  a boolean field in a PostgreSQL database.  Here's the code snippet:

 It's a spec.

 PostgresSQL's boolean is returned as 't' or 'f' and both are string.
 Test as string.

 --
 Yasuo Ohgaki

Yasuo,
Many thanks for the info. I discovered that test yesterday. However, if
that is indeed the way I should test it, then something probably needs to
change in the PHP docs. On the page
http://www.php.net/manual/en/function.pg-fetch-result.php it explicitly
states:

PostgreSQL has many built in types and only the basic ones are directly
supported here. All forms of integer, boolean and void types are returned as
integer values. All forms of float, and real types are returned as float
values. All other types, including arrays are returned as strings formatted
in the same default PostgreSQL manner that you would see in the psql
program.

However, it appears that booleans are NOT returned as integer types, but
rather as single character 't' or 'f', at least as far as PHP is concerned.

Thanks!

-matt



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




Re: [PHP-DB] [mysql] query atomicity

2002-09-04 Thread :B nerdy

i am unfarmillar with InnoDB, i am currently using MyISAM i believe. just
the default one.

i am a complete noobie with InnoDB, do i have to convert my db?

cheers


Andrey Hristov [EMAIL PROTECTED] wrote in message
014d01c2540b$d309bf40$1601a8c0@andreywin">news:014d01c2540b$d309bf40$1601a8c0@andreywin...
 Choices
 1) Use InnoDB
 2) If you cannot use innodb than you can write your code in the way you
add
 in an array
 queries that will rollback the change :

 if you do
 $r1 = mysql_query('insert into some_table (k1,k2) values (4,2);');
 $r1 = mysql_query('insert into some_table (k1,k2) values (5,3);');

 you must have in the rollback array this
 $rollback_ar = array('DELETE FROM some_table WHERE k1=4 and k2=2;',
 'DELETE FROM some_table WHERE k1=5 and k2=3');

 Hope this is clear.

 Best regards
 Andrey Hristov


 - Original Message -
 From: :B nerdy [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, September 04, 2002 3:04 PM
 Subject: [PHP-DB] [mysql] query atomicity


  how would i go about making a few queries into a transaction - that is,
if
  one of them fails, the previous queries get rolled back...
 
  cheers
 
 
 
 
  --
  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_query creates wrong query

2002-09-04 Thread Sascha Alexander Jopen

Hi there,

I'm new to PHP, especially to the db-functions.
I've got a problem querying my PostgreSQL server using pg_query.
The Tables i'm working on contain colume names with uppercase letters.
Working on those tables directly with psql, the client program delivered
with postgresql, works like expected. Its case-sensitive, so you have to
specify the table names with the correct case of the letters. But pg_query
seems to convert all queries into lowercase.

A query like: INSERT INTO users (UsrLoginName, UsrPassword) VALUES ...
results in an errormessage like: PHP Warning:  pg_query() query failed:
ERROR:  Relation 'users' does not have attribute 'usrloginname' ...

What did i do wrong? Or is it a problem with the postgresql db-package of
PHP?

I think, if the backend is case-sensitive, PHP's functions should be
case-sensitiv, too!
Please don't tell me to convert all tables/colums to lowercase!

My config:
Apache 2.0.40 + PHP 4.2.2 + PostgreSQL 7.2.2

Thanks in advance,
Sascha



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




[PHP-DB] Bug using Interbase/Firebird in combination with shared memory

2002-09-04 Thread Nils Groges

Hello,

i have a php skript that does some calculations and write the result to 
a firebird database. All works fine, but as soon as i put this line into 
the skript:

$shmid = shm_attach (12345, 1, 0600);

i get this error message:

Warning: InterBase: attempted update during read-only transaction

so i cannot write to the database anymore. Select statements still works 
fine.

This seems to bee a bug 'cos the shared memory is not concerned to the 
firebird insert action. These are two completly different things.

Any suggestions.Tanks

Bye
Nils


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




Re: [PHP-DB] Database question

2002-09-04 Thread Raquel Rice

On Tue, 20 Aug 2002 18:34:48 -0500
Shiloh Madsen [EMAIL PROTECTED] wrote:

 I was wondering if there were any good documents out there about
 good database design...I know the basics of creating tables,
 setting data types and such, and now i want to know how to use it
 to the best effect...generating logical, streamlined tables, etc. 
 
snip

I still have the textbook from my college days, Database Processing
- Fundamentals - Design - Implementation.  We spent a good deal of
time on normalization, the process of grouping attributes to form
tables with well-structured relationships.

-- 
Raquel

We can't all be heroes because somebody has to sit on the curb and
clap as they go by.
  --Will Rogers


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




[PHP-DB] Form question.......

2002-09-04 Thread Rodrigo

Hi, i have a question, it may be dumb, but i´m very new with php and mysql, i need 
help.

 how can i check a form when i change from one field to another I want make a 
condition.if the number i typed is allready in the database, not just when i 
finish filling out the hole form...clickin in submit and then make the 
conditionshelp  heheheh




 Rodrigo Corrêa
 [EMAIL PROTECTED] 



  Obs: Sorry about the english, i´m from Brazil...so my english isn´t good
 




[PHP-DB] ping

2002-09-04 Thread bo

Hi,
This is not exactly fall in the category of php and mysql, but hopefully
that you can shed a light for me.
My question is how can we write a php ping script to ping some website and
output the ip address of the website automatically on webpage?

It's the same idea that ping www.google.com in cmd prompt(win2k)but output
the result in a webpage.
Any feedbacks and info will be appreciated.
Thanks.

Bo



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




[PHP-DB] ping2

2002-09-04 Thread bo

I just figured out how to retrieve ip but instantly thought of something
more, how do I make it as an href link once I got the ip?

Thanks,

Bo



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




RE: [PHP-DB] ping2

2002-09-04 Thread Andrew Wilson

Hi, four questions.

1) Are you using linux ?
2) Will this I.P that you want to ping be stored in the script internally or
fed to it at time of running?
3) Does it have to be in Php ?
4) Will this script be run on the same server as your webserver ?

-Original Message-
From: bo [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 05, 2002 12:34 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] ping2


I just figured out how to retrieve ip but instantly thought of something
more, how do I make it as an href link once I got the ip?

Thanks,

Bo



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


Netway Networks Pty Ltd 
(T) 8920 8877 
(F) 8920 8866 



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