Re: [PHP-DB] Can i add mysql_array into a session?

2004-02-02 Thread Louie Miranda
Thats not how it should work. Data is being passed because it will be used
for something else;
eg: editing/update, delete of ONLY SELECTED data

Thats why, im wondering how to pass, from mysql_array to a $variable to
another page.

Btw, i already make it work. I catched all data using GET

like this:
a href=\p_edit.php?PUBLN= . $row['product_code'] . TITLE= . $title .
LANG= . $language . ISSUE= . $issue . CATEG= . $category . COST=
. $cost . \edit/a

Solved.

-- -
Louie Miranda
http://www.axishift.com


- Original Message -
From: Lars Jedinski [EMAIL PROTECTED]
To: 'Louie Miranda' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 02, 2004 2:28 PM
Subject: AW: [PHP-DB] Can i add mysql_array into a session?


There's no need to pass the data to the other page. As you
passed $PUBIN_NUM you can (re)load the data easily:

select ... where product_code=$PUBLIN_NUM

Lars Jedinski

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



[PHP-DB] Inserting date with prepared statement

2004-02-02 Thread Tan Ai Leen
Hi all,
I am using a PEAR DB prepared statement to insert date into mySQL.
I tried several methods but the timestamp inserted is the current time 
instead of the one I specified.
I have tried

FROM_UNIX_TIME('1076565656'),
date('YmdHis',1076565656);
20040130114049 ,
2004-01-30 11:40:49,
for mo_date
with
$sth = $db-prepare(INSERT INTO msg_log_mo_temp(mo_id, mo_operator, 
.mo_shortcode, mo_keyword, mo_message, mo_smobile, mo_date, mo_error) 
.  VALUES(?,?,?,?,?,?,?,?));
$db-executeMultiple($sth, $mo_success);

None of it work.
Does prepared statement support inserting date into a timestamp colume?
If it does, what is wrong with the above?
Thanks,
Ai Leen
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Mail Function

2004-02-02 Thread suomi hasler
Graeme McLaren wrote:
Evening all, I've written a script which sends emails, there is no problem
with that.  I was wondering how I can check for email bounces, anyone know
how to do that?
Cheers,

G :)
using php 4.3.3 i did the following observation:

using the php mail function i created multi-bodypart mail (doing 
eventual quoted-printable and/or bas64 encoding all myself).

but 1 % of all messages i sent through this interface was rejected by a 
server under-way, because of illegal characters in the header.
i did not find out which characters where illegal, but when i finally 
omitted to use the php mail-function and created the message string/file 
all myself and submitted it to sendmail (/usr/sbin/sendmail  mailfile 
), no header errors where detected any more.

suomi

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


[PHP-DB] From MySQL to EXCEL

2004-02-02 Thread Christine Clerc
Hi,
I need to turn data extracted from MySQL into an EXCEL spreadsheet 
(.xls, not a .txt that is imported into Excel).

Is it possible ?

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


RE: [PHP-DB] From MySQL to EXCEL

2004-02-02 Thread Griffiths, Daniel
theres an easy way if its a simple data table type spreadsheet your after, this works 
like a treat, at the top of your page that produces the data put - 

header(Content-Type: application/vnd.ms-excel);
header(Content-Disposition: attachment; filename=\file.xls\);

remember that your sending headers here so they have to be the very first thing to be 
sent at the start of the page.

formatting will be maintained and it will basically produce whatever the table / s 
looked like in the html page, just like if you did a copy and paste from the web to 
excel.



-Original Message-
From: Christine Clerc [mailto:[EMAIL PROTECTED]
Sent: 02 February 2004 10:03
To: PHP DB list
Subject: [PHP-DB] From MySQL to EXCEL


Hi,
I need to turn data extracted from MySQL into an EXCEL spreadsheet 
(.xls, not a .txt that is imported into Excel).

Is it possible ?

Thank you.
Christine

-- 
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] From MySQL to EXCEL

2004-02-02 Thread Ignatius Reilly
C'est possible!

I use the PEAR Spreadsheet_Excel_Writer for this purpose. Very nice.

HTH
Ignatius
_
- Original Message - 
From: Christine Clerc [EMAIL PROTECTED]
To: PHP DB list [EMAIL PROTECTED]
Sent: Monday, February 02, 2004 11:02
Subject: [PHP-DB] From MySQL to EXCEL


 Hi,
 I need to turn data extracted from MySQL into an EXCEL spreadsheet 
 (.xls, not a .txt that is imported into Excel).
 
 Is it possible ?
 
 Thank you.
 Christine
 
 -- 
 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] From MySQL to EXCEL

