Re: [PHP] Brandon Rampersad wants to chat

2010-05-21 Thread Jochen Schultz

You are inviting the whole general list at once?

Powerful spam protection doesn't work for outgoing mails?


Brandon Rampersad schrieb:

---

Brandon Rampersad wants to stay in better touch using some of Google's
coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-b89a7a894d-04fb7fdbad-NeHRsydO6kBsIkVOT8hXbjPA1ZU
You'll need to click this link to be able to chat with Brandon Rampersad.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with Brandon Rampersad, visit:
http://mail.google.com/mail/a-b89a7a894d-04fb7fdbad-NeHRsydO6kBsIkVOT8hXbjPA1ZU

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into conversations
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] how to check for bandwidth limitations when uploading files?

2010-05-05 Thread Jochen Schultz

OS?

Robert P. J. Day schrieb:
  probably not really a PHP question but i'll take a chance, anyway.  i 
want to examine the network throughput i can get when continually 
uploading files from a PHP script via a POST request using the 
HTTP_Request2 class.


  i have a client-side script that simply takes files, creates a short 
POST request, and submits it to a server-side PHP script that takes the 
uploaded file and saves it.  no big deal.


  as a test, i created a random 5M file, then looped 100 times 
submitting the same file, and timed it.  while the system and user time 
was only a few seconds total, real (clock on the wall) time was 2.5 
minutes.  this suggests that the bottleneck is simply network transfer 
speed.


  while i'm doing these uploads, is there a way to monitor network 
throughput?  if this is truly the bottleneck, the only real solution 
will be to pay a premium for faster network access, i suppose.  but i'd 
just like to be able to produce some numbers or evidence that that's the 
actual problem.  thoughts?


rday




--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-03 Thread Jochen Schultz

 [snip]
And unless we are adding a multiple seconds to the load time is anyone 
going to notice a difference of 1 second? 


yes


regards
Jochen

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



Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Jochen Schultz

Like this?

$color[0] = 'red';
$color[1] = 'blue';

for ($i=0;foo;$i++) {
echo 'tr style:background-color:'.$color[$i%2]...

regards
Jochen


Jay Blanchard schrieb:

[snip]

Before your table;

$trColor = 0;

Then during the loop;

while(foo){
$tr = (0 == $trColor % 2)? #E8E8E8 : #FF;
echo tr style=\background-color:.$tr.\;
...

Replace the hex values with the colors you desire.


Just one more question about this.

I'm getting something like this[0], and I would like to get something
like this[1] using something similar to Jay's suggestion.
[/snip]

My suggestion should produce the results you desire. Can you post your
current code?



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] web sniffer

2010-03-19 Thread Jochen Schultz
Btw., when you use file_get_contets, is there a good way to tell the 
script to stop recieving the file after let's say 2 seconds - just in 
case the server is not reachable - to avoid using fsockopen?


regards
Jochen

madunix schrieb:

okay ..it works now i use
?php
$data=file_get_contents(http://www.my.com;);
echo $data;
?

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com wrote:

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan a...@ashleysheridan.co.uk
wrote:

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

 I've been trying to read the contents from a particular URL
into a
 string in PHP, and can't get it to work.  any help.

 Thanks

 --
 If there is a way, I will find one...***
 If there is none, I will make one...***
  madunix  **





How have you been trying to do it so far?

There are a couple of ways. file_get_contents() and fopen()
will work on URL's if the right ports are open.

Most usually though cURL is used for this sort of thing.

Thanks,
Ash
http://www.ashleysheridan.co.uk







--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **



I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

Thanks,
Ash
http://www.ashleysheridan.co.uk



I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com







--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] web sniffer

2010-03-19 Thread Jochen Schultz

Maybe this code may help you getting into it?

?php

class simpleHttpSocket {

  public function 
sendHttpRequest($host,$filename,$port=80,$timeout=1,$x=0,$result=array()) {

$header  = 'GET /'.$filename.' HTTP/1.1'.PHP_EOL;
$header .= 'Host: '.$host.PHP_EOL;
$header .= 'Connection: close'.PHP_EOL;
$header .= 'User-Agent: Simple(php-general@lists.php.net)'.PHP_EOL;
$header .= Referer: http://test-server.tld/.PHP_EOL.PHP_EOL;
$sock...@fsockopen($host, $port, $errno, $errstr, $timeout);
$result[-1]='';
if (!$socket){
  trigger_error('Connection timeout',E_USER_NOTICE);
  $result[errno]  = $errno;
  $result[errstr] = $errstr;
  return $result;
}
fputs($socket, $header);
while (!feof($socket)) {
  $result[$x++] = fgets($socket, 128);
  if (preg_match('/^Location:/',$result[$x-1])) {
return $result[$x-1];
  }
  flush();
}
return $result;
  }
}

$post = new simpleHttpSocket;
$host = 'www.example.com';
$filename = '';  // leave empty for index file or else:
// $filename = 'image.jpg';
$file = $post-sendHttpRequest($host,$header,80,2);

// Output
while(list($k,$v)=each($file)) {
  echo $v.'br/';
}

?

regards
Jochen

madunix schrieb:

can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).

