[PHP-DB] Merge two arrays into associative arrays?

2001-05-21 Thread Shahmat Dahlan

Is there anywhere possible for me to merge two arrays into associative
arrays?

e.g.
$a=array(1,2,3,4,5);
$b=array(a,b,c,d,e)

into

$c=array(1 = a, 2 = b, etc... )

Thanks in advance..


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] image upload - mime types??

2001-05-21 Thread Jens Nedal

Hy,

First of all i would not allow upload of any graphical files without
extensions, like it is allowed on a Mac. The reason for this is that
graphical fiels without a certain extension like *.gif *.jpg *.png will
mostly not be recognized by any browser as some graphic.

A suggestion would be only to allow files with extensions, and there only a
limited amount, so everythign else generates an error.

on 19.05.2001 1:30 Uhr, matthew knight at [EMAIL PROTECTED] wrote:

 
 i've created an application where users can upload images through the form
 upload, and to ensure that they are sending me an image, i take a look at
 the type of the file (ie. $uploadedfile_type), which usually returns
 something like
 
 image/x-png
 
 however.. not always.. so secondly, i check for a file extension using
 $uploadedfile_name, but if they've loaded it from a mac.. i can't be sure
 there will be a filename.. so, those things both failing in some cases.. is
 there any other way of checking the filetype of a file?
 
 i'm concerned that some could upload malicious content and run it (although
 the execute flag is turned off, AND the filename is difficult to get.. ) and
 would like to reduce the possiblity..
 
 any suggestions?
 
 
 --
 matthew knight - online developer
 [EMAIL PROTECTED]
 
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] CHECK POST

2001-05-21 Thread Shashwat

I AM TESTING THIS NG BY THIS MESSAGE BECAUSE MY EARLIER MESSAGE WHICH I
POSTED FROM GOOGLE IS NOT STILL HERE..

if you see this please reply

SHASHWAT



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] INSERT statement

2001-05-21 Thread Bartek Pawlik

Hi,
I have problem with INSERT statement in PostgresSQL v.7.0.3.
In one script I insert values in column1,column3,column5.
Later I want to fill column2 and column4.
I use
INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = $z)
 Php shows:

Warning: PostgreSQL query failed: ERROR: parser: parse error at or near "where" in 
file.php on line x


Thanks in advance

Bartek Pawlik
Poland





-- 
26 maja - Dzie Matki. Wygraj kwiaty dla swojej Mamy!
Do rozdania 75 bukietw z dostaw i yczeniami.
[ http://zakupy.onet.pl/prezenty.asp?k=7 ]



RE: [PHP-DB] INSERT statement

2001-05-21 Thread Beau Lebens

try
INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE column1 = '$z'

quote marks around the $z
and make sure you are doing it as
query( "INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE column1
= '$z'" );
or whatever, using " marks properly :)

HTH

Beau

// -Original Message-
// From: Bartek Pawlik [mailto:[EMAIL PROTECTED]]
// Sent: Monday, 21 May 2001 4:54 PM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] INSERT statement
// 
// 
// Hi,
// I have problem with INSERT statement in PostgresSQL v.7.0.3.
// In one script I insert values in column1,column3,column5.
// Later I want to fill column2 and column4.
// I use
// INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE 
// (column1 = $z)
//  Php shows:
// 
// Warning: PostgreSQL query failed: ERROR: parser: parse error 
// at or near "where" in file.php on line x
// 
// 
// Thanks in advance
// 
// Bartek Pawlik
// Poland
// 
// 
// 
// 
// 
// -- 
// 26 maja - Dzie Matki. Wygraj kwiaty dla swojej Mamy!
// Do rozdania 75 bukietw z dostaw i yczeniami.
// [ http://zakupy.onet.pl/prezenty.asp?k=7 ]
// 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] INSERT statement

2001-05-21 Thread Russ Michell

I don't use PostgresSQL, but the SQL can't be that different:

INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE column1 = 
'$z' 

//Loose the brackets after the WHERE clause, and add single quotes 
//around your variable.
Russ

INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = 
$z)  Php shows:
On Mon, 21 May 2001 10:54:05 +0200 Bartek Pawlik 
[EMAIL PROTECTED] wrote:

 Hi,
 I have problem with INSERT statement in PostgresSQL v.7.0.3.
 In one script I insert values in column1,column3,column5.
 Later I want to fill column2 and column4.
 I use
 INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = 
 $z)  Php shows:
 
 Warning: PostgreSQL query failed: ERROR: parser: parse error at or near 
 where in file.php on line x
 
 
 Thanks in advance
 
 Bartek Pawlik
 Poland
 
 
 
 
 
 -- 
 26 maja - Dzieñ Matki. Wygraj kwiaty dla swojej Mamy!
 Do rozdania 75 bukietów z dostaw± i ¿yczeniami.
 [ http://zakupy.onet.pl/prezenty.asp?k=7 ]

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] INSERT statement

