[PHP-DB] Re: $user=$email

2003-01-16 Thread Foong
if you require the file before calling mysql_connect(),
the $user is set to $email.

this means you are connecting to mysql using the username set in $email. you
get access denied error because you use the wrong username or password to
connect to mysql.

before calling mysql_connect try echo the $user and $pass see if they are
the correct.

hope this help

Foong





Addison Ellis [EMAIL PROTECTED] wrote in message
news:a05010410ba4b2c6694e9@[65.80.190.170]...
 hello,
 i am trying to do the following:
 case login:
$connection = mysql_connect($host, $user,$password)   //15
 or die (Couldn't connect to server.);
$db = mysql_select_db($database, $connection)
or die (Couldn't select database.);

$sql = SELECT email FROM accounts
WHERE email='$email';
$result = mysql_query($sql)
or die(Couldn't execute query.);
$num = mysql_num_rows($result);
if ($num == 1)  // login name was found   //25
{
   $sql = SELECT email FROM accounts
   WHERE email='$email'
   AND password=password('$password');
   $result2 = mysql_query($sql)
 or die(Couldn't execute query.);
   $num2 = mysql_num_rows($result2);
   if ($num2  0)  // password is correct
   {
  $auth=yes;
 //35
 $user=$email;
 $today = date(Y-m-d h:m:s);
 $sql = INSERT INTO login (loginName,loginTime)
 VALUES ('$email','$today');
 mysql_query($sql) or die(Can't execute query.);
 header(Location: cat_ad.php);
   }
   else// password is not correct
   {

 in my config.php file which is a required file i have
 $user=$email, etc.
 i continually receive an access denied/couldn't connect to server.
 i'm sure i'm leaving something out...
 thank you for your time. addison
 --
 Addison Ellis
 small independent publishing co.
 114 B 29th Avenue North
 Nashville, TN 37203
 (615) 321-1791
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 subsidiaries of small independent publishing co.
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]



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




[PHP-DB] Send mail with a file

2003-01-16 Thread Bruno Pereira
How can i insert a file on a mail, with the command mail()? It is
possible?

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
Sent: quarta-feira, 15 de Janeiro de 2003 14:48
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Concatenate two strings


How can i join two strings.
My code is something like:
$valor1=bruno;
$valor2=Pereira;
$valor=$valor1 +   + $valor2

Can someone help me. Thanks.

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]


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




[PHP-DB] Fatal error message

2003-01-16 Thread Jon Miller
I get the following when  loading a php file created by Dreamweaver MX using MySQL 
database and php.

Fatal error: Failed opening required 'Connections/addrbk.php' 
(include_path='.:/php/includes:/usr/share/pear') in /var/www/html/addrbk/frmAddr.php 
on line 1

For the include_path I've used include_path = .:/php/includes and 
still get the same error.  I'm not too sure what this path is supposed to
be pointing to.  Can someone enlighten me on this?

setup info:
MySQL is on a Linux 7.3 server
PHP is on the same server

Dreamweaver MX is on Windows 2000.
Everything work fine as for as creating the form, just when try to run it I get the 
message.  I should mentioned I just copied the file created to the linux location 
where the files are supposed to be.

Thanks



Jon L. Miller, MCNE, CNS
Director/Sr Systems Consultant
MMT Networks Pty Ltd
http://www.mmtnetworks.com.au

I don't know the key to success, but the key to failure
 is trying to please everybody. -Bill Cosby





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




[PHP-DB] question about OCIFetchInto

2003-01-16 Thread ys_zhu
hi

XP+IIS5.1+PHP4.3+ORACLE9.2(client)

?php
if (empty($offset) || $offset  0)

$offset=0;
}
$limit = 3;
$conn = OCILogon(userid, userpasswd, SID);
if (!$conn)

echo h1ERROR - Could not connect to Oracle/h1;
exit;
}
$sql = Select count(*) from t1;
$stmt = OCIParse($conn, $sql);
if(!$stmt)

echo h1ERROR - Could not parse SQL statement./h1;
exit;
}
OCIExecute($stmt);
OCIFetchInto($stmt, $total_rows);
if ( !$total_rows[0] )

echo h1Error - no rows returned!/h1;
exit;
}
echo There are $total_rows[0] results.br\n;
echo Now showing results $begin to $end.brbr\n;
OCIFreeStatement($stmt);
?

ERROR REPORT as follow:

Warning: OCIFetchInto: ORA-01002:  in C:\MyPHP\test.php on line 18
Error - no rows returned!


thanks!



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




[PHP-DB] no-cache

2003-01-16 Thread Monnerie Christophe
Hi,

My HTML pages created with php scripts contain images and Flash animation.
I would like never find in the cache browser these components .
I have put at the the begining of my pages this script!

?php
  header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); // Date du passé
  header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT); // toujours modifié
  header(Cache-Control: no-cache, must-revalidate);   // HTTP/1.1
  header(Pragma: no-cache);   // HTTP/1.0