Thanks

On Fri, Mar 19, 2010 at 9:53 AM, Jochen Schultz jschu...@sportimport.de wrote:

Btw., when you use file_get_contets, is there a good way to tell the script
to stop recieving the file after let's say 2 seconds - just in case the
server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:

okay ..it works now i use
?php
$data=file_get_contents(http://www.my.com;);
echo $data;
?

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com
wrote:

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
a...@ashleysheridan.co.uk
wrote:

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


   On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

I've been trying to read the contents from a particular URL
into a
string in PHP, and can't get it to work.  any help.
   
Thanks
   
--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **
   




   How have you been trying to do it so far?

   There are a couple of ways. file_get_contents() and fopen()
   will work on URL's if the right ports are open.

   Most usually though cURL is used for this sort of thing.

   Thanks,
   Ash
   http://www.ashleysheridan.co.uk







--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **



I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

Thanks,
Ash
http://www.ashleysheridan.co.uk



I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com





--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann







--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] web sniffer

2010-03-19 Thread Jochen Schultz

Thanks alot!

regards
Jochen

Peter Lind schrieb:

You should be able to do that by setting context options:
http://www.php.net/manual/en/context.http.php

On 19 March 2010 08:53, Jochen Schultz jschu...@sportimport.de wrote:

Btw., when you use file_get_contets, is there a good way to tell the script
to stop recieving the file after let's say 2 seconds - just in case the
server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:

okay ..it works now i use
?php
$data=file_get_contents(http://www.my.com;);
echo $data;
?

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com
wrote:

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
a...@ashleysheridan.co.uk
wrote:

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


   On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

I've been trying to read the contents from a particular URL
into a
string in PHP, and can't get it to work.  any help.
   
Thanks
   
--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **
   




   How have you been trying to do it so far?

   There are a couple of ways. file_get_contents() and fopen()
   will work on URL's if the right ports are open.

   Most usually though cURL is used for this sort of thing.

   Thanks,
   Ash
   http://www.ashleysheridan.co.uk







--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **



I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

Thanks,
Ash
http://www.ashleysheridan.co.uk



I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com





--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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








--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-18 Thread Jochen Schultz

 Microsoft managed to basterdise this format
 a bit as well, and lets you use tabs, spaces and all sorts of other
 characters to delimit data fields. Someone obviously didn't mention to
 them that the file type is 'comma separated values'!

Or maybe it is because someone told them, that there is data out there, 
that might contain commas?


regards
Jochen

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



Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-18 Thread Jochen Schultz
AFAIK, there is no real standard out there for CSV file definition and 
since Microsoft and many others (me too btw) use other chars for field 
separation in so called CSV files, i think it is a good way to deal with 
it and let it be how it is (actually i have to look into every CSV file 
that is going to be exchanged and that has some advantages as well).


Btw. who told you to use tripple quotes?

http://www.rfc-editor.org/rfc/rfc4180.txt

   7.  If double-quotes are used to enclose fields, then a double-quote
   appearing inside a field must be escaped by preceding it with
   another double quote.  For example:

   aaa,bbb,ccc

regards
Jochen

Ashley Sheridan schrieb:

On Thu, 2010-03-18 at 12:56 +0100, Jochen Schultz wrote:

 Microsoft managed to basterdise this format
  a bit as well, and lets you use tabs, spaces and all sorts of other
  characters to delimit data fields. Someone obviously didn't mention to
  them that the file type is 'comma separated values'!

Or maybe it is because someone told them, that there is data out there, 
that might contain commas?


regards
Jochen


The csv format allows for quote marks which can serve to escape commas:

data, with commas

And for escaping quote marks, you just use triple quote marks:

some text with quotes 

Thanks,
Ash
http://www.ashleysheridan.co.uk





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



Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-16 Thread Jochen Schultz

Or maybe you want to check out this:

http://www.codeplex.com/PHPExcel

I havn't checked it out for your special purpose but i found it useful 
for some other jobs (especially excell 2007 support).


regards
Jochen

Ashley Sheridan schrieb:

On Tue, 2010-03-16 at 20:16 +0800, I am on the top of the world!
Borlange University wrote:


i have a problem of reading values from excel file via
spreadsheet_excel_reader which is a php class used to manipulate excel
files.

$data = new Spreadsheet_Excel_Reader();
$data-setOutputEncoding('CP936');
$data-read(d:\\tmp.xls);
$rows=$data-sheets[0]['numRows'];
$cell = $data-sheets[0]['cells'][1][1];

if i type many rows,say 1000, in the tmp.xls, it can read, $rows shows 1000,
however, 1000 rows of data are copied from another excel file and these
cells may have different background or other changes that differ from normal
cells, it fails to read.the variable $rows shows nothingwhat i can do
now is to split these data into small groups, small enough to be read, it
really takes plenty of time.


i dont know why, has somebody met this problem ever?



If it's just the data you need, try using a csv file instead. The Excel
format is closed, and as such, the PHP classes won't have full support
for all of it's features. It seems like formatting is causing the data
to be written to the spreadsheet differently maybe.

Thanks,
Ash
http://www.ashleysheridan.co.uk





--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] Re: Anyone good with multiple SSL on Apache?

