Re: [PHP-DB] Re: Extremely Urgent: Problem with PHP and Oracle

2004-06-09 Thread Christopher Jones
Justin Patrin wrote:
Charles Morris wrote:
putenv("ORACLE_SID=PROJ");
putenv("ORACLE_HOME=/home/oracle9");

I have tried putenv myself and it doesn't seem to work for Oracle 
connections. Putting those in your shell environment, then restarting 
apache. Check to see if the env vars are set from a PHP script (without 
using putenv to set them of course).
I agree.  See 
http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Extremely Urgent: Problem with PHP and Oracle

2004-06-09 Thread Justin Patrin
Charles Morris wrote:
Hello all, I have recently been working with OCI and when I use OCILogon
[wethere with example scripts or my own code] I get a "PAge cannot be
displayed" (like DNS error) when I naviagte to the page. When I comment
out the OCILogon part it works great exept for the oracle part. I am able
to accesss the database from Perl, the built in SQL*PLUS and other
languages.- The only problem is this. I have to have this working by
friday morning and I cannot risk not mailing this alias; so please any
help is greatly appreciated!!
Here are my code snippets:
dbconnection.php

  function fatal_error($text)
  {
$maillink = 'mailto:[EMAIL PROTECTED]">network administrator';
echo "Fatal Error. ";
echo "[$text] ( 0 : 0 ) ";
echo $_SERVER['HTTP_USER_AGENT'];
echo "";
echo "ORACLE_SID: ".getenv("ORACLE_SID")."ORACLE_HOME: 
".getenv("ORACLE_HOME"."";
$error = OCIError();
if ($error["offset"])
{
   $sqltext = substr ($error["sqltext"], 0, $error["offset"]) . '*' . substr ($err 
($error["sqltext"], $error["offset"]);
}
else
{$sqltext = "No OCI error.";}
echo $sqltext;
echo "Contact the $maillink with this message.\n";
  exit;
  function init()
  {
putenv("ORACLE_SID=PROJ");
putenv("ORACLE_HOME=/home/oracle9");
$ipadd = $this->IPADD;
$user = $this->USER;
$pass = $this->PASS;
//$dbase = $this->DBASE;
//$dbase = $DBAC_BEGIN . $DBAC_PROTO . $DBAC_HOST . $DBAC_PORT . "))" . $DBAC_COTD . 
")";
$dbase = "(DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 128.*.*.*)(PORT 
= 1521)))(CONNECT_DATA=(SID=PROJ)))";
// use for PHP 5.0 and greater
//$conn = oci_connect($user, $pass, $dbase) || $this->fatal_error("Connection could not 
be established with server [$ipadd]");
// use for PHP 4.91 and lower
$conn = ociplogon($user, $pass, $dbase) || $this->fatal_error("Connection could not be 
established with server [$ipadd]");
$this->CONN = $conn || $this->fatal_error("Connection could not be stabalized, unable 
to continue.");
  return true;
  }
//end class: 'OracleConnection'
}
--eof--
Also, could someone please send me a working example of using variables
appended to text with "array()"? I am a long time experienced perl
programmer and I have tried using the . operatore a + but no luck.
Thanks everyone!!!
Please excuse types, typing on a 14.4 connection.
---
Charles Morris
[EMAIL PROTECTED]
CS Systems GroupOld Dominion University
http://www.cs.odu.edu/~cmorris
http://www.cs.odu.edu/cspage/systemstaff.html
--
They that give up essential liberty to obtain
a little temporary safety deserve neither
liberty nor safety. -- Benjamin Franklin, 1759
The only secure computer is one that's unplugged, locked in a
safe, and buried 20 feet under the ground in a secret location...
and i'm not even too sure about that one"--Dennis Huges, FBI.
On first glance, your fatal_error function doesn't seem to have an ending }.
I have tried putenv myself and it doesn't seem to work for Oracle 
connections. Putting those in your shell environment, then restarting 
apache. Check to see if the env vars are set from a PHP script (without 
using putenv to set them of course).

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


[PHP-DB] Re: Getting data from mysql db for html form

2004-06-09 Thread Gawie Marais
Thanx... Will give it a try later today and let you know... !

GM/


"Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Gamco - Gawie Marais" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi,
> >
> > Could someone help me out here...
> >
> > I have a mysql database with a table that conatains names. I am setting
up
> a
> > html form and I would like to create a multi-listing with those names so
> > that you can choose one and then submit the form.
>
>
> // open db connection...
>
> $result = mysql_query("SELECT name FROM table");
>
> echo '';
>
> while ($row = mysql_fetch_assoc($result)) {
>
> echo '' . $row['name'] . '';
> }
>
> echo '';
>
> Haven't tested it. Change 'name' to the name of your table column.
>
> Regards,
>
> Torsten Roehr

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