2001-05-21 Thread Miles Thompson

Bartek,

Saw all the other replies, and they are correct, but what you want now is 
an UPDATE, not an INSERT. You have the record, you are amending it.

Miles

At 10:54 AM 5/21/01 +0200, Bartek Pawlik wrote:
Hi,
I have problem with INSERT statement in PostgresSQL v.7.0.3.
In one script I insert values in column1,column3,column5.
Later I want to fill column2 and column4.
I use
INSERT INTO table (column2,column4) VALUES ('$x','$y') WHERE (column1 = $z)
  Php shows:

Warning: PostgreSQL query failed: ERROR: parser: parse error at or near 
where in file.php on line x


Thanks in advance

Bartek Pawlik
Poland





--
26 maja - Dzieñ Matki. Wygraj kwiaty dla swojej Mamy!
Do rozdania 75 bukietów z dostaw± i ¿yczeniami.
[ http://zakupy.onet.pl/prezenty.asp?k=7 ]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] PHP 4.04 pl1 + Winnt SP6a and SQLServer2000

2001-05-21 Thread Ravi Motha

I currently have   the specified set- up and having problems connecting
to our instance of the database on the MS SQL Server 2000, I was
wondering if anyone out there has a similar set-up knows if there are
any specific steps I need to take to make the server work.

I can currently make a connection to any of the following types of
database
mySQL, postgres and SQL server 7...

The only reason I can think  of .is we need a specific driver or dll for
2000

Can anyone shed some light???

Ravi




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] connecting to database..?

2001-05-21 Thread rice

Thank you very much for your help!!! It works now!!!

There are two methods to fix the error mentioned by Derick.

1. Supply the socket path to mysql_connect() furnction.
e.g. $link = mysql_connect(localhost:3306:/var/lib/mysql/mysql.sock,
user, password);
where 3306 is default port and /var/lib/mysql/mysql.sock is socket path
supplied by me.
If the socket path is omitted, it is /tmp/mysql.sock by default. But there
is no such file in /tmp, so I use slocate command and find it in
/var/lib/mysql. This method is not recommended because you have to submit
the path every time.

2. Set mysql.default_socket = /var/lib/mysql/mysql.sock in php.ini and
restart Apache. But make sure the path of mysql.sock first. (Thanks Jesse
^_^)

Jesse Scott [EMAIL PROTECTED] ?
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Make sure that your php.ini and your my.cnf both agree on where the socket
 file is going to be put.  And if you make any changes, be sure to restart
 both PHP/Apache and MySQL.  You might also check the logs and make sure
 that MySQL is actually launching, it might be encountering an error and
 quietly dieing as soon as you launch it.  I'm successfully running Apache
 1.3.19, PHP 4.0.5, and MySQL 3.23.38.  When I upgraded from MySQL 3.23.32