2010-03-10 Thread Jochen Schultz

Thanks Per,

well here is a short translation of this article:
http://www.tech-nerds.de/blog/2009/02/apache2-mit-mehreren-ssl-virtualhosts/

If you havn't installed apache2-threaded-dev:
You need the current verion of gnutls (download from gnu.org)
Download, unpack, compile and install as usual. Than call ldconfig.
And than install apache2-threaded-dev:
./configure --with.apxs2=/usr/bin/apxs2
make install
(Which copies apache module (hopefully) to this path: 
/usr/lib/apache2/modules)


Than create /etc/apache2/mods-enabled/gnutls.load with following entry:

LoadModule gnutls_module /usr/lib/apache2/modules/mod_gnutls.so

And you have to Create /etc/apache2/mods-enabled/gnutls.conf containing 
the following:


IfModule gnutls_module
GnuTLSCache dbm /var/cache/mod_gnutls_cache
GnuTLSCacheTimeout 300
/IfModule

Well and than every vhost that has to use SSL needs an entry like this:

VirtualHost 192.168.1.250:443
ServerName www.example.de
GnuTLSEnable on
GnuTLSPriorities NORMAL
GnuTLSCertificateFile /etc/certs/example_server.pem
GnuTLSKeyFile /etc/certs/example_key.pem
DocumentRoot /var/www/example.de
...
/DocumentRoot

regards

Jochen Schultz

P.S. I think i will have to give it a try right now.

Per Jessen schrieb:

Jochen Schultz wrote:


AFAIK Apache 2 doesn't support virtual hosts for SSL.



I think it does now - there was even a c't article on the topic not long
ago.  I'll see if I can find it.


/Per



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] Re: Anyone good with multiple SSL on Apache?

2010-03-09 Thread Jochen Schultz

AFAIK Apache 2 doesn't support virtual hosts for SSL.

But you may use one cert per socket, e.g it is possible to set one cert 
up on port 447 and one on 8080.


https://example1.com
https://example2.com:8080

regards

Jochen Schultz

Manuel Lemos schrieb:

Hello,

on 03/08/2010 07:13 PM Skip Evans said the following:

Hey all,

I have an Apache virtual config running a bunch of sites, one with SSL.
I finally have a need to add SSL to one more, but when I do the first
one (which is further down the file) comes up untrusted.

Since this is pretty far off topic I'd be obliged if someone who has
configured this before can email me off list for some assistance.


AFAIK, you need to have a different certificate per domain, although
there are certificates that can be used for all domains.



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] Want to learn to work with Zend Framework?