2004-02-02 Thread Nitin Mehta
use simple export command

select * into 'name.xls' from table name

It should help
Nitin

- Original Message - 
From: Christine Clerc [EMAIL PROTECTED]
To: PHP DB list [EMAIL PROTECTED]
Sent: Monday, February 02, 2004 3:32 PM
Subject: [PHP-DB] From MySQL to EXCEL


 Hi,
 I need to turn data extracted from MySQL into an EXCEL spreadsheet 
 (.xls, not a .txt that is imported into Excel).
 
 Is it possible ?
 
 Thank you.
 Christine
 
 -- 
 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-DB] mysql_connect problem

2004-02-02 Thread DiZEM PGC
I try connecting to an existing mysql DB. The first time I directly called
mysql_connect with all required
params (Path/Database,User,Password) and established a connection without
problems.
Second time I have used a script that includes a self-written class
containing a few Database functions.
One of these functions, named 'db_login', does exactly the same as
mysql_connect (w. the same params). First case (directly calling) works fine. The
second case doesn't report any error and doesn't establish a connection. 
What could be the reason for this strange behavior ?
DiZEM


-- 
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++

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



Re: [PHP-DB] mysql_connect problem

2004-02-02 Thread Miles Thompson
At 03:42 PM 2/2/2004 +0100, DiZEM PGC wrote:
I try connecting to an existing mysql DB. The first time I directly called
mysql_connect with all required
params (Path/Database,User,Password) and established a connection without
problems.
Second time I have used a script that includes a self-written class
containing a few Database functions.
One of these functions, named 'db_login', does exactly the same as
mysql_connect (w. the same params). First case (directly calling) works 
fine. The
second case doesn't report any error and doesn't establish a connection.
What could be the reason for this strange behavior ?
DiZEM
promo crap snipped

Echo the mysql_error and mysql_errno as found here:
http://www.php.ca/mysql_error
Also echo the connect string so you can see exactly what's being sent. I'd 
bet on a misplaced quotation mark.

Cheers - Miles

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


[PHP-DB] Mysql - Optimizing tables for search

2004-02-02 Thread Denzo
How do you optimize a table for search? And do you need to change anything
in the php (sql select) to reflect these changes? I heard of creating an
index or something, but can someone tell me how this works? Thanks.

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



[PHP-DB] Re: Mail Function

2004-02-02 Thread Denzo
see www.php.net/imap

Graeme McLaren [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
 Evening all, I've written a script which sends emails, there is no problem
 with that.  I was wondering how I can check for email bounces, anyone know
 how to do that?

 Cheers,

 G :)

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



Re: [PHP-DB] PHP and mail forms

2004-02-02 Thread -{ Rene Brehmer }-
I wrote mine specially ... it runs with a preview phase which was pretty
tricky to put in ... but the to-value is hardcoded in the script, cuz it
just sends mail to [EMAIL PROTECTED] ... when the user fills in the
form the script checks it for errors, and then either bounce back to the
form if there are any errors, or to the preview if there's not (atleast I
think I kept the preview in there, not sure anymore, been a long while) 
and then on to a thank you message 

I control it all using hidden form fields ... pretty simple ... it's coded
to my old site-structure, before I started to use templates ... so it's a
bit difficult to peel it out and show it to you though  but will try if
requested...

FWIW

Rene

Fate would have it, that on Fri, 30 Jan 2004 09:41:11 -, Ricardo Lopes
wrote:

There are several ways to do this.
Some people like the approach:

if ($submit) { send_email(); }

or you can put a hidden field in your form, like op:

input name=op type=hidden id=op value=send /

and use:

if (isset($HTTP_GET_VARS['op'])  ($HTTP_GET_VARS['op'] == 'send'))
{
send_email();
}

and there are many others.
by the way in the code you wrote you have:

form method=post .

and then you use:

$id=$_GET['id'];  ---  if this is the same than $HTTP_GET_VARS['id'] this
wont work


Where does that mail function (is it a function?)  go?

The function sends an email, for more details consult the php manual.

-- 
Rene Brehmer
aka Metalbunny

http://metalbunny.net/
References, tools, and other useful stuff...

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



[PHP-DB] Functions

2004-02-02 Thread Chris Payne
Hi there everyone,

