[PHP] Problem with function

2008-09-12 Thread Jason Pruim
So, I am fighting with a problem function... I have used this function  
on a previous project and it worked just fine, so I'm not sure what  
changed...


The only difference is that on this site, I'm using mod_rewrite to  
write all non-existent folder requests into a php file to process what  
to do with it.


here's some code:

processing file:

?PHP
require(php.ini.php);
require(dbmysqliconnect.php);
require(defaults.php);
require(notify_email.php);
	$link = dbmysqliconnect($server, $username, $password, $database,  
$link);

$date = time();


	//Do NOT insert or update sales rep database through this method...  
Only included to be supplied to the notify_email function. JP

$salesRepID = $_POST['txtSalesRepID'];
$Record= $_POST['txtRecord'];
notify_email($Record, $salesRepID);
$stmt = mysqli_stmt_init($link);

//Create the statement

mysqli_stmt_prepare($stmt, UPDATE purl.schreur SET
FName = ?,
LName = ?,
email = ?,
phone = ?,
record = ?,
subscribed = ?,
date = ?,
IPAddress = ?,
Business = ?,
Address1 = ?,
City = ?,
State = ?,
Zip = ?,
Coffee = ?,
Meeting = ?,
time = ?)
or die(prepare error  . mysqli_error($link));


mysqli_stmt_bind_param($stmt, '',
   $_POST['txtFName'],
   $_POST['txtLName'],
   $_POST['txtEmail'],
   $_POST['txtPhone'],
   $_POST['record'],
   $_POST['subscribed'],
   $date,
   $_SERVER['REMOTE_ADDR'],
   $_POST['txtBusiness'],
   $_POST['txtAddress1'],
   $_POST['txtCity'],
   $_POST['txtState'],
   $_POST['txtZip'],
   $_POST['rdoCoffee'],
   $_POST['rdoTime'],
   $_POST['areaPlans'])
or die( bind error  . mysqli_error($link));
//Add the record
	mysqli_stmt_execute($stmt) or die( execute error  .  
mysqli_error($link));



?

notify_email.php file:

?PHP