[PHP-DB] Extremely Urgent: Problem with PHP and Oracle

2004-06-09 Thread Charles Morris

Hello all, I have recently been working with OCI and when I use OCILogon
[wethere with example scripts or my own code] I get a "PAge cannot be
displayed" (like DNS error) when I naviagte to the page. When I comment
out the OCILogon part it works great exept for the oracle part. I am able
to accesss the database from Perl, the built in SQL*PLUS and other
languages.- The only problem is this. I have to have this working by
friday morning and I cannot risk not mailing this alias; so please any
help is greatly appreciated!!

Here are my code snippets:


dbconnection.php
mailto:[EMAIL PROTECTED]">network administrator';
echo "Fatal Error. ";
echo "[$text] ( 0 : 0 ) ";
echo $_SERVER['HTTP_USER_AGENT'];
echo "";

echo "ORACLE_SID: ".getenv("ORACLE_SID")."ORACLE_HOME: 
".getenv("ORACLE_HOME"."";

$error = OCIError();

if ($error["offset"])
{
   $sqltext = substr ($error["sqltext"], 0, $error["offset"]) . '*' . substr ($err 
($error["sqltext"], $error["offset"]);
}
else
{$sqltext = "No OCI error.";}

echo $sqltext;
echo "Contact the $maillink with this message.\n";
  exit;
  function init()
  {
putenv("ORACLE_SID=PROJ");
putenv("ORACLE_HOME=/home/oracle9");

$ipadd = $this->IPADD;
$user = $this->USER;
$pass = $this->PASS;
//$dbase = $this->DBASE;
//$dbase = $DBAC_BEGIN . $DBAC_PROTO . $DBAC_HOST . $DBAC_PORT . "))" . $DBAC_COTD 
. ")";
$dbase = "(DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 
128.*.*.*)(PORT = 1521)))(CONNECT_DATA=(SID=PROJ)))";

// use for PHP 5.0 and greater
//$conn = oci_connect($user, $pass, $dbase) || $this->fatal_error("Connection 
could not be established with server [$ipadd]");

// use for PHP 4.91 and lower
$conn = ociplogon($user, $pass, $dbase) || $this->fatal_error("Connection could 
not be established with server [$ipadd]");

$this->CONN = $conn || $this->fatal_error("Connection could not be stabalized, 
unable to continue.");

  return true;
  }

//end class: 'OracleConnection'
}

--eof--

Also, could someone please send me a working example of using variables
appended to text with "array()"? I am a long time experienced perl
programmer and I have tried using the . operatore a + but no luck.

Thanks everyone!!!

Please excuse types, typing on a 14.4 connection.

---
Charles Morris
[EMAIL PROTECTED]

CS Systems GroupOld Dominion University
http://www.cs.odu.edu/~cmorris
http://www.cs.odu.edu/cspage/systemstaff.html
--
They that give up essential liberty to obtain
a little temporary safety deserve neither
liberty nor safety. -- Benjamin Franklin, 1759
The only secure computer is one that's unplugged, locked in a
safe, and buried 20 feet under the ground in a secret location...
and i'm not even too sure about that one"--Dennis Huges, FBI.

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



Re: [PHP-DB] PHP - Calling a Oracle 9i procedure

2004-06-09 Thread Christopher Jones
Joshua,
I see this is the question asked on
  http://forums.oracle.com/forums/thread.jsp?forum=178&thread=248354&tstart=0&trange=15