I need to write a function (New to them but starting to get the hang of it) that will 
take the field from a form and then do operations on it (To remove bad characters, any 
entered mysql commands etc ) now that's not a problem, what I want to do though is 
write a generic function that will handle ALL the fields in any form.

For example, if I have 3 input boxes, name, address, email - I would like the function 
to recieve the data from each form string and do the operation and then send the info 
back keeping the same name and value that it arrived in.  I'm finding it hard to 
explain, but basically if a field is called email and it's value is [EMAIL PROTECTED] 
then the function needs to be able to automatically pickup that the incoming name is 
email and it's value it [EMAIL PROTECTED] then process it and output it again, and i'm 
confused how to do it.

I can do it if I specify the name of the form item coming in and going out, but since 
I want to make it generic I don't want a zillion different possible form names in the 
function :-)

Any help (If you can understand my rambling :-) would be greatly appreciated.

Regards

Chris


Re: [PHP-DB] Functions

2004-02-02 Thread Micah Stevens
Chis,

I think this might do what you want:

foreach ($_REQUEST as $key = $value) {
switch ($key) {
case email:
// do email stuff
break;
case address:
// do address stuff
break;
default:
// in case it's something you haven't planned for.. 
break;
}
}




On Mon February 2 2004 4:36 pm, Chris Payne wrote:
 Hi there everyone,

 I need to write a function (New to them but starting to get the hang of it)
 that will take the field from a form and then do operations on it (To
 remove bad characters, any entered mysql commands etc ) now that's not
 a problem, what I want to do though is write a generic function that will
 handle ALL the fields in any form.

 For example, if I have 3 input boxes, name, address, email - I would like
 the function to recieve the data from each form string and do the operation
 and then send the info back keeping the same name and value that it arrived
 in.  I'm finding it hard to explain, but basically if a field is called
 email and it's value is [EMAIL PROTECTED] then the function needs to be able to
 automatically pickup that the incoming name is email and it's value it
 [EMAIL PROTECTED] then process it and output it again, and i'm confused how to do
 it.

 I can do it if I specify the name of the form item coming in and going out,
 but since I want to make it generic I don't want a zillion different
 possible form names in the function :-)

 Any help (If you can understand my rambling :-) would be greatly
 appreciated.

 Regards

 Chris

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



Re: [PHP-DB] Functions

2004-02-02 Thread Jochem Maas
elaborating (?spelling) on Micahs loop:

funcs.php:
?
function sanitize($glob = null)
{
if (is_null($glob) || !is_array($$glob)) {
// set name of the global var we care about
// if no valid name was passed to the function
$glob = '_REQUEST';
}
// using a variable variable name: $$glob now refers to $_REQUEST
// assuming no arguments were passed to the function.
// doing this allows sanitizing just $_POST, $_GET or $_COOKIE
// in case
foreach ($$glob as $key = $value) {
// sanitize all incomings
$$glob[$key] = $santizedValue;
}
}
function validate($value, $type)
{
$isValid = false;
switch ($type) {
case 'email':
// if email is OK do $isValid = true;
break;
case 'address':
// check address
break;
default:
   // the fallback plan.
   // e.g.
   if (!empty($value)) {
   $isValid = true;
   }
   break;
}
return $isValid;
}
?
--endof funcs.php
test.php
?
require_once ('./funcs.php');

// clean and make safe our incoming values
sanitize('_POST');
$validationFields = array(
'myname'  = 'name',
'myemail' = 'email',
'myaddr'  = 'address',
);
// check to see if something was submitted
if(is_array($_POST)  count($_POST)) {
define('FORM_SUBMITTED', 1);
}
foreach($validationFields as $field = $type) {
// possibly we want to valid
if (defined('FORM_SUBMITTED')) {
// a form was posted...
if(!validate($_POST[ $field ], $type)) {
define('ERROR', 1);
break; // stop the loop
}
$$field = $_POST[ $field ];
} else {
$$field = '';
}   
}
if (defined('FORM_SUBMITTED')) {
if (!defined('ERROR')) {
// stick the data in a database or email them...
define('MSG', 'your data was excellently constructed!');
} else {
   // something bad happened
   define('MSG', 'something bad happened please check your data');
}
} else {
// something bad happened
define('MSG', 'welcome, please fill in this form');
}
?
html
body
h1My Form/h1
?=MSG;?
form method=post action=?=$_SERVER['PHPSELF'];?
*name: input name=myemail value=?=$myname;?/br /
*email: input name=myemail value=?=$myemail;?/br /
*address: input name=myemail value=?=$myaddr;?/br /
input type=submit value=submit /
/form
/body
/html
--endof test.php

