Re: [PHP-DB] Oracle-PHP (contd.)

2001-06-25 Thread Philippe Saladin

Are you sure you need an environment variable to store that?
if yes, this script should do the trick :
putenv(TNS_ADMIN=/ora1/app/oracle/product/8.1.6/network/admin);
---
$tns = getenv(TNS_ADMIN);
echo $tns;

Regards,
Philippe

Vandana [EMAIL PROTECTED] a écrit dans le message news:
[EMAIL PROTECTED]

 With reference to my previous problem in connecting to the oracle
 database, I found out some additional information.
 I defined the TNS_ADMIN variable in the startup file and added
 this line to my php-script:
 putenv(TNS_ADMIN=/ora1/app/oracle/product/8.1.6/network/admin);

 and when I tried to echo this variable

 echo($TNS_ADMIN);

 The value is not being printed, it is not defined.When I tried the
 same thing at the command prompt the value was defined.What is the reason
 that the value of TNS_ADMIN is not being available to the php-script.


 --
 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] submitbutton/imagebutton

2001-06-25 Thread Matt Williams


 I'm kind of new to php so there may be an obvious answer but I can't
 find it for the moment.

 What I want to do is change the 'type=submit' of a submit button to
 'type=image' so I can control the looks of the button.

 In pure HTML there is of course no problem, the image is still used as a
 submit button but... the submit type is being passed on to a php script
 ( ...if ($submit) {...) that makes a qeary to a mysql database. When I
 change the type=submit to type=image the script doesn't pick up the
 submit value anymore, so nothing happens.

 Am I overlooking something or is it just something that doesn't work?

IIRC you have to use something like $submit_x  $submit_y, which is a bit
more longwinded.

Since I have started using buttons for submit, I now put a hidden field
called formname inside each form,and chekc for that and that the method of
the form is correct.
It makes it a little bit easier if you have more than one form per page.

HTH

M@


-- 
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] managing variant data

2001-06-25 Thread Jesse Scott

Hi again, another conundrum.

What is the best way to deal with the following situation?

You have a group of common properties including a property that indicates a 
second group of common properties.  For example,
suppose you have this table:

Officers

Name
Rank
Age
Height
Weight
Species

The 'Species' property may have the following values: Vulcan, Human, 
Klingon, or Android.

If (Species==Vulcan) then you want to store these additional properties: 
MindmeldCount and YearsOnVulcan
If (Species==Klingon) then you want to store these additional properties: 
NumberofConcealedWeapons and RidgesOnForehead
If (Species==Android) then you want to store these additional properties: 
PositronicBrain and MemoryJigas
If (Species==Human) then you want to store these additional properties: 
AttendedStarfleetAcademy and BloodType

The problems I want to avoid are:
1) placing all the properties for all species in the Officers table (as 
this would include unnecessary properties for each row) and
2) storing the properties in the Officers in four seperate tables 
(Klingons, Humans, Androids, and Vulcans) redundantly.

Should additional tables be created: Vulcans, Klingons, Androids, Humans? 
If so, how should these tables be joined to Officers?

In an object language I would solve a problem like this be creating a base 
class with the Officers properties and then deriving new classes from this 
base class using inheritance.  How do I solve this problem in a database 
setting?

Thanks in advance for your help,

Jesse


-- 
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] access to a access db via php

2001-06-25 Thread Matthias Machnik

Hello NG,
it's the first time I use this NG and I'm not sure whether I'm I right here
or not.
The problem: I'm a beginner in php (just started to read the first
introductions). I created a guestbook with FP2000. The entrys where safed
in and shown from a db. FP 2000 nearly created it by itself using asp. The
problem is that my provider doesn't support a db connection via asp. They
told me that php3 is supported. My question: Can I use the created db (where
my guestbook entrys are safed) and edit and show results via php? I think
yes but all tutorials I found about it described a odbc connection and I
think the provider I'm using doesn't support this , too. Is there any
possibilty to work in an access DB without any odbc connection (cause then I
need a server which supports DNS and so on and all Servers I knew are too
expensive for me at the moment). Maybe I can access the db via php like a
text file?
There are many question I have, sorry if this description isn't precise
enough. I'm glad about any hints, comments, suggestions, links or whatsoever
that would help me.
Thanks in advance to read and answer this long posting.
MFG Matthias