function notify_email($Record, $salesRepID) {
require(defaults.php);
require(func.sendemail.php);
require(dbmysqliconnect.php);
		$salesRep = array(1 = [EMAIL PROTECTED], [EMAIL PROTECTED] 
, 2 = [EMAIL PROTECTED], [EMAIL PROTECTED], 3  
=[EMAIL PROTECTED], 4=[EMAIL PROTECTED]);

echo 1;
		$link1 = dbmysqliconnect($server, $username, $password, $database,  
$link);

echo 2;
$sql = SELECT * FROM schreur WHERE record='{$Record}';
		$row[] = mysqli_query($link1, $sql) or die(Could not perform query:  
.mysqli_errno($link1));

echo 3;
$result = $row[0];
echo 4;


//  $dataSet = array();

//  while ($row = mysqli_fetch_assoc($result)) {
//echo brwhileBR;
//  $dataSet[] = $row;

//  }
$from= [EMAIL PROTECTED];
echo 5;
$returnPath = [EMAIL PROTECTED];
$replyTo = [EMAIL PROTECTED];
echo $Record;
echo 6;
//  echo brJust before while in notify_email.phpbr;

//  echo brdirectly above whilebr;

//  echo BRdataset print: ;
//  print_r($dataSet);
//  echo BR;
//  echo brdirectly above foreachbr;
//foreach ( $dataSet AS $row ) {
echo 6;
while ($row = mysqli_fetch_assoc($result)) {

Re: [PHP] Problem with function

2008-09-12 Thread Jochem Maas

Jason Pruim schreef:
So, I am fighting with a problem function... I have used this function 
on a previous project and it worked just fine, so I'm not sure what 
changed...


The only difference is that on this site, I'm using mod_rewrite to write 
all non-existent folder requests into a php file to process what to do 
with it.


so no difference in php versions, etc etc. check phpinfo() output for
the current error_reporting/display_errors settings. and learn about
error_log() and how to 'tail' the error log (fuck knows how you go about
that on windows ... then there are reasons I have a Mac ;-))



here's some code:

processing file:

?PHP
require(php.ini.php);
require(dbmysqliconnect.php);
require(defaults.php);
require(notify_email.php);


the echo '10'; occurs when you include notify_email.php, the other echos only 
when you call the function in that file.

$link = dbmysqliconnect($server, $username, $password, $database, 
$link);


can you output anything after this line? chances are you don't have mysqli


$date = time();


//Do NOT insert or update sales rep database through this method... 
Only included to be supplied to the notify_email function. JP

$salesRepID = $_POST['txtSalesRepID'];
$Record= $_POST['txtRecord'];


my guess is you never reach this line.


notify_email($Record, $salesRepID);
$stmt = mysqli_stmt_init($link);

//Create the statement


mysqli_stmt_prepare($stmt, UPDATE purl.schreur SET
FName = ?,
LName = ?,
email = ?,
phone = ?,
record = ?,
subscribed = ?,
date = ?,
IPAddress = ?,
Business = ?,
Address1 = ?,
City = ?,
State = ?,
Zip = ?,
Coffee = ?,
Meeting = ?,
time = ?)
or die(prepare error  . mysqli_error($link));


mysqli_stmt_bind_param($stmt, '',
   $_POST['txtFName'],
   $_POST['txtLName'],
   $_POST['txtEmail'],
   $_POST['txtPhone'],
   $_POST['record'],
   $_POST['subscribed'],
   $date,
   $_SERVER['REMOTE_ADDR'],
   $_POST['txtBusiness'],
   $_POST['txtAddress1'],
   $_POST['txtCity'],
   $_POST['txtState'],
   $_POST['txtZip'],
   $_POST['rdoCoffee'],
   $_POST['rdoTime'],
   $_POST['areaPlans'])
or die( bind error  . mysqli_error($link));
//Add the record
mysqli_stmt_execute($stmt) or die( execute error  . 
mysqli_error($link));


?


notify_email.php file:

?PHP

function notify_email($Record, $salesRepID) {

require(defaults.php);
require(func.sendemail.php);
require(dbmysqliconnect.php);
$salesRep = array(1 = [EMAIL PROTECTED], 
[EMAIL PROTECTED], 2 = [EMAIL PROTECTED], 
[EMAIL PROTECTED], 3 =[EMAIL PROTECTED], 
4=[EMAIL PROTECTED]);

echo 1;
$link1 = dbmysqliconnect($server, $username, $password, 
$database, $link);

echo 2;
$sql = SELECT * FROM schreur WHERE record='{$Record}';
$row[] = mysqli_query($link1, $sql) or die(Could not perform 
query: .mysqli_errno($link1));

echo 3;
$result = $row[0];
echo 4;

   
//$dataSet = array();
   
//while ($row = mysqli_fetch_assoc($result)) {

//echo brwhileBR;
//$dataSet[] = $row;

//}

$from= [EMAIL PROTECTED];
echo 5;
$returnPath = [EMAIL PROTECTED];
$replyTo = [EMAIL PROTECTED];
echo $Record;
echo 6;
//echo brJust before while in notify_email.phpbr;
   
//echo brdirectly above whilebr;
   
//echo BRdataset print: ;

//print_r($dataSet);
//echo BR;
//echo brdirectly above foreachbr;
//foreach ( $dataSet AS $row ) {
echo 6;
while ($row = mysqli_fetch_assoc($result)) {   
echo inside while;

//Build the e-mail headers
$ID = $row['salesRep'];
$to = $salesRep[$ID];
$headers = From: .$from.\n;
$headers .= Return-Path: .$returnPath.\n;
$headers .= Reply-To: .$replyTo.\n;
   
$subject = {$row['FName']} wants coffee!;
   
$message = First Name: {$row['FName']} \n;

$message .= Last Name: {$row['LName']}\n;
$message .= Company  . $row['Business'] . \n;
   

Re: [PHP] Problem with function

2008-09-12 Thread Jason Pruim


On Sep 12, 2008, at 8:44 AM, Jochem Maas wrote:


Jason Pruim schreef:
So, I am fighting with a problem function... I have used this  
function on a previous project and it worked just fine, so I'm not  
sure what changed...
The only difference is that on this site, I'm using mod_rewrite to  
write all non-existent folder requests into a php file to process  
what to do with it.


so no difference in php versions, etc etc. check phpinfo() output for
the current error_reporting/display_errors settings. and learn about
error_log() and how to 'tail' the error log (fuck knows how you go  
about

that on windows ... then there are reasons I have a Mac ;-))


So Do I :)

The php versions are the same, they are on the same computer :)