I
 had that same warning come up, all it took was restarting mysqld and the
 warning went away.

 Hope you can get it figured out...

 -Jesse

 At 12:48 AM 5/21/01 +0800, rice wrote:
 I have the same problem as you when using apache1.3.19, php4.0.5 and
 mysql3.23.38 and get the same warning message. I've spent many time to
 compile
 the system again but failed. So I forgive to use the newest version and
use
 apache1.3.17, php4.0.4 and mysql3.23.38. It works now!
 
 Hope someone can help!
 
 Derick Dorner [EMAIL PROTECTED] ?
 00cd01c0e13e$a10cda90$9865fea9@moax01">news:00cd01c0e13e$a10cda90$9865fea9@moax01...
 I receive the error when trying to connect to MySQL database:
 
 Warning: MySQL Connection Failed: Can't connect to local MySQL server
 through socket '/tmp/mysql.sock' (111) in /usr/home/cupid/www/sql.php on
 line 13
 
 The code I use to connect is:
 $link = mysql_connect (localhost, username, password);  file://with
 the username and pw filled in obviously.
 
 Is this some type of config problem between MySQL and PHP or what? Any
help
 is appreciated.
 It ia a LAMP system BTW.



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] image upload - mime types??

2001-05-21 Thread bill

Hi Matthew,

I ignore both the mime-type and the extension,  and assume mistakes (sooner or
later) by the user.

Running getimagesize() on the file will show what image type it is by actually
looking at the file.  If it isn't one of those types, I delete it.  If it is a
correct type, I force the correct extension on it to prevent errors.

kind regards,

bill