?
html
...

but I still found  in my browser cache Flash animation and images.


Solution?

Thanks!

C Monnerie..




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




RE: [PHP-DB] Fatal error message

2003-01-16 Thread Rich Gray
Jon

Based on your include path does the script exist in any of these locations
on your server?

= /var/www/html/addrbk/Connections/addrbk.php or
= /php/includes/Connections/addrbk.php
= /usr/share/pear/Connections/addrbk.php

If not then that's your problem, else you need to start looking at
file/directory permissions...

Your include_path setting in php.ini tells php where to look for scripts if
a non absolute path is specified on a include/require statement. In your
case it will first look in the including script's directory, then the
directory /php/includes then the directory /usr/share/pear...

Rich
-Original Message-
From: Jon Miller [mailto:[EMAIL PROTECTED]]
Sent: 16 January 2003 10:03
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Fatal error message


I get the following when  loading a php file created by Dreamweaver MX using
MySQL database and php.

Fatal error: Failed opening required 'Connections/addrbk.php'
(include_path='.:/php/includes:/usr/share/pear') in
/var/www/html/addrbk/frmAddr.php on line 1

For the include_path I've used include_path = .:/php/includes and
still get the same error.  I'm not too sure what this path is supposed to
be pointing to.  Can someone enlighten me on this?

setup info:
MySQL is on a Linux 7.3 server
PHP is on the same server

Dreamweaver MX is on Windows 2000.
Everything work fine as for as creating the form, just when try to run it I
get the message.  I should mentioned I just copied the file created to the
linux location where the files are supposed to be.

Thanks



Jon L. Miller, MCNE, CNS
Director/Sr Systems Consultant
MMT Networks Pty Ltd
http://www.mmtnetworks.com.au

I don't know the key to success, but the key to failure
 is trying to please everybody. -Bill Cosby





--
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] Concatenate two strings

2003-01-16 Thread Fred Wright
On mine its just
$valor1$valor2

Mark Snijders [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
om...
 with a dot

 $valor=$valor1 .   . $valor2

 :-)





 -Original Message-
 From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
 Sent: woensdag 15 januari 2003 15:48
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP-DB] Concatenate two strings


 How can i join two strings.
 My code is something like:
 $valor1=bruno;
 $valor2=Pereira;
 $valor=$valor1 +   + $valor2

 Can someone help me. Thanks.

 Cumprimentos

 Bruno Pereira
 [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] Concatenate two strings

2003-01-16 Thread Richard Allinson
Mine is as follows

$valor = $valor1.$valor2;
or
$valor = $valor1$valor2;

-Original Message-
From: Fred Wright [mailto:[EMAIL PROTECTED]] 
Sent: 16 January 2003 11:54
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Concatenate two strings


On mine its just
$valor1$valor2