PHP Version 5.2.0www.entropy.ch Release 3 (Universal Binary)

The server is a PowerPC Based comptuer running OS X Server 10.4.11




here's some code:
processing file:
?PHP
   require(php.ini.php);
   require(dbmysqliconnect.php);
   require(defaults.php);
   require(notify_email.php);


the echo '10'; occurs when you include notify_email.php, the other  
echos only when you call the function in that file.


   $link = dbmysqliconnect($server, $username, $password,  
$database, $link);


can you output anything after this line? chances are you don't have  
mysqli


mysqli is up and working on the computer... I use it for all my other  
projects as well. And yes I can I echoed out no problem




   $date = time();
   //Do NOT insert or update sales rep database through this  
method... Only included to be supplied to the notify_email  
function. JP

   $salesRepID = $_POST['txtSalesRepID'];
   $Record= $_POST['txtRecord'];


my guess is you never reach this line.


   notify_email($Record, $salesRepID);
   $stmt = mysqli_stmt_init($link);
   //Create the statement
   mysqli_stmt_prepare($stmt, UPDATE purl.schreur SET
   FName = ?,
   LName = ?,
   email = ?,
   phone = ?,
   record = ?,
   subscribed = ?,
   date = ?,
   IPAddress = ?,
   Business = ?,
   Address1 = ?,
   City = ?,
   State = ?,
   Zip = ?,
   Coffee = ?,
   Meeting = ?,
   time = ?)
   or die(prepare error  . mysqli_error($link));
   mysqli_stmt_bind_param($stmt, '',
  $_POST['txtFName'],
  $_POST['txtLName'],
  $_POST['txtEmail'],
  $_POST['txtPhone'],
  $_POST['record'],
  $_POST['subscribed'],
  $date,
  $_SERVER['REMOTE_ADDR'],
  $_POST['txtBusiness'],
  $_POST['txtAddress1'],
  $_POST['txtCity'],
  $_POST['txtState'],
  $_POST['txtZip'],
  $_POST['rdoCoffee'],
  $_POST['rdoTime'],
  $_POST['areaPlans'])
   or die( bind error  . mysqli_error($link));
//Add the record
   mysqli_stmt_execute($stmt) or die( execute error  .  
mysqli_error($link));

   ?
