php-general Digest 13 Sep 2004 00:56:09 -0000 Issue 2992

Topics (messages 196437 through 196460):

Re: ftp_nlist()
        196437 by: Jason Wong

Re: Very OT [PHP] CSS not picked up
        196438 by: raditha dissanayake

JDBC Driver for MySQL
        196439 by: Daniel Schierbeck
        196440 by: Manoj Nahar
        196445 by: Daniel Schierbeck

Re: create and read array
        196441 by: Alexander Kleshchevnikov

Outputting HTML with PHP - Buffer Problem?
        196442 by: Nick Wilson
        196443 by: John Holmes
        196444 by: Jason Davidson
        196446 by: dirk
        196447 by: M. Sokolewicz
        196448 by: raditha dissanayake
        196449 by: Nick Wilson
        196450 by: Nick Wilson
        196451 by: Nick Wilson

Re: Evaluating form posts
        196452 by: Alexander Kleshchevnikov

getting number of unique values out of array
        196453 by: Merlin
        196454 by: M. Sokolewicz

Re: how to load extensions outside the extension_dir
        196455 by: Marten Lehmann

I don't understand why !!!!
        196456 by: Nicolae Serban
        196458 by: Nicolae Serban
        196459 by: Alexander Kleshchevnikov

move_uploaded_file() access error
        196457 by: Mike
        196460 by: raditha dissanayake

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Sunday 12 September 2004 10:08, Karol Krizka wrote:

>     function get_files($dir="/") {
>       ftp_chdir($this->connection,$dir);
>       $array=ftp_nlist($this->connection,ftp_pwd($this->connection));
>       var_dump($array);
>     }

> When I connect to ftp server for my website at
> ftp://kkrizka.mybesthost.com and try to use nlist function, it returns
> false. But when I used ftp_rawlist, it returned a list of files no
> problem. I tried to connect to a ftp server on my computer, and it
> worked normally. I am not sure what is wrong...

Looks OK and works for me.

Not sure why you would want to chdir first. Why not just:

  function get_files($dir="/") {
    $array=ftp_nlist($this->connection,$dir);
    var_dump($array);
  }

Works just as well AFAICS.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The plot was designed in a light vein that somehow became varicose.
                -- David Lardner
*/

--- End Message ---
--- Begin Message ---
php guy wrote:

On Sat, 2004-09-11 at 22:36, Jeff Swanberg wrote:



Nope, I have them all. Any other ideas??? Do I need to load the style.css on every sub-page or just on the main page? Perhaps the style sheet is cached so, after I upload a new one, I need to do something to flush the cache?

js




Hi Jeff,

This is totally OT for a PHP list but I'll give you an answer.


if it's off topic please don't answer.

Lot's of off topic messages add to the traffic in the list and make it harder to keep track of on topic posts. Not the mention the waste of bandwidth.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

--- End Message ---
--- Begin Message --- I'm sorry if this is off-topic, but i figured this was the best place to ask:

I've begun using the Eclipse IDE, and has downloaded the Quantum DB
plugin. It says that i need a JDBC driver in order to connect to a
remote MySQL database - where do i get that? I've looked at mysql.com,
but i couldn't find anything (i might just be stupid ;)).

Hope some of you know :)

PS. And thanks to the guy that recommended Eclipse in this list - it rocks!


Daniel Schierbeck

--- End Message ---
--- Begin Message ---
see this link

http://dev.mysql.com/downloads/connector/j/3.0.html

official mysql jdbc driver. 

PS. Give google a chance.

On Sun, 12 Sep 2004 15:52:12 +0200, Daniel Schierbeck <[EMAIL PROTECTED]> wrote:
> I'm sorry if this is off-topic, but i figured this was the best place to
> ask:
> 
> I've begun using the Eclipse IDE, and has downloaded the Quantum DB
> plugin. It says that i need a JDBC driver in order to connect to a
> remote MySQL database - where do i get that? I've looked at mysql.com,
> but i couldn't find anything (i might just be stupid ;)).
> 
> Hope some of you know :)
> 
> PS. And thanks to the guy that recommended Eclipse in this list - it rocks!
> 
> Daniel Schierbeck
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message --- Manoj Nahar wrote:
see this link

http://dev.mysql.com/downloads/connector/j/3.0.html

official mysql jdbc driver.

PS. Give google a chance.

On Sun, 12 Sep 2004 15:52:12 +0200, Daniel Schierbeck <[EMAIL PROTECTED]> wrote:

I'm sorry if this is off-topic, but i figured this was the best place to
ask:

I've begun using the Eclipse IDE, and has downloaded the Quantum DB
plugin. It says that i need a JDBC driver in order to connect to a
remote MySQL database - where do i get that? I've looked at mysql.com,
but i couldn't find anything (i might just be stupid ;)).

Hope some of you know :)

PS. And thanks to the guy that recommended Eclipse in this list - it rocks!

Daniel Schierbeck

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


You're my savior!


Daniel Schierbeck

--- End Message ---
--- Begin Message ---
Yeah, thanks. Good idea!
It is good to code that:

$authors = array();
while ($authors[] = mysql_fetch_assoc($news));


"Chris Martin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

> Alexander Kleshchevnikov wrote:
> > Maybe you want this:
> >
> > while ($data = mysql_fetch_assoc($news)) {
> >     $sql += "INSERT INTO newtable VALUES ($data['AUS'],
$data['id']);\r\n";
> > }
> >
> > If you nevertheless want save the data in array you can use a
> > two-dimensional array $authors:
> >
> > $authors = array();
> > while ($data = mysql_fetch_assoc($news)) {
> >     $authors[] = array('AUS' => $data['AUS'], 'id' => $data[id]);
> > }
> >
> > ..
> >
> > foreach ($author in $authors) {
> >     $sql += "INSERT INTO newtable VALUES ($author['AUS'],
> > $author['id']);\r\n";
> > }
> >
> > --
> > Seigo
> > www.geocities.com/seigo_ua/
>
>
> Just a note to help the learning process. Either mysql_fetch_assoc() and
> mysql_fetch_array() will return your result in an array, so you don't
> need to actually create one.
>
> --
> Chris Martin
> Web Developer
> Open Source & Web Standards Advocate
> http://www.chriscodes.com/

--- End Message ---
--- Begin Message ---
Hi all, 

Say i have a php script like this:

<?php
  print(html_head());
  // do loads of time taking stuff
  print(html_footer());
?>

How come I dont see the html header (it's just a function that returns a
string with the html up till <body>) before the entire script has run?

This goes against my understanding, why might this be and what might i
use to get some output before the script has finished executing?

Much thanks...
-- 
Nick W

--- End Message ---
--- Begin Message ---
Nick Wilson wrote:

Say i have a php script like this:

<?php
  print(html_head());
  // do loads of time taking stuff
  print(html_footer());
?>

How come I dont see the html header (it's just a function that returns a
string with the html up till <body>) before the entire script has run?

This goes against my understanding, why might this be and what might i
use to get some output before the script has finished executing?

Could be your web server buffering the output until the script finishes or something else on your connection doing the same. Some web browsers will not show content until everything is received. You could try using flush() to see if that helps.


--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
There is nothing wrong with what your doing, i use this sort of thing
for all the big sites i make, i use a page class and use methods to
create the header and footer, so your concept is good.  I would
investigate your html_head() function, to make sure its actually
returning something.  Sinse your 'print'ing it, it must return some
text.....
example
function html_head() {
 $html = "<html....................................";

  return $html;
}

i prefer to escape from php inside my header fucntion, and just not
print it.. 
eg. 
function header() {
<?
<html
<head
   <title........
?>
}

then i call it with $page->header();

hope that helps....?

Jason

Nick Wilson <[EMAIL PROTECTED]> wrote: 
> 
> Hi all, 
> 
> Say i have a php script like this:
> 
> <?php
>   print(html_head());
>   // do loads of time taking stuff
>   print(html_footer());
> ?>
> 
> How come I dont see the html header (it's just a function that returns a
> string with the html up till <body>) before the entire script has run?
> 
> This goes against my understanding, why might this be and what might i
> use to get some output before the script has finished executing?
> 
> Much thanks...
> -- 
> Nick W
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Well, there is a difference between

> function html_head() {
> $html = "<html....................................";
> 
>  return $html;
> }

 and

> function header() {
> <?
> <html
> <head
>   <title........
> ?>
> }

The first function you need to call using <? echo header(); ?> to see the output
THe second function is not a real function because it has no return
statement. In german you call this "Prozedur". Don't know if it's the
same as procedure in english. But you will call this piece <?
header(); ?> to see some output.

Dirk

--- End Message ---
--- Begin Message --- Nick Wilson wrote:
Hi all,

Say i have a php script like this:

<?php
  print(html_head());
  // do loads of time taking stuff
  print(html_footer());
?>

How come I dont see the html header (it's just a function that returns a
string with the html up till <body>) before the entire script has run?

This goes against my understanding, why might this be and what might i
use to get some output before the script has finished executing?

Much thanks...
that's because it's all sent as 1 single big chunk of data. To get around this, you should set implicit_flush to 1 (it's in php.ini). Otherwise, you can also use the PHP ob_implicit_flush() to do this. Setting it to 1 will flush the output buffer everytime it's written to, if set to 0 it will do as normal, and buffer it all to send it together.
--- End Message ---
--- Begin Message ---
dirk wrote:

The first function you need to call using <? echo header(); ?> to see the output
THe second function is not a real function because it has no return
statement. In german you call this "Prozedur". Don't know if it's the
same as procedure in english. But you will call this piece <?
header(); ?> to see some output.


The english word you are looking for is procedure. It is true that in some programming languages 'functions that do not return values' are called procedure but I don't think that practice is wide spread among PHP programmers.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

--- End Message ---
--- Begin Message ---
* and then Jason Davidson declared....
> i prefer to escape from php inside my header fucntion, and just not
> print it.. 
> eg. 
> function header() {
> <?
> <html
> <head
>    <title........
> ?>
> }

Yes, i remember now, thanks ;-)
I've been using Smarty (smarty.php.net) for so long now that i've
forgotten how this stuff works without it hehe...
This is a script for a few mates that dont have php knowledge, just raw
html output....

Thanks..

-- 
Nick W

--- End Message ---
--- Begin Message ---
* and then John Holmes declared....
> >How come I dont see the html header (it's just a function that returns a
> >string with the html up till <body>) before the entire script has run?
> >
> >This goes against my understanding, why might this be and what might i
> >use to get some output before the script has finished executing?
> 
> Could be your web server buffering the output until the script finishes 
> or something else on your connection doing the same. Some web browsers 
> will not show content until everything is received. You could try using 
> flush() to see if that helps.

Ok, that makes sense, i was fairly certain that i wasnt mistaken in
thinking it should woek the way i expected...

Cheers John,..

-- 
Nick W

--- End Message ---
--- Begin Message ---
* and then M. Sokolewicz declared....
> >How come I dont see the html header (it's just a function that returns a
> >string with the html up till <body>) before the entire script has run?
> >
> >This goes against my understanding, why might this be and what might i
> >use to get some output before the script has finished executing?
> >
> >Much thanks...
> that's because it's all sent as 1 single big chunk of data. To get 
> around this, you should set implicit_flush to 1 (it's in php.ini). 
> Otherwise, you can also use the PHP ob_implicit_flush() to do this. 
> Setting it to 1 will flush the output buffer everytime it's written to, 
> if set to 0 it will do as normal, and buffer it all to send it together.

ahhhhh... now that makes a lot of sense, ill check that out, much thx...


-- 
Nick W

--- End Message ---
--- Begin Message ---
You should chech for configuration of magic quotes gpc.
Use get_magic_quotes_gpc() function:

$foo = get_magic_quotes_gpc() ? stripslashes($_POST["foo"]) : $_POST["foo"])
;

Do it with all GET and POST variables.

--
Alexander.

"Php Mailing List Account" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello everyone,
>
> I had an apache server running with php 5. Now I installed unix on that pc
and apache and php 5.
> I am using some forms on web pages and get their values by writing
> $foo = $_POST["foo"];
> Since I 'upgraded' to unix i am getting a double backslash for each
backslash entered on the form
> and '\"' for every '"'.
> Could someone please tell me what's going on? Did I miss a part of the
FAQ?
> (The form looks like
> <form method="post">
> <input type="text" />
> <input type="submit" name="action" value="submit" />
> </form>
> )
>
> Thank you in advance

--- End Message ---
--- Begin Message ---
Hi there,

I am wondering how to count the number of unique values inside an array.

For example, there is an array named country and it containes 3 country names, where Germany is doubled. So I would like to know that there are 2 unique country names in the array.

Has anybody an idea how to achive that?

Thanx for any help on that,

Merlin
--- End Message ---
--- Begin Message --- Merlin wrote:
Hi there,

I am wondering how to count the number of unique values inside an array.

For example, there is an array named country and it containes 3 country names, where Germany is doubled. So I would like to know that there are 2 unique country names in the array.

Has anybody an idea how to achive that?

Thanx for any help on that,