Mark Snijders [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
it.c
om...
 with a dot

 $valor=$valor1 .   . $valor2

 :-)





 -Original Message-
 From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
 Sent: woensdag 15 januari 2003 15:48
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP-DB] Concatenate two strings


 How can i join two strings.
 My code is something like:
 $valor1=bruno;
 $valor2=Pereira;
 $valor=$valor1 +   + $valor2

 Can someone help me. Thanks.

 Cumprimentos

 Bruno Pereira
 [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


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




RE: [PHP-DB] Send mail with a file

2003-01-16 Thread NIPP, SCOTT V (SBCSI)
Under Unix I don't know that this is possible, but hopefully someone
else will know of a way.  I would love to be able to e-mail some Excel files
that I generate with a Perl cron job, but there does not appear to be any
practical way to do this in Unix.

-Original Message-
From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:47 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Send mail with a file


How can i insert a file on a mail, with the command mail()? It is
possible?

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
Sent: quarta-feira, 15 de Janeiro de 2003 14:48
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Concatenate two strings


How can i join two strings.
My code is something like:
$valor1=bruno;
$valor2=Pereira;
$valor=$valor1 +   + $valor2

Can someone help me. Thanks.

Cumprimentos

Bruno Pereira
[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] Send mail with a file

2003-01-16 Thread Adam Voigt




Unix has nothing to do with it, the mail command in PHP on unix is the same mail command

in PHP on windows. If you want to use attachments you need to use a class like phpMimeEmail

or whatever it's called go to phpclasses.org, it's on there somewhere.



On Thu, 2003-01-16 at 09:33, NIPP, SCOTT V (SBCSI) wrote:

	Under Unix I don't know that this is possible, but hopefully someone

else will know of a way.  I would love to be able to e-mail some Excel files

that I generate with a Perl cron job, but there does not appear to be any

practical way to do this in Unix.



-Original Message-

From: Bruno Pereira [mailto:[EMAIL PROTECTED]]

Sent: Thursday, January 16, 2003 3:47 AM

To: [EMAIL PROTECTED]; [EMAIL PROTECTED]

Subject: [PHP-DB] Send mail with a file





How can i insert a file on a mail, with the command mail()? It is

possible?



Cumprimentos



Bruno Pereira

[EMAIL PROTECTED]



-Original Message-

From: Bruno Pereira [mailto:[EMAIL PROTECTED]]

Sent: quarta-feira, 15 de Janeiro de 2003 14:48

Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]

Subject: Concatenate two strings





How can i join two strings.

My code is something like:

$valor1=bruno;

$valor2=Pereira;

$valor=$valor1 +   + $valor2



Can someone help me. Thanks.



Cumprimentos



Bruno Pereira

[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






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] Duplicate keys...

2003-01-16 Thread NIPP, SCOTT V (SBCSI)
Thanks once again.  I finally figured this out late yesterday.  I
have no idea as to why whoever wrote this calendar to begin with did it this
way.  On suggestion I have for anyone looking at a calendar system to use or
modify is to absolutely NOT use phpCommunityCalendar.  This is a very poorly
coded piece of software, and if I as a relative PHP newbie know this, it is
really bad.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 10:07 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Duplicate keys...


   OK, I cannot figure out why I keep getting errors about
Duplicate
 entry for key 1.  Someone please come to my rescue here as this is
truly
 kicking my but.