notify_email.php file:
?PHP
   function notify_email($Record, $salesRepID) {
   require(defaults.php);
   require(func.sendemail.php);
   require(dbmysqliconnect.php);
   $salesRep = array(1 = [EMAIL PROTECTED], [EMAIL PROTECTED] 
, 2 = [EMAIL PROTECTED], [EMAIL PROTECTED],  
3 =[EMAIL PROTECTED], 4=[EMAIL PROTECTED]);

   echo 1;
   $link1 = dbmysqliconnect($server, $username, $password,  
$database, $link);

   echo 2;
   $sql = SELECT * FROM schreur WHERE record='{$Record}';
   $row[] = mysqli_query($link1, $sql) or die(Could not  
perform query: .mysqli_errno($link1));

   echo 3;
   $result = $row[0];
   echo 4;
  //$dataSet = array();
  //while ($row = mysqli_fetch_assoc($result)) {
//echo brwhileBR;
//$dataSet[] = $row;
   //}
   $from= [EMAIL PROTECTED];
   echo 5;
   $returnPath = [EMAIL PROTECTED];
   $replyTo = [EMAIL PROTECTED];
   echo $Record;
   echo 6;
   //echo brJust before while in notify_email.phpbr;
  //echo brdirectly above whilebr;
  //echo BRdataset print: ;
   //print_r($dataSet);
   //echo BR;
   //echo brdirectly above foreachbr;
   //foreach ( $dataSet AS $row ) {
   echo 6;
   while ($row = mysqli_fetch_assoc($result))  
{   echo inside while;

   //Build the e-mail headers
   $ID = $row['salesRep'];
   $to = $salesRep[$ID];
   $headers = From: .$from.\n;
   $headers .= Return-Path: 

Re: [PHP] Problem with function

2008-09-12 Thread Jochem Maas

Jason Pruim schreef:





my guess is you never reach this line.


I don't think notify_email() is called, find out what is dying before you
get to this line.

note you'll get 'echo '10';' before you get 'echo '1';'


   notify_email($Record, $salesRepID);
   $stmt = mysqli_stmt_init($link);
   //Create the statement
   mysqli_stmt_prepare($stmt, UPDATE purl.schreur SET
   FName = ?,
   LName = ?,
   email = ?,
   phone = ?,
   record = ?,
   subscribed = ?,
   date = ?,
   IPAddress = ?,
   Business = ?,
   Address1 = ?,
   City = ?,
   State = ?,
   Zip = ?,
   Coffee = ?,
   Meeting = ?,
   time = ?)
   or die(prepare error  . mysqli_error($link));
   mysqli_stmt_bind_param($stmt, '',
  $_POST['txtFName'],
  $_POST['txtLName'],
  $_POST['txtEmail'],
  $_POST['txtPhone'],
  $_POST['record'],
  $_POST['subscribed'],
  $date,
  $_SERVER['REMOTE_ADDR'],
  $_POST['txtBusiness'],
  $_POST['txtAddress1'],
  $_POST['txtCity'],
  $_POST['txtState'],
  $_POST['txtZip'],
  $_POST['rdoCoffee'],
  $_POST['rdoTime'],
  $_POST['areaPlans'])
   or die( bind error  . mysqli_error($link));
//Add the record
   mysqli_stmt_execute($stmt) or die( execute error  . 
mysqli_error($link));

   ?
notify_email.php file:
?PHP
   function notify_email($Record, $salesRepID) {
   require(defaults.php);
   require(func.sendemail.php);
   require(dbmysqliconnect.php);
   $salesRep = array(1 = [EMAIL PROTECTED], 
[EMAIL PROTECTED], 2 = [EMAIL PROTECTED], 
[EMAIL PROTECTED], 3 =[EMAIL PROTECTED], 
4=[EMAIL PROTECTED]);

   echo 1;
   $link1 = dbmysqliconnect($server, $username, $password, 
$database, $link);

   echo 2;
   $sql = SELECT * FROM schreur WHERE record='{$Record}';
   $row[] = mysqli_query($link1, $sql) or die(Could not perform 
query: .mysqli_errno($link1));

   echo 3;
   $result = $row[0];
   echo 4;
  //$dataSet = array();
  //while ($row = mysqli_fetch_assoc($result)) {
//echo brwhileBR;
//$dataSet[] = $row;
   //}
   $from= [EMAIL PROTECTED];
   echo 5;
   $returnPath = [EMAIL PROTECTED];
   $replyTo = [EMAIL PROTECTED];
   echo $Record;
   echo 6;
   //echo brJust before while in notify_email.phpbr;
  //echo brdirectly above whilebr;
  //echo BRdataset print: ;
   //print_r($dataSet);
   //echo BR;
   //echo brdirectly above foreachbr;
   //foreach ( $dataSet AS $row ) {
   echo 6;
   while ($row = mysqli_fetch_assoc($result)) {   
echo inside while;

   //Build the e-mail headers
   $ID = $row['salesRep'];
   $to = $salesRep[$ID];
   $headers = From: .$from.\n;
   $headers .= Return-Path: .$returnPath.\n;
   $headers .= Reply-To: .$replyTo.\n;
  $subject = {$row['FName']} wants coffee!;
  $message = First Name: {$row['FName']} \n;
   $message .= Last Name: {$row['LName']}\n;
   $message .= Company  . $row['Business'] . \n;
   $message .= Email: .$row['email'] . \n;
   $message .= Phone:  .$row['phone'] . \n;
   $message .= Address:  . $row['Address1'] . \n;
   $message .= City:  . $row['City'] . \n;
   $message .= State:  .$row['State'] . \n;
   $message .= Zip: . $row['Zip'] . \n;
   $message .= Coffee of choice: .$row['Coffee'] . \n\n;
   $message .= When a good time would be: 
\n.$row['Meeting'] . \n\n;

   $message .= Current plans: \n\n;
   $message .= $row['plans'] . \n\n;
   send_email($to, $subject, $message, $headers);
  }
echo 7;
   echo PRE
   pre
   Headers: $headers
   To: $to
   Subject: $subject
   Message:
   $message
   /pre
PRE;
echo 8;
   echo Just after end of while in notify_email.php;
   //header(Location: index.php);
   echo 9;
   } //Function closed
   echo 10;
?
yes all of the echo's in there are for testing purposes to see where 
it's choking.
Ever since I started using mod_rewrite, I seem to have lost my error 
reporting from php so if someone knows a trick on how to fix that I 
would appreciate it :)
On my page when I load it, all I see is the 10 I echo 

Re: [PHP] Problem with function

2008-09-12 Thread Brady Mitchell


On Sep 12, 2008, at 544AM, Jochem Maas wrote:

the current error_reporting/display_errors settings. and learn about
error_log() and how to 'tail' the error log (fuck knows how you go  
about

that on windows ... then there are reasons I have a Mac ;-))