Micah Stevens wrote:

Chis,

I think this might do what you want:

foreach ($_REQUEST as $key = $value) {
	switch ($key) {
		case email:
			// do email stuff
			break;
		case address:
			// do address stuff
			break;
		default:
			// in case it's something you haven't planned for.. 
			break;
	}
}
	
		

On Mon February 2 2004 4:36 pm, Chris Payne wrote:

Hi there everyone,

I need to write a function (New to them but starting to get the hang of it)
that will take the field from a form and then do operations on it (To
remove bad characters, any entered mysql commands etc ) now that's not
a problem, what I want to do though is write a generic function that will
handle ALL the fields in any form.
For example, if I have 3 input boxes, name, address, email - I would like
the function to recieve the data from each form string and do the operation
and then send the info back keeping the same name and value that it arrived
in.  I'm finding it hard to explain, but basically if a field is called
email and it's value is [EMAIL PROTECTED] then the function needs to be able to
automatically pickup that the incoming name is email and it's value it
[EMAIL PROTECTED] then process it and output it again, and i'm confused how to do
it.
I can do it if I specify the name of the form item coming in and going out,
but since I want to make it generic I don't want a zillion different
possible form names in the function :-)
Any help (If you can understand my rambling :-) would be greatly
appreciated.
Regards

Chris


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


Re: [PHP-DB] Functions

2004-02-02 Thread Denzo
Easier is using their value, eg

$email = email(replacement(functions($_POST['email']))); // or _GET
$address = address(replacement(functions($_POST['email'])));

...


Micah Stevens [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
 Chis,

 I think this might do what you want:

 foreach ($_REQUEST as $key = $value) {
 switch ($key) {
 case email:
 // do email stuff
 break;
 case address:
 // do address stuff
 break;
 default:
 // in case it's something you haven't planned for..
 break;
 }
 }




 On Mon February 2 2004 4:36 pm, Chris Payne wrote:
  Hi there everyone,
 
  I need to write a function (New to them but starting to get the hang of
it)
  that will take the field from a form and then do operations on it (To
  remove bad characters, any entered mysql commands etc ) now that's
not
  a problem, what I want to do though is write a generic function that
will
  handle ALL the fields in any form.
 
  For example, if I have 3 input boxes, name, address, email - I would
like
  the function to recieve the data from each form string and do the
operation
  and then send the info back keeping the same name and value that it
arrived
  in.  I'm finding it hard to explain, but basically if a field is called
  email and it's value is [EMAIL PROTECTED] then the function needs to be able to
  automatically pickup that the incoming name is email and it's value it
  [EMAIL PROTECTED] then process it and output it again, and i'm confused how to
do
  it.
 
  I can do it if I specify the name of the form item coming in and going
out,
  but since I want to make it generic I don't want a zillion different
  possible form names in the function :-)
 
  Any help (If you can understand my rambling :-) would be greatly
  appreciated.
 
  Regards
 
  Chris

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



Re: [PHP-DB] Re: [PHP] Oracle + PHP

2004-02-02 Thread Luis Moran Ochoa
Ok, thanks

I will try it.

Michael Mauch wrote:

Luis Moran Ochoa wrote:

 

ORACLE_SID=OWEB ;export ORACLE_SID; 
ORACLE_HOME=/usr/oracle/product;   export ORACLE_HOME;
TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN;
ORACLE_BASE=/usr/oracle; export ORACLE_BASE;
ORA_NLS33=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS33;
ORA_NLS=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS;
NLS_LANG=spanish_spain.we8dec; export NLS_LANG;
TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN;
CLASSPATH=:/usr/local/jre:/usr/oracle/product/jdbc/lib/classes111.zip: 
export CLASSPATH;
LD_LIBRARY_PATH=/usr/oracle/product/lib:/usr/oracle/product/jdbc/lib:
export LD_LIBRARY_PATH
   

Perhaps some variables are set in the start script, but not in your root
shell. Put a
 export /tmp/apache-start

in the start script to see which variables are set. Boot, move
/tmp/apache-start to /tmp/apache-boot, stop apache, start apache from
your root shell. diff -u /tmp/apache-boot /tmp/apache-start will show
the differences.
Or try to unset the locale variables in the start script:

unset LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL

Some parts of Apache/Oracle/whatever-else apparently has trouble with
locales.
Regards...
Michael
 

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