matthew knight wrote:

 i've created an application where users can upload images through the form
 upload, and to ensure that they are sending me an image, i take a look at
 the type of the file (ie. $uploadedfile_type), which usually returns
 something like

 image/x-png

 however.. not always.. so secondly, i check for a file extension using
 $uploadedfile_name, but if they've loaded it from a mac.. i can't be sure
 there will be a filename.. so, those things both failing in some cases.. is
 there any other way of checking the filetype of a file?

 i'm concerned that some could upload malicious content and run it (although
 the execute flag is turned off, AND the filename is difficult to get.. ) and
 would like to reduce the possiblity..

 any suggestions?

 --
 matthew knight - online developer
 [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Data errors in entering

2001-05-21 Thread Miles Thompson

You're going to hate this ... add the $ so that you have $month, $year.
Miles
PS I've done it too - you red it so many times you no longer see anything.

At 03:10 PM 5/21/01 +0100, Shane Barry wrote:
I seem to be having a problem with a php script I use to enter data into a
sql database from a php frontend.  The data are ints (months and years as
a number).

The Database is :

+--+-+--+-+-+---+
| Field| Type| Null | Key | Default | Extra |
+--+-+--+-+-+---+
| day  | text| YES  | | NULL|   |
| daydate  | int(11) | YES  | | NULL|   |
| month| int(11) | YES  | | NULL|   |
| year | int(11) | YES  | | NULL|   |
| time | text| YES  | | NULL|   |
| place| text| YES  | | NULL|   |
| numbers  | text| YES  | | NULL|   |
| details  | text| YES  | | NULL|   |
| reportby | text| YES  | | NULL|   |
+--+-+--+-+-+---+

The html file takes the data in as (Using the post method):

PSTRONGDATE:/STRONGBR
INPUT TYPE=int NAME=daydate SIZE=10 MAXLENGTH=10/p

PSTRONGMONTH:/STRONGBR
INPUT TYPE=int NAME=month SIZE=10 MAXLENGTH=10/p

PSTRONGYEAR:/STRONGBR
INPUT TYPE=int NAME=year SIZE=10 MAXLENGTH=10/p

and the php script interacts with the data as:

$sql = INSERT INTO $table_name
 (day, daydate, month, year, time, place, numbers, details,
reportby)
 VALUES
 (\$day\, \$daydate\, \month\, \year\, \$time\,
\$place\,\$numbers\,\$details\, \$reportby\)
 ;

The Sections affected are month and year all the others including daydate
which is exactly the same are working.  Can someone please point out the
error to me?

Shane

--
Webmaster
Dublin  Wicklow Mountain Rescue Team
www.dwmrt.ie

Irish Mountain Rescue Association
imra.ie.eu.org

ICQ # 103528846

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Data errors in entering

2001-05-21 Thread biorn

The problem is in your insert statement.  You forgot the $ on your month and
year variable values.

Your statement should read:

$sql = INSERT INTO $table_name (day,daydate,month,year,time,place,numbers,
details,reportby) VALUES
('$day',$daydate,$month,$year,'$time','$place','$numbers','$details','$reportby');
^  ^

Another note, you do not need the quotes around your integer values for
$daydate, $month, $year.
You also should use single quotes on the other values rather than double quotes.


Shane Barry [EMAIL PROTECTED] said:

 I seem to be having a problem with a php script I use to enter data into a
 sql database from a php frontend.  The data are ints (months and years as
 a number).

 The Database is :

 +--+-+--+-+-+---+
 | Field| Type| Null | Key | Default | Extra |
 +--+-+--+-+-+---+
 | day  | text| YES  | | NULL|   |
 | daydate  | int(11) | YES  | | NULL|   |
 | month| int(11) | YES  | | NULL|   |
 | year | int(11) | YES  | | NULL|   |
 | time | text| YES  | | NULL|   |
 | place| text| YES  | | NULL|   |
 | numbers  | text| YES  | | NULL|   |
 | details  | text| YES  | | NULL|   |
 | reportby | text| YES  | | NULL|   |
 +--+-+--+-+-+---+

 The html file takes the data in as (Using the post method):

 PSTRONGDATE:/STRONGBR
 INPUT TYPE=int NAME=daydate SIZE=10 MAXLENGTH=10/p

 PSTRONGMONTH:/STRONGBR
 INPUT TYPE=int NAME=month SIZE=10 MAXLENGTH=10/p

 PSTRONGYEAR:/STRONGBR
 INPUT TYPE=int NAME=year SIZE=10 MAXLENGTH=10/p

 and the php script interacts with the data as:

 $sql = INSERT INTO $table_name
   (day, daydate, month, year, time, place, numbers, details,
 reportby)
   VALUES
   ($day, $daydate, month, year, $time,
 $place,$numbers,$details, $reportby)
   ;

 The Sections affected are month and year all the others including daydate
 which is exactly the same are working.  Can someone please point out the
 error to me?

 Shane

 --
 Webmaster
 Dublin  Wicklow Mountain Rescue Team
 www.dwmrt.ie

 Irish Mountain Rescue Association
 imra.ie.eu.org

 ICQ # 103528846

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] question about

2001-05-21 Thread Michael Cheung

Hi;
I use the following lines to get a result from database;
But It give me result 0, it is incorrect;

$sql=Select count(*) From member where email=:email;
$sth=OCIParse($dbh,$sql);
OCIBindByName($sth,email,$email,64);
OCIExecute($sth);
OCIFetchInto($sth,$data);

but when I directly use the $email in sql, without OCIBindByName, like the
following, it give me result 5, it is correct.

$sql=Select count(*) From member where email='$email';
$sth=OCIParse($dbh,$sql);
OCIExecute($sth);
OCIFetchInto($sth,$data);

email is char(64) in database.

where is the problem?

Thanks in advance.

Regards;
Michael


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] question about OCIBindByName(add some comment)

2001-05-21 Thread Michael Cheung

Hi;
Linux 2.2.18 + oracle 8.1.7i + php-4.0.5 + oci8 interface.

I use the following lines to get a result from database;
But It give me result 0, it is incorrect;

$sql=Select count(*) From member where email=:email;
$sth=OCIParse($dbh,$sql);
OCIBindByName($sth,email,$email,64);
// with or without ':' is same, and use reference or not is also same here.
OCIExecute($sth);
OCIFetchInto($sth,$data);