The ability to tail error logs is one of the main reasons I have  
cygwin installed on my windows machine at work. Once installed if you  
add the cygwin\bin dir to your path you don't even have to be in a  
cygwin prompt to use tail and the other *nix goodness it provides.


http://bradym.net/windows/making-the-windows-command-prompt-usable

Brady

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



[PHP] Problem calling function within a class

2005-03-18 Thread Ahmed Abdel-Aliem
hi

i am new to classes and i have a problem with a class i wrote

here is the class

---
class Company {


var $Company_Name;
var $Company_Referrer_Table;
var $Company_Visitor_Table;
var $Company_ID;
var $Message;
var $File;
var $FileName;
var $Record_Data;


function CompanyInfo (){



$SQL_Query = mysql_query(SELECT * FROM company_list WHERE
Company_ID = $this-Company_ID);
$Record = mysql_fetch_array($SQL_Query);

$this-Company_ID = $Record['Company_ID'];
$this-Company_Name = $Record['Company_Name'];  
$this-Company_Referrer_Table = 
$Record['Company_Referrer_Table'];
$this-Company_Visitor_Table = $Record['Company_Visitor_Table'];

return $this-Company_Referrer_Table;
return $this-Company_Visitor_Table;

}   


function GenerateUniqueID(){

return md5(uniqid(mt_rand(),TRUE));

}


function UploadFile($File) {

$this-File = $File;
$dst_file_name = $this-GenerateUniqueID();
$arr = split(\.,$this-File['name']);
$this-File['name'] = $dst_file_name;
$this-File['name'] .= ..$arr[count($arr)-1];
$dest_dir = 'temp';
$dest = $dest_dir . '/' .$this-File['name'];
$r = move_uploaded_file($this-File['tmp_name'], $dest);
$this-FileName = $this-File['name'];
chmod(temp/.$this-FileName, 777);


}

function TakeData($File, $Company_ID, $Destination) {

$this-Company_ID = $Company_ID;

$this-CompanyInfo();



if ($Destination == Referrer){

$SQL_Query = INSERT INTO $this-Company_Referrer_Table 
( Record_ID
, Record_Data ) VALUES ( '', '$this-Record_Data');

}elseif ($Destination == Visitor){

$SQL_Query = INSERT INTO $this-Company_Visitor_Table 
( Record_ID
, Record_Data ) VALUES ( '', '$this-Record_Data');

}

$this-UploadFile($File);

$fh = fopen(temp/.$this-FileName, r);
while (! feof($fh)) : $this-Record_Data = fgets($fh, 4096);
mysql_query($SQL_Query)or die(Error In Importing Records To 
The Database);
endwhile;
fclose($fh);

$this-Message = Date Imported Successfully;
return $this-Message; 

}



}

---

the problem occurs when i call the function TakeDate 

i use this code to call it 

$Company = new Company();
$File = $HTTP_POST_FILES['FileToUpload'];
$Company-TakeData($File, $Company_ID, $Destination);
$Message = $Company-Message;

the error i get is Error In Importing Records To The Database which
i defined as the error of mysql in the function.

i checked everything and found that the problem happens because i
can't retireve the values of
$this-Company_Referrer_Table and $this-Company_Visitor_Table by
calling the function CompanyInfo
from the function TakeData



can anyone advise me with the right way to call the CompanyInfo
function from the TakeData and get the values correctly?




-- 
Ahmed Abdel-Aliem
Web Developer
www.ApexScript.com
0101108551
registered Linux user number 382789

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



Re: [PHP] Problem calling function within a class