You have a key or unique column in your table that you're trying to
insert a duplicate value into.
 
 if ($dateDiff == 2) {
   mysql($DBName,INSERT INTO phpCalendar_Details VALUES (
   '$said','Comp day for weekend
 On-Call','','','','','','','','','',2,'$CalendarDetailsID')) or
 die(mysql_error());
 
   mysql($DBName,UPDATE Balances SET CompEarned=CompEarned+8,
 CompTaken=CompTaken+8 WHERE said='$said') or die(mysql_error());
   $result = mysql($DBName,SELECT LAST_INSERT_ID() FROM
 phpCalendar_Details) or die(mysql_error());
   while ($row = mysql_fetch_row($result)) {
   $CalendarDetailsID = $row[0];
   }
   mysql($DBName,INSERT INTO Log VALUES(
   '$entryid','$said','Comp',DATE_ADD('$StopDate',INTERVAL 1
 DAY),'Y','','Awarded for weekend On-Call','8','$CalendarDetailsID'))
or
 die(mysql_error());
 
   mysql($DBName,INSERT INTO phpCalendar_Daily VALUES(
   DATE_ADD('$StopDate',INTERVAL 1
DAY),'',1,2,'$CalendarDetailsID'))
 or die(mysql_error());
 }
 
 if ($dateDiff  0) {
 commonHeader($glbl_SiteTitle);
 echo centerfont color=\red\bYour END DATE COMES BEFORE YOUR
START
 DATE. Please complete the form below./b/font/centerp\n\n;
 
 } elseif ($Stop != 1) {
 
 if ($CalendarDetailsID) {
   $CalendarDetailsID = $CalendarDetailsID + 1;
 } else {
   $result = mysql($DBName,SELECT LAST_INSERT_ID() FROM
 phpCalendar_Details) or die(mysql_error());
   while ($row = mysql_fetch_row($result)) {
   $CalendarDetailsID = $row[0];
   }
 }
 
 mysql($DBName,INSERT INTO phpCalendar_Details VALUES (
 '$said','On-Call for $StartDate to
 $StopDate','','','','','','','','','',1,'$CalendarDetailsID')) or
 die(mysql_error());
 
 mysql($DBName,INSERT INTO phpCalendar_Daily VALUES(
 '$StartDate','$StopDate','1','1','$CalendarDetailsID')) or
 die(mysql_error());
 
   This is the only place in the script that is attempting to enter
 data into the CalendarDetailsID field.  This is the auto_increment
field
 that is having problems, I think.  The other strange part of this is
that
 thedata in the auto_increment field has two separate ranges (10 - 40
with
 gaps, and 70 - 78 with gaps).  I have been doing a lot of adding and
 removing of data to test during development, but I thought an
 auto_increment
 field would still track and deal with this correctly.

If you're trying to insert a number into an auto_increment field that's
already there, you'll get this error. You should always insert a NULL
value into an auto_increment column so MySQL will handle giving it the
number itself.

Also, don't worry about the gaps. They are irrelevant. If the gaps
matter to your program, then you are coding incorrectly. The
auto_increment column is there _only_ to provide a unique identifier for
each row and nothing else. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


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




RE: [PHP-DB] Send mail with a file

2003-01-16 Thread Edward Peloke
I was referred to this class and it works great.  I had a page that
generated a leave form (based on the users info) and e-mailed the form as an
attachement to the users supervisor.

http://phpmailer.sourceforge.net/

Eddie

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 9:34 AM
To: 'Bruno Pereira'; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Send mail with a file


Under Unix I don't know that this is possible, but hopefully someone
else will know of a way.  I would love to be able to e-mail some Excel files
that I generate with a Perl cron job, but there does not appear to be any
practical way to do this in Unix.

-Original Message-
From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:47 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Send mail with a file


How can i insert a file on a mail, with the command mail()? It is
possible?

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
Sent: quarta-feira, 15 de Janeiro de 2003 14:48
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Concatenate two strings


How can i join two strings.
My code is something like:
$valor1=bruno;
$valor2=Pereira;
$valor=$valor1 +   + $valor2

Can someone help me. Thanks.

Cumprimentos

Bruno Pereira
[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


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




Re: [PHP-DB] HTML + PHP

2003-01-16 Thread Sabina Alejandr Schneider
Thank you very much for the idea!! I've controlled 
that before but it seemed to be all right... I'll try 
again!! Could it be that th body and one of the tables is 
in a function and the rest is in the main stript?
Thank you very much for your time!!!

On Thu, 16 Jan 2003 15:10:31 +0800
 Jason Wong [EMAIL PROTECTED] wrote:
On Thursday 16 January 2003 11:43, Sabina A. Schneider 
wrote:
Hello everybody!!! Here am I again with problems... 
:-( This time I
programmed severan php scripts embebed with HTML, but 
the curiosity comes
when I try to see the scripts in a browser. In Opera 
it's ok, but in
Mozilla and Internet Explorer it appears one table on 
the other, everything
mixed up. I have most of the scripts structured as 
follows: a table that
contains the name of the enterprise and the site's area 
and another table
(theorically beneath the first one) withe the content of 
a table of my
database. Both of them appear the second one under the 
first one, but mixed
up. I used functions to build the code... What can it 
be? Was I clear with
the problem? Otherwise I can send a screenshoot with the 
problem, but I
don't think it's allowed to attach files in this list.

Most likely your HTML is broken -- unclosed/unbalanced 
tags (/td, /tr, 
/table).

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications 
Development *


/*
When the going gets tough, the tough go grab a beer.
*/


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








_

Tutopia - Acceso a Internet rápido, fácil y a los mejores precios.
http://www.tutopia.com

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




[PHP-DB] Set element closeness measure

2003-01-16 Thread typea
Apologies if you saw this on php-general already...

Give about 1 MILLION sets of 1 to ~20 integers such as:

(15, 42, 57, 314, 1024)

I need to be able to compare any two sets and determine if any of their
elements are within, say, 20 of each other.

Example:

(10, 100, 1000) CLOSETO (50, 150, 1050) == FALSE
(10, 100, 1000) CLOSETO (15, 150, 1050) == TRUE   [abs(15 - 10)  20]
(10, 100, 1000) CLOSETO (115, 1050) == TRUE   [abs(115 - 110)  20]

The sets are actually ordered sets, monotonicly increasing, if that helps.

Each set has another 36 bytes of associated data, of which 32 (two int4)
can be composed for a unique ID.  Or I could just assign an ID to each
one.

I could, of course, create a table of about 10 MILLION rows and be
searching through that...  But my gut says there should be an easier way.

I've look at the ~/contrib/array and even considered converting each set
to a built-in path datatype -- But neither of those seems to provide a
any_vertex_near function for comparing two objects.

Any ideas?...




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




[PHP-DB] Path string problem

2003-01-16 Thread Robert Wagner
I know (NOW!) that I shouldn't have installed PHP or Apache in a
directory where there is a space in the path string (Like H:\program
files\,mydir\.) But I really don't want to have to reinstall everthing
to fix the problem.

I'm running PHP with Apache as a local host on my Win XP system, but I
get into trouble when I try to use include_once in my php script for a
page. The file, myfile.php, I want to include is in the SAME directory
as the script file. Is there a way to specify this in the argument for
include_once?

For testing, I added
If (!file_exists(Somepathname/myfile.php)){
die (File path is wrong!);}
I've tried many variations on Somepathname (with both forward and
backward slashes), but they all fail.

Is there a way out of this mess?

TIA for any help on this.
Robert





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




[PHP-DB] Recursive SQL Expression?

2003-01-16 Thread Alan McFarlane
Hi folks...

I've a small problem working out the best method of reading data from a 
mySQL database with PHP...

The table is a simple self-referential table constructed (loosely) as 
follows:

cat_id  integer  unique
cat_namestring
cat_parent  integer  (points to a cat_id or 0 if no parent).

Now, I need to extract the data in 'tree order', that is each cat 
(catgory) with it's siblings then the next category and so on...

I'm currently forced into using a very nasty bit of code to list each 
category within a particular category - this is fine for a small 
dataset, but a large one results in a rather expensive load on the 
database server.

Anyone got any bright ideas, 'cos I'm stumped.

Assuming the following data:

cat_id   cat_name   cat_parent
1SF 0
2PH 0
3FO 2
4BB 1

the sql statement should return a dataset like:

cat_id   cat_name   cat_parent
2PH 0
4BB 2
1SF 0
3FO 1

Notice that category names are in order.

This produces the tree-like structure


+--PH
|  +--BB
+--SF
   +--FO


Thanks for any help...

--
Alan


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



[PHP-DB] SELECT problem

2003-01-16 Thread Sabina A. Schneider



 Hello PHP 
world!!! i've just finisched installing Apache 1.3.27 with PHP4 and 1.4 in 
Windows 2000. I've installed all off the scripts that function all right in 
Linux Red Hat in Windows 2000, but when it comes to do a simple select to a 
table that does exist and the select is all right there appears a message as if 
the query weren't all right at all:
Warning: mysql_fetch_row(): 
supplied argument is not a valid MySQL result resource in 
g:\apache\apache\htdocs\digimedia\adm_central\index.php on line 
18
 What could it 
be? I really appreciate the great help you have been giving to me these days. 
Thank you very much!!!


Sabina 
Alejandra Schneider[EMAIL PROTECTED]


Fw: [PHP-DB] SELECT problem

2003-01-16 Thread Wee Keat

- Original Message - 
From: Sabina A. Schneider 
To: Wee Keat (VisualDensity] 
Sent: 17 January, 2003 4:38 PM
Subject: Re: [PHP-DB] SELECT problem


Yes!!! Sorry!!! Here it is:

$con=conectar(0,$s_conectado_ctr);


/*Validacion de usuario*/

$sql=SELECT password FROM usuario_sistema WHERE usuario='$f_usuario';

$result_usuario_sistema=mysql_query($sql,$con);

$row_usuario_sistema=mysql_fetch_row($result_usuario_sistema);



Conectar(..) is a function like this:

function conectar($validar,$conectado){

if($validar)

$aux=controlar($validar,$conectado);

else

$aux=1;


if($aux){


$host=localhost;

$user=invitado;

$password=CA1245;

$con=;


$con=mysql_connect($host,$user,$password); 

if($con){

mysql_select_db(chat,$con);

}


}

return($con);


}



function controlar($validar,$conectado){

$aux=0;

if(!(($validar AND $conectado)OR($validar==0))){ ?


PI Debe conectarse primero. /IP

FORM ACTION=index.php METHOD=POST

INPUT TYPE=SUBMIT VALUE='Aceptar'

/FORM


? }

else

$aux=1;

return($aux);


}

  - Original Message - 
  From: Wee Keat (VisualDensity] 
  To: Sabina A. Schneider 
  Sent: Friday, January 17, 2003 2:29 AM
  Subject: Re: [PHP-DB] SELECT problem


  may we have a look at your line 18 or the select statement?
- Original Message - 
From: Sabina A. Schneider 
To: [EMAIL PROTECTED] 
Sent: 17 January, 2003 4:25 PM
Subject: [PHP-DB] SELECT problem


Hello PHP world!!! i've just finisched installing Apache 1.3.27 with PHP4 and 
1.4 in Windows 2000. I've installed all off the scripts that function all right in 
Linux Red Hat in Windows 2000, but when it comes to do a simple select to a table that 
does exist and the select is all right there appears a message as if the query weren't 
all right at all:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource 
in g:\apache\apache\htdocs\digimedia\adm_central\index.php on line 18

What could it be? I really appreciate the great help you have been giving to 
me these days. Thank you very much!!!





[PHP-DB] Re: SELECT problem

2003-01-16 Thread Foong
try put the following line right after you call mysql_query():

echo mysql_error();

see what's the error.

Foong

Sabina A. Schneider [EMAIL PROTECTED] wrote in message
001001c2bde8$de3c95d0$489346c8@mansa">news:001001c2bde8$de3c95d0$489346c8@mansa...
Hello PHP world!!! i've just finisched installing Apache 1.3.27 with
PHP4 and 1.4 in Windows 2000. I've installed all off the scripts that
function all right in Linux Red Hat in Windows 2000, but when it comes to do
a simple select to a table that does exist and the select is all right there
appears a message as if the query weren't all right at all:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
resource in g:\apache\apache\htdocs\digimedia\adm_central\index.php on line
18

What could it be? I really appreciate the great help you have been
giving to me these days. Thank you very much!!!

  Sabina Alejandra Schneider
[EMAIL PROTECTED]



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




[PHP-DB] Re: MySQL problem with RedHat 8

2003-01-16 Thread Foong
did you compile php with mysql support?

foong



Daniel Elenius [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi!

 I'm trying to connect to my mysql database using something like

  mysql_connect( 'localhost', 'root', 'thepassword' )
 or die ( 'Unable to connect to server.' );

 But I get the error message:
 ?Fatal error: Call to undefined function: mysql_connect() in
 /home/daniel/public_html/index.php on line 21

 I have:

 [root@p85 /]# rpm -qa |grep sql
 php-mysql-4.2.2-8.0.5
 mysql-3.23.52-3
 mysql-server-3.23.52-3
 mysql-devel-3.23.52-3

 and:

 [root@p85 /]# rpm -q php
 php-4.2.2-8.0.5

 Someone mentioned these two settings in php.ini, which I tried with no
 success:

 register_globals = On
 short_open_tag = On

 phpinfo() says that php was compiled with '--with-mysql=shared,/usr'

 Can someone help me please?

 regards,
 --
 Daniel Elenius [EMAIL PROTECTED]




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




[PHP-DB] Empty date passing to Postgres Stored Procedure from PHP

2003-01-16 Thread Rajesh Fowkar
Hi,

In my application I am passing a date field to the postgres stored
procedure. The problem is when the date field is blank.

My code is like this :

-
THBill Date:/TH
TD
   INPUT TYPE=text NAME=txtBillDate 
  VALUE=? echo $txtBillDate ? SIZE=10 MAXLENGTH=10
/TD
-

I pass the parameters to the stored procedure like this :

-
$sSql = select grn_actions
 ('FREE','$sYearId','$sUserId',1,1,'$hdnGrnType',
 '$txtGrnNumber','$txtGrnDate', '', '', '',
 '$txtSupplierCode','$txtBillNumber','$txtBillDate',
 '$txtChallanNumber','$ParamStr') as tr_id;
-

No if in the above case $txtBillDate is blank, php throws the following
error :

-
PostgreSQL query failed: ERROR: Bad date external representation '' in
/home/rajesh/public_html/inv/php/INVGoodsReceiptNoteFreeAddUpd.php on
line 478
-

My stored procedure declaration is as below :

-
CREATE FUNCTION
grn_actions(varchar,char,char,integer,integer,char,char,date,char,char,char,char,varchar,date,varchar,varchar)
returns char as '
DECLARE
vdocument_type   alias for $1;
cyear_id alias for $2;
cuser_id alias for $3;
iform_id alias for $4;
iaction_id   alias for $5;
cgrn_typealias for $6;
cgrn_number  alias for $7;
dgrn_datealias for $8;
cpurchase_order_year_id  alias for $9;
cpurchase_order_type alias for $10;
cpurchase_order_number   alias for $11;
csupplier_code   alias for $12;
vbill_number alias for $13;
dbill_date   alias for $14;
vchallan_number  alias for $15;
funcparam_stralias for $16;
-

Can anybody tell me how should I pass the date in case it is blank ? The
above field txtBillDate can be blank is certain cases.

Thanks in advance.

Peace

--
Rajesh
:
[ GNU/Linux One Stanza Tip (LOST) ]###

Sub : Linux Commands (#1)LOST #021

No consolidated command list. Do an ls for the following dirs:
/sbin, /usr/sbin   ... for system related commands
/bin, /usr/bin, /usr/local/bin   ... for user commands
/usr/X11R6/bin  ... for X program commands

[EMAIL PROTECTED]
:

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