-- 
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] Database access using ODBC

2001-06-25 Thread [EMAIL PROTECTED]

Hi,

Long time reader, first time poster! I am new to php coming from
a generally MS (unfortunately) background (Access, VB, SQLServer)
and I am looking to branch out a bit.

I have a client who wishes to have an internet front-end to an
Access database. I am using php with odbc to access this and (as
I am a newbie), I am having problems with the connection. After
I do an odbc_pConnect, when I call the odbc_exec, I get the usual
error, Warning: Supplied agrument is not a valid ODBC-Link resource.

The ODBC DSN is setup as standard (no default login etc). The
following code is being used for db access:

function DBRetrieve($pSQLStr)
{
   global $DBConn, $DBQryID, $DBQryRows, $DBQryColumns;

   $DBDsn='PHPTEST';
   $DBUser='Admin';
   $DBPassword ='';

   #Open a persistent connection to the database
   if (!$DBConn = (odbc_pConnect($DBDsn, $DBUser, $DBPassword) or die(Database 
Execution Error:  . odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError connecting to database\n;
 return false;
   }

   #Send query to database
   if (!$DBQryID=(odbc_Exec($DBConn, $pSQLStr) or die(Database Execution Error:  . 
odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError executing database request: [ODBC_EXEC]\n;
 DBDestroy();
 return false;
   }

   #Get no of rows in recordset
   if (!$DBQryRows=(odbc_num_rows($DBQryId) or die(Database Execution Error:  . 
odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError executing database request: [ODBC_NUM_ROWS]\n;
 DBDestroy();
 return false;
   }

   #Get number of fields to display
   if (!$DBQryColumns=(odbc_num_fields($DBQryId) or die(Database Execution Error:  . 
odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError executing database request: [ODBC_NUM_FIELDS]\n;
 DBDestroy();
 return false;
   }

   return true;
}

Does this look ok to you more experienced guys? Am I missing
something or is there a better way?

Thanks.

Colum


Mail2Web - Check your email from the web at
http://www.mail2web.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]




[PHP-DB] Re: MySQL: alphabetizing, skipping the , a

2001-06-25 Thread Cameron Metcalf

Hey all,
I'm trying to generate a alphabetized list of items
from my database, but I want to alphabetize the list,
skipping the leading articles in the title for each item.

some solutions suggest creating a 2nd (dummy name) column
to alphabetize by, but I don't want to maintain two columns for
my name field. but I've been using the following to ignore 'the ' and 'a
':

$select = mysql_select_db(bases);
$query = SELECT IF(left(nameE,2)='A ' or left(nameE,4)='The ', 
if(left(nameE,2)='A ',right(nameE,length(nameE)-2),
right(nameE, length(nameE)-4)),nameE) as 
alphabet,nameE FROM principle order by alphabet;
$result = mysql_query($query)

but if I want to ignore third or fourth variable, on top of 'the ' and 
'a ', what syntax would I use, to include these additional cases in my
script 
above?

the above query was built on a coding solution I found at
http://www.bitmechanic.com/mail-archives/mysql/May1998/0713.html
*mysql: select statements that ignore the *

Cameron

-- 
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] upload problem ...

2001-06-25 Thread Andre P.

Steve,

When you use input type=file the web server uploads the file to a 
temporary directory which it must have write access to, i.e. the user 
that the httpd process is run as must have write access to /php/tmp.

To my knowledge there is no way of allowing the httpd process to write 
to that directory using your ftp users/password. Bear in mind that you 
could change the temporary upload directory from /php/tmp to /tmp.

do you have full access to you box or only an account?   

hope this helps

ciao
Andre.

Steve Brett wrote:

hi,

i have a site and need to write a script to upload / download files so the
database can be updated / backed up.

i've tried setting up an input type=file ... and this works fine on my
machine but php gives an eror onthe server saying that the /php/tmp dir
cannot be written to by, i assume, the nobody account within whihc the web
server runs.

i need  to be bale to write to the httpd dir using php and then i can get
the db to import the files.

i have an ftp username and password but don't know how to get php to pass
the authorisation the server. the site is already password protected just
using a table of username / passowrds.

many thanks in advance

Steve








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

2001-06-25 Thread webmaster

How can I request a persistant cookie from the clients computer (to make a autologin)
this doesnt work :echo $HTTP_COOKIE_VARS[nameCookie]

code to set cookie: setcookie(newsLogin,$value,time()+ 3348000); 

if i ask from the same page I get the values I need but not from a different page...

thx



Re: [PHP-DB] Database access using ODBC

2001-06-25 Thread Miles Thompson

Colum,

Did you check out www.php.net/odbc_Exec

One of the solutions posted in  the comments was to download and install a 
new ODBC driver from MSFT. Are you getting a valid integer returned to 
$DBConn?

NOt worked with this, but I hope those are helpful suggestions - Miles Thompson

At 08:38 AM 6/25/01 -0400, [EMAIL PROTECTED] wrote:
Hi,

Long time reader, first time poster! I am new to php coming from
a generally MS (unfortunately) background (Access, VB, SQLServer)
and I am looking to branch out a bit.

I have a client who wishes to have an internet front-end to an
Access database. I am using php with odbc to access this and (as
I am a newbie), I am having problems with the connection. After
I do an odbc_pConnect, when I call the odbc_exec, I get the usual
error, Warning: Supplied agrument is not a valid ODBC-Link resource.

The ODBC DSN is setup as standard (no default login etc). The
following code is being used for db access:

function DBRetrieve($pSQLStr)
{
global $DBConn, $DBQryID, $DBQryRows, $DBQryColumns;

$DBDsn='PHPTEST';
$DBUser='Admin';
$DBPassword ='';

#Open a persistent connection to the database
if (!$DBConn = (odbc_pConnect($DBDsn, $DBUser, $DBPassword) or 
 die(Database Execution Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError connecting to database\n;
  return false;
}

#Send query to database
if (!$DBQryID=(odbc_Exec($DBConn, $pSQLStr) or die(Database Execution 
 Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError executing database request: [ODBC_EXEC]\n;
  DBDestroy();
  return false;
}

#Get no of rows in recordset
if (!$DBQryRows=(odbc_num_rows($DBQryId) or die(Database Execution 
 Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError executing database request: [ODBC_NUM_ROWS]\n;
  DBDestroy();
  return false;
}

#Get number of fields to display
if (!$DBQryColumns=(odbc_num_fields($DBQryId) or die(Database 
 Execution Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError executing database request: [ODBC_NUM_FIELDS]\n;
  DBDestroy();
  return false;
}

return true;
}

Does this look ok to you more experienced guys? Am I missing
something or is there a better way?

Thanks.

Colum


Mail2Web - Check your email from the web at
http://www.mail2web.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]


-- 
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] Is MySQL in 4.0.6?

2001-06-25 Thread Adam Lundrigan

Is MySQL included in the 406kb version of PHP 4.0.6?
When I try to connect to MySQL (after adding localhost  paswords to php.ini) using 
this version it says:
Warning: Can't connect to MySQL server on 'localhost' (10061) in mysql_local_test.php 
on line 2

From what i've heard, MySQL is included in PHPbut why doesn't the connect work if 
it is included?

-Adam Lundrigan
 CEO, VPU
 http://www.vpu-virtual.com/
 
 ICQ # 73617446
 [EMAIL PROTECTED]