but when I directly use the $email in sql, without OCIBindByName, like the
following, it give me result 5, it is correct.

$sql=Select count(*) From member where email='$email';
$sth=OCIParse($dbh,$sql);
OCIExecute($sth);
OCIFetchInto($sth,$data);

email is char(64) in database.

where is the problem?

Thanks in advance.

Regards;
Michael


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] question about OCIBindByName(add some comment)

2001-05-21 Thread Thies C. Arntzen

On Mon, May 21, 2001 at 11:35:36PM +0900, Michael Cheung wrote:
 Hi;
   Linux 2.2.18 + oracle 8.1.7i + php-4.0.5 + oci8 interface.
   
   I use the following lines to get a result from database;
 But It give me result 0, it is incorrect;
 
 $sql=Select count(*) From member where email=:email;
 $sth=OCIParse($dbh,$sql);
 OCIBindByName($sth,email,$email,64);
 // with or without ':' is same, and use reference or not is also same here.
 OCIExecute($sth);
 OCIFetchInto($sth,$data);

have you set $email in your script (before OCIExecute)?

tc

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Data errors in entering

2001-05-21 Thread Rubanowicz, Lisa

I am only a beginner but I always use single quotes, I am using mySQL.
Such as:
$sql = INSERT INTO $table_name 
(day, daydate, month, year, time, place, numbers, details, reportby)
VALUES ('$day', '$daydate', 'month', 'year', '$time',
'$place','$numbers','$details', '$reportby');
All the Best
Lisa
-Original Message-
From: Shane Barry [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 21, 2001 3:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Data errors in entering


I seem to be having a problem with a php script I use to enter data into a
sql database from a php frontend.  The data are ints (months and years as
a number).

The Database is :

+--+-+--+-+-+---+
| Field| Type| Null | Key | Default | Extra |
+--+-+--+-+-+---+
| day  | text| YES  | | NULL|   |
| daydate  | int(11) | YES  | | NULL|   |
| month| int(11) | YES  | | NULL|   |
| year | int(11) | YES  | | NULL|   |
| time | text| YES  | | NULL|   |
| place| text| YES  | | NULL|   |
| numbers  | text| YES  | | NULL|   |
| details  | text| YES  | | NULL|   |
| reportby | text| YES  | | NULL|   |
+--+-+--+-+-+---+

The html file takes the data in as (Using the post method):

PSTRONGDATE:/STRONGBR
INPUT TYPE=int NAME=daydate SIZE=10 MAXLENGTH=10/p

PSTRONGMONTH:/STRONGBR
INPUT TYPE=int NAME=month SIZE=10 MAXLENGTH=10/p

PSTRONGYEAR:/STRONGBR
INPUT TYPE=int NAME=year SIZE=10 MAXLENGTH=10/p

and the php script interacts with the data as:

$sql = INSERT INTO $table_name 
(day, daydate, month, year, time, place, numbers, details,
reportby)
VALUES 
(\$day\, \$daydate\, \month\, \year\, \$time\,
\$place\,\$numbers\,\$details\, \$reportby\)
;

The Sections affected are month and year all the others including daydate
which is exactly the same are working.  Can someone please point out the
error to me? 

Shane

-- 
Webmaster 
Dublin  Wicklow Mountain Rescue Team
www.dwmrt.ie

Irish Mountain Rescue Association
imra.ie.eu.org

ICQ # 103528846

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



Re: [PHP-DB] Merge two arrays into associative arrays?

2001-05-21 Thread Lars B. Jensen, LJ Webnologics

Have followed this group for a while, it is my turn to try send an response.

Would this angle with a for loop not be better than a foreach angle ?
?php
 $a = array(1,2,3,4,5);
 $b = array(a,b,c,d,e);
 $c = array();

 $arraysize = sizeof($a);
 for ($i=0;$i$arraysize;$i++) {
  $c[$a[$i]] = $b[$i];
 }
?

/ Lars
www.ljweb.com

- Original Message -
From: Jonathan Hilgeman [EMAIL PROTECTED]
To: 'Shahmat Dahlan' [EMAIL PROTECTED]
Cc: PHP-DB (E-mail) [EMAIL PROTECTED]
Sent: Monday, May 21, 2001 6:10 PM
Subject: RE: [PHP-DB] Merge two arrays into associative arrays?


 try:

 $a=array(1,2,3,4,5);
 $b=array(a,b,c,d,e);
 $c = array();

 foreach($a as $a_key = $a_value)
 {
 $c[$a_value] = $b[$a_key];
 }

 that should give you what you want.

 Jonathan

 -Original Message-
 From: Shahmat Dahlan [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 21, 2001 12:23 AM
 To: PHP-DB
 Subject: [PHP-DB] Merge two arrays into associative arrays?


 Is there anywhere possible for me to merge two arrays into associative
 arrays?

 e.g.
 $a=array(1,2,3,4,5);
 $b=array(a,b,c,d,e)

 into

 $c=array(1 = a, 2 = b, etc... )

 Thanks in advance..



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Locking tables of MySQL

2001-05-21 Thread Gladis

I found that the PHP scripts for locking tables of MySQL do not work
properly. Could anyone tell me how to achieve the locking mechanism?

Thanks a lot!



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] expiration

2001-05-21 Thread Pankaj Ahuja

Hi all

I have a page on which I have a menu. When I click on any one of the options
and come back, the page expires instantaneously.  What could be the reason ?

I am using sessions

Thanks in advance
Pankaj Ahuja





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] image upload - mime types??