2010-03-05 Thread Jochen Schultz

  and not drugs, money or sex!

So everyone should post their ads here, which are related to PHP?

I think not.

regards
Jochen



Ashley Sheridan schrieb:

On Fri, 2010-03-05 at 08:11 +0100, Jochen Schultz wrote:

Spam!

Daniel Brown schrieb:
 On Thu, Mar 4, 2010 at 14:59, mrfroasty mrfroa...@gmail.com 
mailto:mrfroa...@gmail.com wrote:
 Looks expensive, definately NO
 
 Then do not reply.  It was an offer to the community at large, not

 just you and the other top-poster.  ;-P
 


--
  Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
  Industriestrasse 39 - HRB 1202900-
  26188 Edewecht  - GF: Michael Müllmann



If it's spam, it's the first I've seen that actually has something to do 
with PHP and not drugs, money or sex!


Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Want to learn to work with Zend Framework?

2010-03-05 Thread Jochen Schultz
Sure Zend is one of the most valuables, if not the most valuable, 
companies in the PHP community.


But if we allow ads here, we should think about selling them (like 
footer ads in all messages of the list). This way the community gets 
income, which can be used to support the community, while the community 
stays free from some companies decissions.


Or just keep Ads out of here...no exceptions!

just my 2 cents


Lester Caine schrieb:

Jochen Schultz wrote:

   and not drugs, money or sex!

So everyone should post their ads here, which are related to PHP?

I think not.


As someone who gets totally pigged off with the amount of 'advertising' 
that gets rammed down our throats, I should probably agree. But in this 
particular case, while I may not like it, Zend are one of the major 
supporters of PHP and actually need to make money to continue that support.


Now if someone wants to advertise alternative courses using Eclipse and 
PHPEclipse ... 1000EUR does seem somewhat steep ;)




--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] Want to learn to work with Zend Framework?

2010-03-04 Thread Jochen Schultz

Spam!

Daniel Brown schrieb:

On Thu, Mar 4, 2010 at 14:59, mrfroasty mrfroa...@gmail.com wrote:

Looks expensive, definately NO


Then do not reply.  It was an offer to the community at large, not
just you and the other top-poster.  ;-P



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

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



Re: [PHP] Strange MySQL Problem

2009-12-14 Thread Jochen Schultz

Hello Parham,

i think you should change this:

$sql = INSERT INTO BOOK(bookname, authorsname, ISBN) VALUES
 ('$_POST[bookname]', '$_POST[authorsname]', $_POST[ISBN]');

to this:

$sql = INSERT INTO BOOK(bookname, authorsname, ISBN) VALUES
('.$_POST[bookname].', '.$_POST[authorsname].', '.$_POST[ISBN].');


best regards
Jochen


Parham Doustdar schrieb:

Hello there,
Here's a short PHP script a friend has written, and given to me to test.
However, I am getting a MySQL error saying that the syntax error, on the
line that contains mysql_connect(); is wrong, near '')'
(note that it is not a PHP error, but a MySQL error.)
Here's the code:

[code]
?php
$username = root;
$password = abc;
$con = mysql_connect(, $username, $password);
mysql_select_db (test, $con);
$sql = INSERT INTO BOOK(bookname, authorsname, ISBN) VALUES
('$_POST[bookname]', '$_POST[authorsname]', $_POST[ISBN]');
if (!mysql_query($sql, $con))
 {
die( 'error: ' . mysql_error());
  }
echo 1 record added;
mysql_close($con)
?
[/code]






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



[PHP] fsockopen(); Connection closed, when an endless loop triggers maxexecutiontime before fclose()?

2003-01-29 Thread jochen schultz
Hi,

i used the function fsockopen() in a script and produced an endless loop with an 
output of error messages,
when i tried to evaluate the returnvalues of a request.

What happens to the open socketconnection now?
What happens to the loop, does it stop after 30 seconds time_limit
or does the server possibly have another timelimitation, cause of the output and 
flush() used inside the loop?


tia,

Jochen Schultz


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




Re: [PHP] Active Page

2002-08-22 Thread jochen schultz

Hello,

Another possibility might be to open a persistent http connection so the update would 
be in realtime instead of intervals of x seconds and with a cronjob it might as well 
be periodically *g*
search for fsockopen() or 'persistant http conection'

I can confirm Yamins answer also as a much easier way, as long as you are not trying 
to make a _good_ phpchat.

greetz Jochen

P.S. This is my first post in this mailinglist :)