2005-03-18 Thread Forest Liu
it shuold be:

$SQL_Query = INSERT INTO .$this-Company_Referrer_Table. ( Record_ID
, Record_Data ) VALUES ( '', '.$this-Record_Data.');

just use the operator '.' to connect two string. I think php could
only identify simple car direcctly as $foo to be its value in a string
contain it. The reference to a class data member would not work well
in a string. So you should use the operator '.' to connect them.

On Sat, 19 Mar 2005 02:43:15 +0200, Ahmed Abdel-Aliem [EMAIL PROTECTED] wrote:
 hi
 
 i am new to classes and i have a problem with a class i wrote
 
 here is the class
 
 ---
 class Company {
 
var $Company_Name;
var $Company_Referrer_Table;
var $Company_Visitor_Table;
var $Company_ID;
var $Message;
var $File;
var $FileName;
var $Record_Data;
 
function CompanyInfo (){
 
$SQL_Query = mysql_query(SELECT * FROM company_list WHERE
 Company_ID = $this-Company_ID);
$Record = mysql_fetch_array($SQL_Query);
 
$this-Company_ID = $Record['Company_ID'];
$this-Company_Name = $Record['Company_Name'];
$this-Company_Referrer_Table = 
 $Record['Company_Referrer_Table'];
$this-Company_Visitor_Table = 
 $Record['Company_Visitor_Table'];
 
return $this-Company_Referrer_Table;
return $this-Company_Visitor_Table;
 
}
 
function GenerateUniqueID(){
 
return md5(uniqid(mt_rand(),TRUE));
 
}
 
function UploadFile($File) {
 
$this-File = $File;
$dst_file_name = $this-GenerateUniqueID();
$arr = split(\.,$this-File['name']);
$this-File['name'] = $dst_file_name;
$this-File['name'] .= ..$arr[count($arr)-1];
$dest_dir = 'temp';
$dest = $dest_dir . '/' .$this-File['name'];
$r = move_uploaded_file($this-File['tmp_name'], $dest);
$this-FileName = $this-File['name'];
chmod(temp/.$this-FileName, 777);
 
}
 
function TakeData($File, $Company_ID, $Destination) {
 
$this-Company_ID = $Company_ID;
 
$this-CompanyInfo();
 
if ($Destination == Referrer){
 
$SQL_Query = INSERT INTO 
 $this-Company_Referrer_Table ( Record_ID
 , Record_Data ) VALUES ( '', '$this-Record_Data');
 
}elseif ($Destination == Visitor){
 
$SQL_Query = INSERT INTO $this-Company_Visitor_Table 
 ( Record_ID
 , Record_Data ) VALUES ( '', '$this-Record_Data');
 
}
 
$this-UploadFile($File);
 
$fh = fopen(temp/.$this-FileName, r);
while (! feof($fh)) : $this-Record_Data = fgets($fh, 4096);
mysql_query($SQL_Query)or die(Error In Importing Records To 
 The Database);
endwhile;
fclose($fh);
 
$this-Message = Date Imported Successfully;
return $this-Message;
 
}
 
 }
 
 ---
 
 the problem occurs when i call the function TakeDate
 
 i use this code to call it
 
 $Company = new Company();
 $File = $HTTP_POST_FILES['FileToUpload'];
 $Company-TakeData($File, $Company_ID, $Destination);
 $Message = $Company-Message;
 
 the error i get is Error In Importing Records To The Database which
 i defined as the error of mysql in the function.
 
 i checked everything and found that the problem happens because i
 can't retireve the values of
 $this-Company_Referrer_Table and $this-Company_Visitor_Table by
 calling the function CompanyInfo
 from the function TakeData
 
 can anyone advise me with the right way to call the CompanyInfo
 function from the TakeData and get the values correctly?
 
 --
 Ahmed Abdel-Aliem
 Web Developer
 www.ApexScript.com
 0101108551
 registered Linux user number 382789
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
   Sincerely,
 Forest Liu()

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



[PHP] Problem with function declaration in include files

2002-01-04 Thread Bobby

I have been using the following function declaration syntax for ages with no
problems.

Main php file:

?php
include my-inc.php;
...
FuncExample(arg1,arg2);
...
?


Include file:

?php
...
FuncExample(arg1,arg2){
Function Content
}
...
?php