I'll followup on the OTN forum, not to this PHP-DB mail list.
Chris
Joshua Skagemo wrote:
Hi,
I am trying to call a procedure in Oracle 9i but I just can't get it to
work...
My procedure has 5 IN values and return 1 REF CURSOR called :p_cursor
When I run my script I just keep getting this error:
Warning: OCIFetchInto: ORA-08103: object no longer exists in
E:\Intranet\test.php on line 35 
which is the while (OCIFetchInto($curs, $p_cursor, OCI_ASSOC)) {
line
Please help me with this...I am so stuck...

My PHP code looks like this:
$db = " (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
255.255.0.0)(PORT = 1521)) (CONNECT_DATA = (SID = )) )";
$conn = OCILogon("logon", "passoword", $db) or die('No Connection');
$curs = OCINewCursor($conn);
$query = "begin NB_P_TRAILBALANCE(:fromDate, :toDate, :companyCode,
:budgetCode, :startYear, :p_cursor); end;";
$stmt = OCIParse($conn, $query) or die ('Can not parse query');
ocibindbyname($stmt, ":fromDate", &$fromDate, -1);
ocibindbyname($stmt, ":toDate", &$toDate, -1);
ocibindbyname($stmt, ":companyCode", &$companyCode, -1);
ocibindbyname($stmt, ":budgetCode", &$budgetCode, -1);
ocibindbyname($stmt, ":startYear", &$startYear, -1);;
ocibindbyname($stmt, ":p_cursor", &$curs, -1, OCI_B_CURSOR);
$fromDate = '01/04/04';
$toDate = '30/04/04';
$companyCode = '01';
$budgetCode = '10909';
$startYear = '01/07/03';
ociexecute($stmt);
ociexecute($curs);
while (OCIFetchInto($curs, $p_cursor, OCI_ASSOC)) {
   var_dump($duties);
}
OCIFreeStatement($stmt);
OCIFreeCursor($curs);
OCILogoff($conn);
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] PHP - Calling a Oracle 9i procedure

2004-06-09 Thread Joshua Skagemo
Hi,

I am trying to call a procedure in Oracle 9i but I just can't get it to
work...

My procedure has 5 IN values and return 1 REF CURSOR called :p_cursor

When I run my script I just keep getting this error:

Warning: OCIFetchInto: ORA-08103: object no longer exists in
E:\Intranet\test.php on line 35 
which is the while (OCIFetchInto($curs, $p_cursor, OCI_ASSOC)) {
line

Please help me with this...I am so stuck...



My PHP code looks like this:

$db = " (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
255.255.0.0)(PORT = 1521)) (CONNECT_DATA = (SID = )) )";

$conn = OCILogon("logon", "passoword", $db) or die('No Connection');

$curs = OCINewCursor($conn);
$query = "begin NB_P_TRAILBALANCE(:fromDate, :toDate, :companyCode,
:budgetCode, :startYear, :p_cursor); end;";
$stmt = OCIParse($conn, $query) or die ('Can not parse query');


ocibindbyname($stmt, ":fromDate", &$fromDate, -1);
ocibindbyname($stmt, ":toDate", &$toDate, -1);
ocibindbyname($stmt, ":companyCode", &$companyCode, -1);
ocibindbyname($stmt, ":budgetCode", &$budgetCode, -1);
ocibindbyname($stmt, ":startYear", &$startYear, -1);;
ocibindbyname($stmt, ":p_cursor", &$curs, -1, OCI_B_CURSOR);

$fromDate = '01/04/04';
$toDate = '30/04/04';
$companyCode = '01';
$budgetCode = '10909';
$startYear = '01/07/03';

ociexecute($stmt);
ociexecute($curs);

while (OCIFetchInto($curs, $p_cursor, OCI_ASSOC)) {

   var_dump($duties);

}

OCIFreeStatement($stmt);
OCIFreeCursor($curs);
OCILogoff($conn);

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



[PHP-DB] Re: Count unique visits in PHP/MySQL

2004-06-09 Thread Kim Steinhaug
Whatabout creating a table containing online users,
where you log every activity with IP, BrowserSession and Timestamp.
You also create a table to track the accual unique visits.

So my logic to solve it :

Update the online table like this (Some rough coding below, not tested at
all, read the logic).
30 minutes = 60sec*30 = 1800

1"delete from online where timestamp<" . (time() - 1800); // Delete
inactive users / uniqe ghosts or whatever
2"Update online set timestamp = '" . time() . "' where ip='" . $ip . "'
and browsersession = '" . $browsersession . "'";
3If (!mysql_affected_rows()){
// Update the Unique visitor table
// Insert new entry with IP, Browsersession and time() into the
online database
}

As far as my midnight brain would see it this would work nicely.