*** REPLY SEPARATOR  ***

On 22.08.02 at 15:44 Yamin Prabudy wrote:

your pages should be dynamic, meaning every time user open your page it
keep
on getting data from table
how about using the Meta tags from html it will refresh you page in x
seconds
(define x as you need)

meta http-equiv=refresh content=x

On Thursday 22 August 2002 02:01 pm, Budi Kelana wrote:
 Hi,

 I want to make a web page that can retrive data from my tables
 automatically, periodically.
 Does PHP have some timer control ?
 I know we can do with JavaScript (setInterval() or setTimeOut()) but I
 cann't  join java script with PHP.

 I've tried make simple script with JavaScript to open new window that
 contain PHP script for show current time every 5 seconds.

 function showData() {
   newWindow = Window.open('data.php','screen');
 }

 function loadData() {
   setInterval('showData()','5000')
 }

 data.php :

 ?
   echo date(l dS of F Y h:i:s A);
 ?

 in result, data.php will reload every 5 seconds, but it doesn't change.

 Can someone help me and give me suggestion ?

 TIA

 regards,

 Budi Kelana

---


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




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




[PHP] OOP / dynamic SQL class

2002-08-22 Thread jochen schultz


Hi again,

i got a question concerning OOP, would be nice if anyone could help.

I am trying to build a class that builds SQL statements dynamically like i send 
tablenames, fieldnames, etc and it should build select, insert, update... statements.
e.g. i have a table PERS_DATA with following structur :

ID | FIRSTNAME varchar(40) | LASTNAME varchar(40) | REGISTRATION date | AGE int (5)
(sure it makes no sence to save the age but it´s an example)

Now i want to save postdata of a registerform in this table and it should work like 
this :

$query_obj = new sql_class('insert','PERS_DATA',$postvars);
$db_obj = new db_class();
$db_obj - query ($query_obj - sql);

sql_class should instance a check_persdat_postvars_class that sends me a predefined 
error in case the entries of the form where wrong (age not numeric for example)

Now the sql class would have to build a insertstatement like this :

$fields = ;
$vals   = ;
$i=0;
while ( list ( $key,$val ) = each ( $param_arr ) )
{
  if (!empty($i))
  {
$fields  .= ',';
$vals.= ',';
  }
  $fields  .= $key;
  $vals.= $val;
  $i++;
}
$this - SQL = insert into $table ($fields) values ($vals);

but elements of $vals 'can' be strings and some can be numeric...

Do you think it´s a good idea to make queries to find out about fieldtypes as i need 
that info to set quotes for the string entries?
Or do you think i should predefine it instead in the class that checks the postvars?

Or do you think i have a absolute stupid idea?

Tia

regards

Jochen





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




Re: [PHP] in_array()

2002-08-22 Thread jochen schultz


Hi Riccardo,

if(mysql_num_rows($rty-resu))  { //result
$rec = mysql_fetch_array($rty-resu);
 if(!isset($_SESSION[bkmks]) ||

When you save something for the first time, the element of $_SESSION[bkmks] is a 
string and you can compare the array $rec with this string.
!in_array($rec, $_SESSION[bkmks])) {

Than you convert the element into an array
$_SESSION[bkmks][] = $rec;

and AFAIK in_array() can´t compare two arrays, correct me if i am wrong...


Greetings

Jochen




*** REPLY SEPARATOR  ***

On 22.08.02 at 12:06 Riccardo Sepe wrote:

Hi every1 I got this script that works fine on my local windows pc but
on the remote server (FreeBSD)
I get this message:

Warning: Wrong datatype for first argument in call to in_array in
/usr/local/..

the script should bookmark an user choice storing it in the
$_SESSION[bkmks] array.
this is the code:
$rty-mark($id,$tab);   // call to the method
that perform a standard query on the db
if(mysql_num_rows($rty-resu))  { //result
$rec = mysql_fetch_array($rty-resu);
 if(!isset($_SESSION[bkmks]) ||
!in_array($rec, $_SESSION[bkmks])) {
$_SESSION[bkmks][] = $rec;

when I store for the first time no problem ... When I try to store
another item or the same item again
I got that awful error

thanks in advance !

Ricky





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




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