Merlin
just use
count(array_unique($array));

--- End Message ---
--- Begin Message ---
Hello,

You can't,
It's a security thing.

this doesn't make sense. When PHP is running as CGI, everyone can put it's own php.ini in the same directory as the PHP-script. This will overwrite all settings of the main php.ini. This works as described, but I don't want to put my own php.ini for that, because changes in the master php.ini will not affect my local one, and the changes in the master file might be important.


Regards
Marten

--- End Message ---
--- Begin Message ---
I just install the PHP 5 !

This is the code
<?php

$link=mysql_connect("localhost","root","1234");

mysql_close($link);
?>

and this is the error messege WHY !!!????


Fatal error: Call to undefined function mysql_connect() in
C:\Apache\Apache2\htdocs\ttt.php on line 3

Thanks

--- End Message ---
--- Begin Message ---
---------- Forwarded message ----------
From: Nicolae Serban <[EMAIL PROTECTED]>
Date: Mon, 13 Sep 2004 01:58:38 +0300
Subject: [PHP] I don't understand why !!!!
To: [EMAIL PROTECTED]

I just install the PHP 5 !

This is the code
<?php

$link=mysql_connect("localhost","root","1234");

mysql_close($link);
?>

and this is the error messege WHY !!!????

Fatal error: Call to undefined function mysql_connect() in
C:\Apache\Apache2\htdocs\ttt.php on line 3

Thanks

--- End Message ---
--- Begin Message ---
http://www.php.net/manual/ru/faq.databases.php#faq.databases.mysql.php5

-------------------------------
Alexander Kleshchevnikov,
DirectEDI Developer
email:    [EMAIL PROTECTED]
icq:       153617972
-------------------------------

"Nicolae Serban" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I just install the PHP 5 !
>
> This is the code
> <?php
>
> $link=mysql_connect("localhost","root","1234");
>
> mysql_close($link);
> ?>
>
> and this is the error messege WHY !!!????
>
>
> Fatal error: Call to undefined function mysql_connect() in
> C:\Apache\Apache2\htdocs\ttt.php on line 3
>
> Thanks

--- End Message ---
--- Begin Message ---
hi, there!
I have a script that basically tries to upload a file to the server. But when the 
move_uploaded_function is called, it returns these errors:

Warning: move_uploaded_file(../Main/ImgStiri/ceva.jpg): failed to open stream: 
Permission denied in /home/gotech/public_html/Nou/functii.php on line 81

Warning: move_uploaded_file(): Unable to move '/tmp/phpQdW26l' to 
'../Main/ImgStiri/ceva.jpg' in /home/gotech/public_html/Nou/functii.php on line 81

(Quick note: I'm a newbie to linux and apache, the sever that my host is running. I 
know I'm an idiot for using Windows and IIS locally fot testing, I'll switch as soon 
as possible. But the important thing is that it works on IIS). The code is as follows:

function HandleImage($name, $caleDest) {
 if((isset($_FILES[$name]['tmp_name'])) && ($_FILES[$name]['tmp_name'] != '')) {
  $caletmp = $_FILES[$name]['tmp_name'];
  $numeFis = basename($_FILES[$name]['name']);
  return MutaFisier($caletmp, $caleDest, $numeFis);
 }
 else return '';
}

function MutaFisier($caletmp, $calenoua, $numeFis) {
 chmod($caletmp,0777); //tried to grant full access to the temporary folder, but it 
proved useless - i also tried the same on the destination folder, and php issued an 
error
 $fisiernou = $calenoua.$numeFis;
 if(!file_exists($fisiernou))
  move_uploaded_file($caletmp, $fisiernou); //the error occurs here
// other stuff
}

So, if you could tell me what the difference is between IIS and apache concerning file 
uploads, i'd be grateful. Or tell me what I'm doing wrong - because i'm kind of 
stuck...
Thanks a million. Mike

--- End Message ---
--- Begin Message ---
Mike wrote:

hi, there!
I have a script that basically tries to upload a file to the server. But when the 
move_uploaded_function is called, it returns these errors:

Warning: move_uploaded_file(../Main/ImgStiri/ceva.jpg): failed to open stream: Permission denied in /home/gotech/public_html/Nou/functii.php on line 81


The webserver user does not have permission to writeo to this directory. before you execute this script use your ftp client to set the correct permissions on the folder. You can start with 777 and go to a more restrictive permission later on if when things are going on smoothly.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

--- End Message ---

Reply via email to