2001-05-21 Thread Gary Pullis

Don't trust file extensions. Use getimagesize() to examine the file.

$imginfo = getimagesize($uploadfile);
switch ($imginfo[2]) {
  case 1: // gif
  case 2: // jpg
  case 3: // png
  case 4: // swf
  default: // not an image
}


 -Original Message-
 From: Jens Nedal [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 21, 2001 3:26 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] image upload - mime types??
 
 
 Hy,
 
 First of all i would not allow upload of any graphical files without
 extensions, like it is allowed on a Mac. The reason for this is that
 graphical fiels without a certain extension like *.gif *.jpg 
 *.png will
 mostly not be recognized by any browser as some graphic.
 
 A suggestion would be only to allow files with extensions, 
 and there only a
 limited amount, so everythign else generates an error.
 
 on 19.05.2001 1:30 Uhr, matthew knight at [EMAIL PROTECTED] wrote:
 
  
  i've created an application where users can upload images 
 through the form
  upload, and to ensure that they are sending me an image, i 
 take a look at
  the type of the file (ie. $uploadedfile_type), which usually returns
  something like
  
  image/x-png
  
  however.. not always.. so secondly, i check for a file 
 extension using
  $uploadedfile_name, but if they've loaded it from a mac.. i 
 can't be sure
  there will be a filename.. so, those things both failing in 
 some cases.. is
  there any other way of checking the filetype of a file?
  
  i'm concerned that some could upload malicious content and 
 run it (although
  the execute flag is turned off, AND the filename is 
 difficult to get.. ) and
  would like to reduce the possiblity..
  
  any suggestions?
  
  
  --
  matthew knight - online developer
  [EMAIL PROTECTED]
  
  
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 



[PHP-DB] Anchor tags for search results

2001-05-21 Thread Brian Tegtmeier

What's up? I am running into a slight problem with a search funtion and I
was wondering if any of you PHP gurus can help me out.

My current situation is where I have a Search script via this DGS Search at
http://www.hotscripts.com/Detailed/5477.html and when I do a search for a
specific item, it shows the item as it should in the results page and I can
click on it bringing me to the page with that word on it.

The thing I am running into is when I do a direct search for an exact item
and click the Search result in the page it brings me to the top of the page
wheras the item is contained in the middle of the page.

