Re: [PHP-DB] help please... session - database

2001-08-23 Thread Andre P.

Try

$link = addslashed($HTTP_SESSION_VARS[HREF])
and then use $link in the sql insert

and..
stripslashes(query result)
when you retrieve the value and need to display it on the page.

hth
andre

brendan wrote:

 hello,
 i have hit a major stumbling block and am now getting really 
 frustrated.. if someone could point me in the right direction i would 
 really appreciate it..

 - i have a set of forms across a number of pages
 - the user enters data into each of the forms and these are placed in 
 a session variable
 - at the completion of form entry the session variables are supposed 
 to be passed to a mysql database
 - one of the variables is a URL for some reason the form entry the 
 data is encoded so that a full stop '.' is changed into an AT '@'
 - I have tried urlencoding and decoding the session, using str_replace 
 for the @ .. adding slashes
 - for some reason this just wont work ..
 ...

 help?
 ...


 i.e Adds form post to session
  if (is_array($HTTP_POST_VARS)) {
  while (list($var, $value) = each($HTTP_POST_VARS)) {
  session_register($var);
  $HTTP_SESSION_VARS[$var]=$value;

  }
 }


 i.e adds session to database (simplified so as to find problem)

 $title =stripslashes($HTTP_SESSION_VARS[title]);
 $href= $HTTP_SESSION_VARS[HREF];
 $fee =stripslashes($HTTP_SESSION_VARS[fee]);

  $result= mysql_query(INSERT INTO links (Title, Hyperlink,fee) VALUES 
 ('$title','$href','$fee')) or die(mysql_error());
   print $result;





-- 
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] Averaging Numbers

2001-08-15 Thread Andre P.

Maybe I am missing the complexity but I would just add them all up as 
you retrieve them (or where you are printing them out) and then when you 
finish the loop divide the total by the number of of number you are 
averaging over have (i.e this would be 15 if you are taking 15 days).

something like:

$sum = 0;
for  i=0 to i=15
{
$valueRetrieved = retrieve result of row i
$sum += $valueRetrieved
}
$average = $sum/15

hope this helps
andre

Jeff Oien wrote:

I'm having a hard time learning how to get an average. I have a database
that gets a number and inserts in into a MySQL database every 1/2 hour
during the day. For the current half hour, I want to get the last 15 days
numbers for the same time as the time it is now. I can retrieve and display
the numbers fine, I just don't know how to go about putting these all into
variables or an array or if I can do this within a query and then take an 
average for them. Hope that made sense. Thanks.
Jeff Oien




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




Re: [PHP-DB] How do I backup my MySQL database? asks a Newbie.

2001-06-21 Thread Andre P.

Install phpMyAdmin and this will give you a web interface to manage your 
DB. You can do a dump of your database using it.

Andre

Dan Eskildsen wrote:

***
NEWBIE ALERT!
***

I am only new at this, but I have discovered one thing: I love php and
mysql!

I now have a couple of tables of information in a MySQL database.  The site
is run by my ISP so I don't have control of the server.

My question is:  how do I via php/mysql make a backup of the entire database
so that I can restore it again should the worst happen and the server goes
down?

I would really appreciate your comments on this!

Dan


==
Regards from Denmark, Europe
Please cc your reply to [EMAIL PROTECTED]
==
I haven't lost my mind, I've got it backed up on TAPE somewhere...







-- 
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] raw file header in http

2001-06-21 Thread Andre P.

Try the following:

create a link to a script download.php which will read the file (from 
anywhere on the disk) and  send it to the user like this:

header(Content-Type: application/force-download);
header(Content-Length: .filesize($filename));
header(Content-Disposition: attachment; filename=.$orig_filename);
readfile($filename);
exit;

This should give him a download dialog box and set the filename in the 
dialog box to  $orig_filename.

hope this helps
ciao
andre.


schiarat@libero. wrote:

I' ve a file in a directory(/tmp) out from http root of web server.
I need to open a page that send this file when it is opened (es.: 
opening page.php under netscape it opens a request to save file to 
disk, but the file is out of www root), i think i t is possible using 
command header and a raw http command, but i aven't any idea if it is 
possible and if yes in what mode.
The system i use is apache 1.3.9 under redhat linux 7.1,
tank's
Omar






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