I have just finished some work for a client, after full testing on both my
Unix and Win32 test servers I moved the site over to their hosting company
and I get the following problem.

All my functions that are declared in my Inc files are spitting back the
error:

Fatal error: Call to undefined function:...

I have spoken with the hosting company, but they have considerable trouble
with 'backside' and 'elbow' recognition.

Are there any PHP.ini settings that affect this type of function
declaration?

Any help would be appreciated.

Bobby





-- 
PHP General 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] Problem with function declaration in include files

2002-01-04 Thread Dennis Moore




The problem is most likely with your include statement. The include 
path imay be incorrect... 



"Bobby" [EMAIL PROTECTED] wrote in 
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 
I have been using the following function declaration syntax for ages with 
no problems.  Main php file:  
?php include "my-inc.php"; ...  
FuncExample(arg1,arg2); ... ?   
Include file:  ?php ... 
FuncExample(arg1,arg2){ Function Content } 
... ?php  I have just finished some work for a 
client, after full testing on both my Unix and Win32 test servers I 
moved the site over to their hosting company and I get the following 
problem.  All my functions that are declared in my Inc files are 
spitting back the error:  "Fatal error: Call to 
undefined function:..."  I have spoken with the hosting company, 
but they have considerable trouble with 'backside' and 'elbow' 
recognition.  Are there any PHP.ini settings that affect this 
type of function declaration?  Any help would be 
appreciated.  Bobby 
 --  PHP General 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 General 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] Problem with function declaration in include files

2002-01-04 Thread Bobby

I wish it was that simple, I have already added debug 'echo' statements to
make sure the included file is being included correctly and it is?

This problem really has me beat, I never usually send out desperate pleas,
but I am not a happy bunny atm.

Any thoughts would be appreciated

Cheers



Bobby
Dennis Moore [EMAIL PROTECTED] wrote in message
003501c19526$a0968740$[EMAIL PROTECTED]">news:003501c19526$a0968740$[EMAIL PROTECTED]...
The problem is most likely with your include statement.  The include path
imay be incorrect...



Bobby [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have been using the following function declaration syntax for ages with
no
 problems.

 Main php file:

 ?php
 include my-inc.php;
 ...
 FuncExample(arg1,arg2);
 ...
 ?


 Include file:

 ?php
 ...
 FuncExample(arg1,arg2){
 Function Content
 }
 ...
 ?php

 I have just finished some work for a client, after full testing on both my
 Unix and Win32 test servers I moved the site over to their hosting company
 and I get the following problem.

 All my functions that are declared in my Inc files are spitting back the
 error:

 Fatal error: Call to undefined function:...

 I have spoken with the hosting company, but they have considerable trouble
 with 'backside' and 'elbow' recognition.

 Are there any PHP.ini settings that affect this type of function
 declaration?

 Any help would be appreciated.

 Bobby





 --
 PHP General 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 General 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] problem with function array_* that preserved the key

2001-11-14 Thread Stig Venaas

On Sat, Nov 03, 2001 at 03:54:23PM -0500, Reuben D Budiardja wrote:
 since the key are preserved, arrC is no longer indexed from 0. Well, in most 
 cases I don't care about the key if it's just indexed array. But since the 
 key I preserved, I can no longer do
 
 for($i=0; $icount($arrC);$i++)
   echo $arrC[$i];
 
 if it happens that the returned indedex in array C 19, 20,25, for example. 
 Any workaround?

There are many other ways you could traverse the array, but I think
array_values() does what you want.

Stig

-- 
PHP General 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] problem with function array_* that preserved the key

2001-11-03 Thread Reuben D Budiardja


Hi,
I have problem with array function that return an array and preserved the key 
of the array argument. Take example of array_diff:
I have 2 arrays that has index 0,1,2, ... as the key, and use it as the 
argument, say $arrA, and $arrB,

$arrC = array_diff($arrA, $arrB);

since the key are preserved, arrC is no longer indexed from 0. Well, in most 
cases I don't care about the key if it's just indexed array. But since the 
key I preserved, I can no longer do

for($i=0; $icount($arrC);$i++)
  echo $arrC[$i];

if it happens that the returned indedex in array C 19, 20,25, for example. 
Any workaround?

Thanks.
Reuben D. Budiardja

-- 
PHP General 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]