--
--
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
ast.net...
> I am making a PHP/MySQL traffic report page from a table that records some
user activity using PHP referrer information.
>
> I have a table with three rows: IP, page_name, and timestamp. The IP row
records the user's IP address, page_name records the name of the page that
the user loaded, and the timestamp row records in Unix timestamp format the
time of day that the user requested the page.
>
> I want to be able to count unique visits per IP according to Internet
Advertising Bureau standards, which count a "Unique Visit" as a log in by
the same IP once every thirty minutes.
>
> IAB verbatim definition: "Visit - One or more text and/or graphics
downloads from a site qualifying as at least one page, without 30
consecutive minutes of inactivity, which can be reasonably attributed to a
single browser for a single session. A browser must "pull" text or graphics
content to be considered a visit."
>
> So I need to make a MySQL query that will count how many times an IP
logged a timestamp within a given time period.
>
> For example, the publisher checking traffic could request a date between
May 1 and May 31, and I'd like to be able to return a page that counted
unique users (count distinct IP), pages viewed (list distinct pages) and how
many times they visited in that period. I have the first two down, but not
the unique visits. Any ideas?

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



[PHP-DB] Re: Getting data from mysql db for html form

2004-06-09 Thread Torsten Roehr
"Gamco - Gawie Marais" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Could someone help me out here...
>
> I have a mysql database with a table that conatains names. I am setting up
a
> html form and I would like to create a multi-listing with those names so
> that you can choose one and then submit the form.


// open db connection...

$result = mysql_query("SELECT name FROM table");

echo '';

while ($row = mysql_fetch_assoc($result)) {

echo '' . $row['name'] . '';
}

echo '';

Haven't tested it. Change 'name' to the name of your table column.

Regards,

Torsten Roehr

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



[PHP-DB] Getting data from mysql db for html form

2004-06-09 Thread GamCo - Gawie Marais
Hi,

Could someone help me out here...

I have a mysql database with a table that conatains names. I am setting up a
html form and I would like to create a multi-listing with those names so
that you can choose one and then submit the form.




Regards,

-
Gawie Marais
GamCo
Tel: +27 11 312 0481
Fax: +27 11 312 0483
E-Mail: [EMAIL PROTECTED]
Web: www.gam.co.za
-
...:: Beauty is one of the rare things which does not lead to doubt of God.
::...
-
http://www.techweb.za.net/
http://www.linuxonline.za.net/

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



RE: [PHP-DB] escape character

2004-06-09 Thread Hutchins, Richard
stripslashes()?
 

-Original Message-
From: Marie Osypian [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 09, 2004 9:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] escape character



\"Fees and Expenses.\"

Quick question: I am sending email via a simple script: \"QUOTED TEXT.\" is
in the body of the message with escape characters. When the mail is sent and
arrives the \ (escape characters) are still in the email text, any way to
remove them an not break the script?

$headers  = "From: $name <$email>\n";
$headers .= "Cc: $Name <$email>\n";
$headers .= "X-Sender: <$email>\n";
$headers .= "X-Mailer: $Name\n";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: <$email>";

$recipient = "$user_first $user_last <$user_email>";
$subject = "$Subject";

$message  = "Dear $First $Last,\n";
$message .= "\n";
$message .= "Example text here \"QUOTED TEXT.\" \n";
$message .= "\n";
$message .= "Example text here \"QUOTED TEXT.\"\n";
$message .= "\n";
$message .= "Example text here \"QUOTED TEXT.\"\n";
$message .= "\n";
$message .= "$Name\n";
$message .= "$Company\n";
$message .= "$Phone \n";

mail($recipient, $subject, $message, $headers);

Thanks,
 
MAO



[PHP-DB] escape character

2004-06-09 Thread Marie Osypian
Title: Message




\"Fees and Expenses.\"
Quick question: I am 
sending email via a simple script: \"QUOTED TEXT.\" is in the body of the 
message with escape characters. When the mail is sent and arrives the \ (escape 
characters) are still in the email text, any way to remove them an not 
break the script?
$headers  
= "From: $name 
<$email>\n";    
$headers .= "Cc: $Name 
<$email>\n";    
$headers .= "X-Sender: 
<$email>\n";    
$headers .= "X-Mailer: 
$Name\n";    
$headers .= "X-Priority: 
1\n";    
$headers .= "Return-Path: <$email>";
    
$recipient = "$user_first $user_last 
<$user_email>";    
$subject = "$Subject";
    
$message  = "Dear $First 
$Last,\n";    
$message .= 
"\n";    
$message .= "Example text here \"QUOTED TEXT.\" 
\n";    
$message .= 
"\n";    
$message .= "Example text here \"QUOTED 
TEXT.\"\n";    
$message .= 
"\n";    
$message .= "Example text here \"QUOTED 
TEXT.\"\n";    
$message .= 
"\n";    
$message .= 
"$Name\n";    
$message .= 
"$Company\n";    
$message .= "$Phone \n";
    
mail($recipient, $subject, $message, $headers);
Thanks,
 
MAO