Is there a way if I have anchor tags setup for each item that when I click
the results for a Search the link directs me to that anchor tag?

btw.. the site search test is at http://64.77.185.160/main.html and test it
out by typing in words like LS-4000. I can send the source on request. thx!


__
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] pulling images from a database

2001-05-21 Thread Trent Reimer

I'm trying to find an efficient way to pull images from a database. What I'm
saying is that the actual image file itself is being stored as a Binary
Large OBject in the database (MySQL) and that I want to use it on a web
document.

The only way I've been able to do it so far is to call an external script
such as:

img src=grab_image.php?image=picture1.jpg

where grab_image.php goes and connects to the database and spits out the
header information and then the binary data for the applicable picture.

Is there a more efficient way to do this? Is there any way to embed the
image information directly in the document without having to call an
external script for each image?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] newbie: why doesn't this work?

2001-05-21 Thread Trent Reimer

just at a quick glance I see a couple things I would try changing

at the end of your for loop you have a closing brace but I don't see an
opening brace anywhere, that should throw things. Also in the conditions of
your for loop you have ++$count which I haven't really seen before.
Would the standard $count++ be better?




twopeak [EMAIL PROTECTED] wrote in message
9ebrhn$a39$[EMAIL PROTECTED]">news:9ebrhn$a39$[EMAIL PROTECTED]...
 this works, but it doesn't like to retrieve the data, the intention of
this
 is that it just returns all the links...
 but it loves to return errors...

 ===
 ?php
 $link = mysql_connect($path,$log,$pass) OR DIE(can't connect);
 mysql_select_db(blackstars, $link) or die( can't select db);

 $query = SELECT * FROM persoon;
 $result = mysql_query($query);
 for ($count = 1; $row = mysql_fetch_object ($result) ; ++$count)


  echo $count : $row-voornaam , $row-achternaam br;
  }
 ?
 ===





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re[2]: [PHP-DB] question about OCIBindByName(add some comment)

2001-05-21 Thread Michael Cheung


On Mon, 21 May 2001 16:39:05 +0200
Thies C. Arntzen [EMAIL PROTECTED] wrote:

 On Mon, May 21, 2001 at 11:35:36PM +0900, Michael Cheung wrote:
  Hi;
  Linux 2.2.18 + oracle 8.1.7i + php-4.0.5 + oci8 interface.
  
  I use the following lines to get a result from database;
  But It give me result 0, it is incorrect;
  
  $sql=Select count(*) From member where email=:email;
  $sth=OCIParse($dbh,$sql);
  OCIBindByName($sth,email,$email,64);
  // with or without ':' is same, and use reference or not is also same here.
  OCIExecute($sth);
  OCIFetchInto($sth,$data);
 
 have you set $email in your script (before OCIExecute)?

I have set the $email before OCIParse().

Is there any problem about the varchar2 data type in bind operation?

Regards;
Michael


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] [PHP-DB]: Error Configuring PHP w/ FreeTDS

2001-05-21 Thread Lester June Cabrera

Hi,

I wanted to configure PHP w/ Sybase support in our Solaris box. So, I have 
installed FreeTDS.

When I ran the configure command in PHP, I got the following error messages:

checking whether the C++ compiler (c++   -R/usr/ucblib -L/usr/ucblib 
-R/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3 
-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3 -R/usr/local/mysql/lib 
-L/usr/local/mysql/lib -R/usr/local/freetds/lib -L/usr/local/freetds/lib) 
works... no

configure: error: installation or configuration problem: C++ compiler 
cannot create executables.


Does it have something to do with our GCC compiler? I issued pkginfo | 
grep gcc, and I got the following:
application SMCgcc gcc

Did I install the correct gcc compiler?


Btw, I have configured Perl with DBD-Sybase using FreeTDS also in the same 
machine. And I can connect to the database successfully. Now, I want to do 
the same with PHP since most of our apps are written in PHP.

Thanks a lot,

Lester


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]