RE: [PHP] Keyword Constructor

2011-08-04 Thread cont...@global-web-designs.com
hello everyone. 

thanks for the email  re keyword constructor.  

but what exactly does it do?  i.e its function. 

warmest regards 

Andreea 

-Original Message-
From: Ren [mailto:lobbyjo...@gmail.com] 
Sent: 02 August 2011 06:29
To: php-general@lists.php.net
Subject: [PHP] Keyword Constructor

For a long time I wanted keyword parameters in PHP.  But thanks to newer 
features like traits and reflection classes I have come up with something that 
looks pretty close.

trait KeywordConstructor {
public function __construct($members) {
$class = new ReflectionClass($this);
$properties = $class-getProperties();

foreach ($properties as $p) {
$name = $p-getName();

if (isset($members[$name])) {
$this-$name = $members[$name];
}
}
}
}

 class User {
 use KeywordConstructor;
 private $name;
 private $age;
 }

$lobby = new User(['name' = 'Lobby', 'age' = 36]);

Right now this requires the trunk version of PHP to work.  I just wanted to 
share this in case anyone finds it interesting and/or useful.

--
ejmr
南無妙法蓮華經



--
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] dynamic navigation menu

2009-06-11 Thread web
Please can some one help me with a dynamic menu.

I have a 2 tables and I want to display the record from the first one as
parent  and the second one as the child.

My problem is when I query the data I can't place the child at their
appropriate position. 

Please you help will be appreciated. 



[PHP] databse query

2009-06-05 Thread web
Hello to all,

please i'm new PHP and trying to display some records from my db using
dreamweaver.

I have 2 tables ( Subjects and Pages) where Subjects is the parent and Pages
is the child.

I want to get all pages belonging to each subject but my query gives me all
pages under the first result of the query.

How can I get only pages of  each subject under it's own ID ( parent + it's
child)?

I'll include my code for better reference.

 

 

?php require_once('../../Connections/shop.php'); ?

?php

if (!function_exists(GetSQLValueString)) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = ,
$theNotDefinedValue = ) 

{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

 

  $theValue = function_exists(mysql_real_escape_string) ?
mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 

  switch ($theType) {

case text:

  $theValue = ($theValue != ) ? ' . $theValue . ' : NULL;

  break;

case long:

case int:

  $theValue = ($theValue != ) ? intval($theValue) : NULL;

  break;

case double:

  $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' :
NULL;

  break;

case date:

  $theValue = ($theValue != ) ? ' . $theValue . ' : NULL;

  break;

case defined:

  $theValue = ($theValue != ) ? $theDefinedValue :
$theNotDefinedValue;

  break;

  }

  return $theValue;

}

}

 

mysql_select_db($database_shop, $shop);

$query_menu_list = SELECT * FROM subjets;

$menu_list = mysql_query($query_menu_list, $shop) or die(mysql_error());

$row_menu_list = mysql_fetch_assoc($menu_list);

$totalRows_menu_list = mysql_num_rows($menu_list);

 

mysql_select_db($database_shop, $shop);

$query_pages = SELECT * FROM pages WHERE id_subject = id;

$pages = mysql_query($query_pages, $shop) or die(mysql_error());

$row_pages = mysql_fetch_assoc($pages);

$totalRows_pages = mysql_num_rows($pages);

?!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

html xmlns=http://www.w3.org/1999/xhtml;

head

meta http-equiv=Content-Type content=text/html; charset=utf-8 /

titlemenu_list/title

/head

 

body

?php while ($row_menu_list = mysql_fetch_assoc($menu_list)){

echo li{$row_menu_list['subget_name']}/li ;



while ($row_pages = mysql_fetch_assoc($pages)){

echo li{$row_pages['page_name']}/li;}

 

 }  ?

/body

/html

?php

mysql_free_result($menu_list);

 

mysql_free_result($pages);

?

 

The query gives this result:

 

*  informatica 

*  Dove Siamo 

*  Lorem 

*  web templates in vendita 

*  assistenza 

*  shop 

*  contatti



Re: [PHP] First stupid post of the year.

2008-01-04 Thread Web Design Company

Read google!

-
http://ooyes.net Web design company  |  http://ooyes.net Graphic design
company  |  http://ooyes.net Outsourcing company  
-- 
View this message in context: 
http://www.nabble.com/First-stupid-post-of-the-year.-tp14583639p14618938.html
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: Re: [PHP] automatic caller

2008-01-04 Thread Web Design Company

WOW

-
http://ooyes.net Web design company  |  http://ooyes.net Graphic design
company  |  http://ooyes.net Outsourcing company  
-- 
View this message in context: 
http://www.nabble.com/automatic-caller-tp14582211p14618945.html
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Login script problem

2008-01-04 Thread Web Design Company

Someone?

-
http://ooyes.net Web design company  |  http://ooyes.net Graphic design
company  |  http://ooyes.net Outsourcing company  
-- 
View this message in context: 
http://www.nabble.com/Login-script-problem-tp14618073p14618942.html
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] PHP5 Commercial Development

2007-02-06 Thread Keryx Web

Robert Cummings skrev:

I sincerely question the competence of someone who advocates a one size
fits all approach to programming. There are many reasons why a developer
may work with the old-school interface calls. For instance they may be
supporting an old school application. They might be writing their own
abstract layer. They might be optimizing an extremely loaded system
whereby explicitly using the API calls improves speed. Prepared
statements only improve speed when making multiple queries to the
database having the same format. They slow things down when making
unique queries. Any developer worth his salt doesn't need prepared
statements to improve security, and assuming prepared statements will
protect you is silly since they cannot protect against everything. A
professional knows when to use any given approach given the environment
and requirements.

Cheers,
Rob.


So I was perhaps a bit inflammatory in my post. But I do not see myself 
completely rebutted.


1. Maintaining legacy apps does not fall under the categories I was 
referring to. If you are bound by legacy constraints it is another ballgame.


2. In a short mail like this one there is not room to expand every 
minute detail. I do realise that PDO is not the best way to go for every 
app. But in saying that prepared statements is a really good way to 
protect against SQL-injection, I'm just echoing Ilia Alshanetsky 
(spelling?) and a few other rather renowned security experts. Of course 
one should always have a defense in depth, though.


3. Speed loss from prepared statements are usually negligible even for a 
single query. There are tests published on the net. And if one wants 
speed, one should probably consider a caching layer between PHP and ones 
DBMS. The OO-model in PHP 5 would make such multi tiered apps simpler to 
develop as well.


The question PHP 4 or PHP 5: If you stay with 4 you are bound to a one 
size fits all solution. In PHP 5 you can use DB-specific drivers or PDO 
or a PHP-based abstraction layer. That's *more* choice, not less!


To summarize: With PDO or mysqli I can use both old school SQL and 
prepared statements, in PHP 4 there are fewer options! My case for PHP 5 
stands intact.


And finally: With each new release of PHP we can expect improvements in 
PDO, making it a more future safe alternative.



Lars Gunther

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



Re: [PHP] PHP5 Commercial Development

2007-02-05 Thread Keryx Web

Eric Gorr skrev:
I haven't tracked this particular issue, but I know when PHP5 was first 
released is wasn't recommended in a commercial/production environment. 
However, a lot of time has passed and we're at v5.2 now...have things 
changed? Have GoogleYahoo, for example, moved to PHP5? Or is PHP4 still 
the recommendation for such environments?


My two cents: Any modern PHP-app should use prepared statements for 
efficiency and security. PEAR-DB and some other PHP 4 workable 
abstraction layers can emulate this, but it's only in PHP 5 you get the 
real thing, with mysqli or PDO, or a PHP class that's built on top of 
such an interface.


To me, that's the must have feature of PHP 5 I can't be without. Nor do 
I think one could call him-/herself professional still doing old school 
mysql-interface calls to the DBMS.



Lars Gunther

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



Re: [PHP] Best way to start a CRON

2006-04-20 Thread Pure Web Solution
I run several PHP scripts via CRON in the following way:

put the following in the top of the php script:

#!/usr/local/bin/php -q (linux system - location of php bin)

and in the CRONTAB I have the following:

10 1 * * * root /usr/local/bin/php -q /script/CRONexport.php

the -q supress HTML headers.

hope this helps!


Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services

Barry [EMAIL PROTECTED] wrote:

 Hello Everyone!
 
 What would be the best way to start a PHP Script via CRONJOB?
 Should i use the 'php' command or use curl or lynx or something to
 open that URL?
 
 The Script does a MySQL query, collects data and sends it via E-Mail 
 every monday morning to the recipient.
 
 Any help will be appriciated :)
 
 Barry

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



Re: [PHP] Dynamic array_merge problem

2006-04-12 Thread Pure Web Solution
Hi

if you just want to sort of concatenate your arrays then why not just loop
through the whole thing in order to get the new single array. Need more info
for further consideration.  Hope this helps!



for ($i=0;$icount($z);$i++){

  $z1[$i] = $z[$i]; 

}



Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services


Ace McKool [EMAIL PROTECTED] wrote:

 Hi,
 
 This is the end result I'm trying to get:
 
 $z1 = array_merge($z[0], $z[1], $z[2]);
 
 But what if I don't know how many elements are in $z?  I tried this (but it
 breaks if there are more than 2 elements in $z):
 
 for ($i=0; $icount($z); $i++)
 {
 if ($i(count($z)-1))
 {
 $z1 = array_merge($z[$i], $z[$i+1]);
 }
 }
 
 Any pointers would be greatly appreciated!  TIA

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



Re: [PHP] PDFLib or some free solution?

2006-03-21 Thread Pure Web Solution
Hi

I have used fpdf quite a lot (http://www.fpdf.org) and have been really
impressed with its performance.  There are plenty of example scripts on their
website and i think you can use it comercially for free although you will have
to check that one out.

Regards

Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services


[EMAIL PROTECTED] wrote:

 Hi,
 I have to create some flyers and invoices (simple stuff) in one my
 project. On php.net/pdf is mentioned PDFLib, but I know there is a free
 solution too. It's commercial and can't have PDFLib for free.
 My questions are:
 - Is really $450 for PDFLib worth comparing to free solution? (I need for
 really simple stuff)
 - Is there a difference (look and programming) and how big it is,
 between PDFLib and free solution?
 
 Could you please give me some directions?
 
 Thanks.
 
 -afan


Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services


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



Re: [PHP] PDFLib or some free solution?

2006-03-21 Thread Pure Web Solution
Results may well vary Depending on the complexity of the html pages, but have
you tried using the example script 'HTML Conversion'? you could modify
this/expand it to fit your needs.  worth a try i would of thought.


Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services

[EMAIL PROTECTED] wrote:

 As I said in prev post, there is a problem with converting HTML to PDF:
 FAQ
 19. Can I convert an HTML page to PDF with FPDF?
 Not real-world pages. But a GPL C utility does exist, htmldoc, which
 allows to do it and gives good results:
 
 http://www.htmldoc.org
 
 
 Does it has anything with building flyer using php and html tags?
 
 
 
 
  Hi
 
  I have used fpdf quite a lot (http://www.fpdf.org) and have been really
  impressed with its performance.  There are plenty of example scripts on
  their
  website and i think you can use it comercially for free although you will
  have
  to check that one out.
 
  Regards
 
  Pure Web Solution
  http://www.purewebsolution.co.uk
  PHP, MYSQL, Web Design  Web Services
 
 
  [EMAIL PROTECTED] wrote:
 
  Hi,
  I have to create some flyers and invoices (simple stuff) in one my
  project. On php.net/pdf is mentioned PDFLib, but I know there is a free
  solution too. It's commercial and can't have PDFLib for free.
  My questions are:
  - Is really $450 for PDFLib worth comparing to free solution? (I need
  for
  really simple stuff)
  - Is there a difference (look and programming) and how big it is,
  between PDFLib and free solution?
 
  Could you please give me some directions?
 
  Thanks.
 
  -afan
 
 
  Pure Web Solution
  http://www.purewebsolution.co.uk
  PHP, MYSQL, Web Design  Web Services
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services

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



Re: [PHP] Date Question

2006-03-17 Thread Pure Web Solution
Hi

How about doing this in the query string you send to mysql:

DATE_FORMAT(fieldname, '%d %m %y')

this way you wont have to mess around with the array stuff. for more info look
here

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

Regards

Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services


Tom Chubb [EMAIL PROTECTED] wrote:

 Please can you help me. I've created a page where problems are posted into a
 database and I am using the datetime format in MySQL and trying to find the
 best way to display it in the 17/03/06 format.
 I've found a way of doing it (so you don't think I haven't googled, RTFM)
 but don't think it's the best way.
 Any help would be appreciated.
 
 (Current Code:)
 
 ?php
 $datestr = $row_rsSnags['date'];
 $arr1 = str_split($datestr, 2);
 echo $arr1 [2];
 echo /;
 echo $arr1 [1];
 echo /;
 echo $arr1 [0];
 //  echo $row_rsSnags['date'];
 ?
 

Pure Web Solution
http://www.purewebsolution.co.uk
PHP, MYSQL, Web Design  Web Services

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



RE: [PHP] SQL sums

2004-12-03 Thread Thomas S. Crum - AAA Web Solution, Inc.
If someone doesn't give you an answer here, try php cookbook by O'reilly.

It has this exact recipe in it.

Best,

Thomas S. Crum

-Original Message-
From: James Nunnerley [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 03, 2004 9:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP] SQL sums

I'm trying to create a table, and ultimately a graph, out of some syslog
data.

 

I have a mysql table with the following info in it:

Time (unixtime stamp), bytes rcvd and bytes sent

 

I want to create a sql statement that group the data over a certain period
of time, and produces the following table:

 


Time

Sent

Rcvd


From x to y

Total bytes sent during period x to y

Total bytes rcvd during period x to y


From y to z

Total bytes sent during period y to z

Total bytes rcvd during period y to z


From z to a

Total bytes sent during period z to a

Total bytes rcvd during period z to a


From a to b

Total bytes sent during period a to b

Total bytes rcvd during period a to b

 

Now to create this I've tried a horrible method of using php to call sql
table, and then go through each one, and add it to each period of time as
appropriate. it's messy and slow!

 

What I want to do is have the mysql do this.is it possible?

 

Cheers

Nunners

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



RE: [PHP] Errors

2004-12-01 Thread Thomas S. Crum - AAA Web Solution, Inc.
Incorrect syntax.

You likely have a set a variable and not ended it with ';'

For example,

$some_variable = some_value;

is the proper syntax. Or, post the code as recommended.

Best,

Thomas S. Crum

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 01, 2004 1:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Errors

On Wed, 1 Dec 2004 10:44:00 -0700, olsofty [EMAIL PROTECTED] wrote:
 I am very new to PHP been working on a script to access MySql have got it
 down pretty good, but, being lazy I like to copy code to not have to
 re-write it, I am now getting a constant flood of errors. I have looked in
 my book I have searched on the php site and have had no luck.
 WHAT IN THE HECK IS A T_ error. I get T_Else, T_Variable, T_what ever.
 What does it mean
 Very frustrated old man.

Where's the code?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] How to ensure cookies are turned on.

2004-11-29 Thread Thomas S. Crum - AAA Web Solution, Inc.
There is no global variable.

Set a cookie the when they hit the login page and then check to be sure that
cookie isset when they post to it.

Example for login.php:

?
setcookie(cookie_check,1);

if ($LoginButton == Login){

if ($cookie_check != 1){
header (Location: no_cookies.php);
exit;
}
# THE BALANCE OF YOUR SCRIPT - If they got here they have cookies enabled.
}
?
form method=post action=?= $PHP_SELF ?
!-- THE BALANCE OF YOUR FORM --
/form

Best,

Thomas S. Crum


-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 29, 2004 6:40 PM
To: M. Sokolewicz
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] How to ensure cookies are turned on.

M. Sokolewicz wrote:
 Marek Kilimajer wrote:
 
 Gary Reimer wrote:

 Hello;

 I'm working on a website that uses sessions as an integral part of 
 the site. If cookies are not turned on in the browser, my site will 
 not work. I've been searching unsuccessfully to find the way to 
 determine if the browser has cookies enabled.  I want to warn the 
 user that the site won't work if they have cookies turned off. There 
 must be some global variable that tells me. Could someone help me out?



 If the cookie you set is not send back, the cookies are turned off 
 (unless you screwed up). You can redirect user to a turn on your 
 cookies page at a point where cookies are really required and none is 
 send.
 
 and how would you know that? unless you specify an alternative string 
 using GET ofcourse
 

By where cookies are really required I meant for example login page. 
If you find out that session cookie is not set while handling login 
form, you know that cookies are off.

The alternative you are talking about is also possible, but you have to 
be carefull so that these pages are not indexed by search engines.

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



RE: [PHP] Random number generation and phpBB search IDs

2004-11-27 Thread Thomas S. Crum - AAA Web Solution, Inc.
Use a database query to verify the random number has not been used before.

$number_checker = 1;

while ($number_checker != 0){

#insert your $random_number code

$query = SELECT COUNT(*) AS total FROM some_table WHERE
random_number_field = '$random_number';
$result = mysql_query($query);
$number_checker = mysql_result($result, 0, total);

}

If this is in fact a bug (not likely) and it gets past this too, then wow
start using auto increment or something?

Best,

Thomas S. Crum

-Original Message-
From: Gordon Mckeown [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 27, 2004 11:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Random number generation and phpBB search IDs

Hi,

I'm currently experiencing a problem with a phpBB board that appears to 
be due to the way random number generation works in PHP. I have posted 
on serveral phpBB boards and have received no answers, so I think I need 
to understand how PHP is dealing with this in order to resolve it.

phpBB generates a unique index for search results using the following 
code (in search.php):

- 8 - Code - 8 -
mt_srand ((double) microtime() * 100);
$search_id = mt_rand();
- 8 - Code - 8 -

The problem is that the seed is generated from the system clock, and if 
two people search at the exact same moment (or more strictly, if the 
mt_srand statements get executed at the exact same moment), the random 
number generation system is initialised with the same seed in each case, 
so both searches receive the same $search_id, resulting in a MySQL error 
due to non-unique index fields.

Looking through the documentation for PHP, it seems that versions  
4.2.0 do not require the use of mt_srand as they will seed themselves 
when required. I've had a look at the PHP source code, and from my 
limited understanding, the seed appears to be generated using a function 
in php_rand.h:

- 8 - Code - 8 -
#define GENERATE_SEED() ((long) (time(0) * getpid() * 100 * 
php_combined_lcg(TSRMLS_C)))
- 8 - Code - 8 -

So this is still based to some extent on the current system clock, and 
the php_combined_lcg function in lcg.c also appears to rely on the 
current system clock along with the current process/thread ID.

There is also some code to ensure that seeding only occurs once. But is 
this once per thread? Once per process? Once per something-else?

What I'm trying to find out is whether this new seeding system will 
produce the same 'random' number if two mt_rand() statements are 
executing concurrently. My guess is that they won't, but I don't 
understand the internals of PHP or Apache well enough to know if their 
use of threads and processes will ensure uniqueness.

The problem is occuring with PHP 4.3.9 running under Apache 1.3.33 on 
Linux kernel 2.4.26 (on a fairly typical cPanel-based shared hosting 
box). Unfortunately due to the timing-based nature of the problem, it 
has proven very difficult to set up test cases.

I'd be very grateful for any assistance.

Gordon.

-- 
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] User Screen Resolution

2004-10-27 Thread Web Guy
I am new to PHP and couldn't find any Globals for the User's Screen
Resolution. (don't laugh at me please)

I used to use a Javascript function to pass the resolution using
screen.width and screen.height.

What I am actually trying to do is make a page resize depending on screen
resolution, in case that helps anyone.

 

Thanks for your help.

 

Ben

 



[PHP] Substitution Operator

2003-10-20 Thread Nigel Peck - MIS Web Design
Hi,

I'm looking for the PHP equivalent to the Perl:

$var =~ s/regex/string/g

Substitute all occurrences of regex in $var with string.

TIA

Nigel

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



RE: [PHP] Substitution Operator

2003-10-20 Thread Nigel Peck - MIS Web Design
Thanks, tried searching for substitution and similar but couldn't find it.

should have looked for replace :)

Cheers,
Nigel

 -Original Message-
 From: John Nichel [mailto:[EMAIL PROTECTED]
 Sent: 20 October 2003 18:18
 To: Nigel Peck - MIS Web Design
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Substitution Operator
 
 
 Nigel Peck - MIS Web Design wrote:
  Hi,
  
  I'm looking for the PHP equivalent to the Perl:
  
  $var =~ s/regex/string/g
  
  Substitute all occurrences of regex in $var with string.
  
  TIA
  
  Nigel
 
 
 The online manual is a real good place to start.
 
 http://us4.php.net/preg_replace
 
 -- 
 By-Tor.com
 It's all about the Rush
 http://www.by-tor.com
 
 -- 
 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] Weird replacing

2003-09-25 Thread Anguz Web Design
Hi,

I wrote a code to change the urls in my forum, to a new format. I
did it with output buffering and inside it, I used
preg_replace_callback, which worked great for me. But I shared
this code with the forum program community and there's a person
that can't make it work. He says his Apache gets caught up in a
loop or something. So I looked for an alternative to
preg_replace_callback. The way I did it is with preg_match_all
and then changed each element in the array and saved the changed
elements in a new array, then I just str_replace using the arrays
as find/replace. This solutions worked fine, almost. I use two
functions to do changes to the urls, one to make them relative
and the other to change symbols in the query, to something more
friendly to search-engine spiders. The function to make them
relative works great with the new method, as it did with
preg_replace_callback, but the other function, the one to replace
symbols in the query, is acting in an odd way.

Here's function

?php
   function spider_url($match){
  if(!strstr($match['2'], 'action') || strstr($match['2'],
'display') || strstr($match['2'], 'messageindex'))
 return $match['1'] . '/' . str_replace(array(=, ;,
), array(-, _, _), $match['2']);
  return $match['0'];
   }
?

if I call it with this

?php
   /// $scripturl is the var that has the url to the forum
script, like http://example.com/bbs/index.php
   $buffer = preg_replace_callback('/(' . preg_quote($scripturl,
'/') . ')\?([\w;=~+%]+)/i', 'spider_url', $buffer);
?

it works great and the url

http://example.com/bbs/index.php?board=1;action=display;thread=12
3;start=1

changes to

http://example.com/bbs/index.php/board-1_action-display_thread-12
3_start-1

but if I do it with this

?php
   preg_match_all('/(' . preg_quote($scripturl, '/') .
')\?([\w;=~+%]+)/i', $buffer, $match_spider, PREG_SET_ORDER);
   for($i = 0; $i  count($match_spider); $i++){
  $arr1_spider[$i] = $match_spider[$i]['0'];
  $arr2_spider[$i] = spider_url($match_spider[$i]);
   }
   $buffer = str_replace($arr1_spider, $arr2_spider, $buffer);
?

then the url comes out like this

http://example.com/bbs/index.php/board-1;action=display;thread=12
3;start=1

It changes just the first part, up to the semicolon... I did
other tests and there was one where changed everything up to the
semicolon right before 'star'

I can't understand what's going on, so if someone has a clue,
please tell me. Thank you very much in advance for taking your
time reading this.

Cristian

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



[PHP] Adding a set of templates

2003-07-29 Thread Nigel Peck - MIS Web Design
I want to create my own templates but the phpBB site says coming soon for the docs.

I copied the subSilver folder to a folder called default (in the templates directory) 
but when I go to style/add in the admin screens it doesn't show up, the docs say that 
the templates directory is scanned for new templates, am I missing something?

Thanks
Nigel


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



RE: [PHP] Adding a set of templates

2003-07-29 Thread Nigel Peck - MIS Web Design
Sorry wrong list lol.

(long day)

 -Original Message-
 From: Nigel Peck - MIS Web Design [mailto:[EMAIL PROTECTED]
 Sent: 29 July 2003 22:48
 To: [EMAIL PROTECTED]
 Subject: [PHP] Adding a set of templates
 
 
 I want to create my own templates but the phpBB site says coming 
 soon for the docs.
 
 I copied the subSilver folder to a folder called default (in the 
 templates directory) but when I go to style/add in the admin 
 screens it doesn't show up, the docs say that the templates 
 directory is scanned for new templates, am I missing something?
 
 Thanks
 Nigel
 
 
 -- 
 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



Re: [PHP] PHP Execution Timer

2002-09-19 Thread WEB MASTER

Easy,
Put a code to the beginning of the page that takes the unix time stamp, 
and another one to the end. The difference is the execution time at the 
server side...

-=[ Julien Bonastre ]=- wrote:

I have seen it on many sites now and since I have been using PHP for so long and done 
a huge amount of coding with it I thought it would add a nice touch and it could be 
used for statistical purposes to assist me in database effeciency and so forth.

The idea is a page execution timer.. or a database query timer.. basically it shows 
you just a time (usually in msecs) it took for the last command to be executed.. I 
have seen it used for queries and it returns the time it took.. And I am quite sure 
I've seen it used for actual page generation as well, whereby it says something like 
page generated in x.xxx secs



I just want to know what function or module covers this feature.. If it is at all 
possible..




Thanks a million people!


--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--





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




Re: [PHP] string division

2002-09-19 Thread WEB MASTER

||string *strtok*|  (string arg1, string arg2);

|

Meltem Demirkus wrote:

which function divides astring to the pieces accorrding to another string. 
for example according to a comma ..

thanks...
meltem





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




[PHP] array empty after use

2002-05-21 Thread Web

Hi there.

When an array is 'used' with something like do while I can't re-access it
later in the page.  It is as if the array gets used up and doesn't exist.
The array is from a select statement using myself.  I have inserted a
duplicate array with a different name to get around this but figure there
must be a simpler way.

Any ideas please?

Thanks
Kevin


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




[PHP] check form - save arrays in hidden fields?

2002-03-26 Thread Fabian Krumbholz - 2k web solutions


I have a contact form (form.php). I check the submitted data with the
same php file.

If the e-mail adress is not valid I ask the user for a valid e-mail adress.
Therefor I create a new form with the field e-mail. The valid date name,
adress, ...
I put into hidden fields, so they don't get lost.

This works fine until I integreate a file upload into my form.
The file data stored in the $_FILES array get lost, when I submit the
form the second time (when the e-mail adress isn't valid).

The same problem occours when I integrate a list box where it is possible to
choose more then one item:

select name=test[] size=3 multiple
  option value=test1 test1/option
  option value=test2 test2/option
  option value=test3 test3/option
/select

Is there an easy way (in PHP 4.1.2) to store arrays like scalar variables in
hidden fields, without using a database or transforming the array data
into a string?

Thanks,

Fabian Krumbholz
www.2k-web.de


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




[PHP] What's the difference between mail() in PHP and sendmail?

2001-10-26 Thread Web user

What's the difference between mail() in PHP and sendmail?
Thanks!
Mike



-- 
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] Help, need the scripts of processing the to-be-confirmed email.

2001-10-25 Thread Web user

I need to some help about example scripts on:
Question 1:
How to process the confirmation email by clicking the url given in the email
and by replying the email.

Question 2:
I know if using mail(), the From field of the mail sent out is always the
web host server's mail sendout server,
not from my own email box. How to send out the email which looks like
sending out from my own email box.
Question 3:
How to let MYSQL automatically delete the unactivated signups?


Thanks!
Mike











-- 
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] Sv: ezmlm response

2001-10-22 Thread Din Web Udbyder

Will you please stop sending your mail to us immidiately -and we would not accept you 
can't find our e-mail address in your databse - because how can you send e-mail to us 
on this e-mail account if you don't have it in your database
STOP IT AND DO IT NOW!
Regards
Frank Mikkelsen


- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 22, 2001 11:38 AM
Subject: ezmlm response


 Hi! This is the ezmlm program. I'm managing the
 [EMAIL PROTECTED] mailing list.
 
 I'm working for my owner, who can be reached
 at [EMAIL PROTECTED]
 
 Acknowledgment: The address
 
[EMAIL PROTECTED]
 
 was not on the php-general mailing list when I received
 your request and is not a subscriber of this list.
 
 READ THIS ENTIRE MESSAGE TO FIND OUT HOW TO UNSUBSCRIBE YOURSELF IF YOU
 ARE SUBSCRIBED WITH A DIFFERENT MAILING ADDRESS.
 
 If you're subscribed to the digest form of the mailing list, make sure
 you're sending your unsubscribe request to the -digest-unsubscribe
 address.
 
 If you unsubscribe, but continue to receive mail, you're subscribed
 under a different address than you currently use. Please look at the
 header for:
 
 'Return-Path: [EMAIL PROTECTED]'
 
 The unsubscribe address for this user would be:
 '[EMAIL PROTECTED]'.
 Just mail to that address, substituting user=host.dom for the real
 values, reply to the confirmation request, and you should receive a message
 that you're off the list.
 
 For some mail programs, you need to make the headers visible to
 see the return path:
 
 For Eudora 4.0, click on the Blah blah ... button.
 For PMMail, click on Window-Show entire message/header. 
 
 If this still doesn't work, I'm sorry to say that I can't help you.
 Please FORWARD a list message together with a note about what you're
 trying to achieve and a list of addresses that you might be subscribed
 under to my owner:
 
 [EMAIL PROTECTED]
 
 who will take care of it. My owner is a little bit slower than I am, 
 so please be patient.
 
 
 --- Administrative commands for the php-general list ---
 
 I can handle administrative requests automatically. Please
 do not send them to the list address! Instead, send
 your message to the correct command address:
 
 For help and a description of available commands, send a message to:
[EMAIL PROTECTED]
 
 To subscribe to the list, send a message to:
[EMAIL PROTECTED]
 
 To remove your address from the list, just send a message to
 the address in the ``List-Unsubscribe'' header of any list
 message. If you haven't changed addresses since subscribing,
 you can also send a message to:
[EMAIL PROTECTED]
 
 or for the digest to:
[EMAIL PROTECTED]
 
 For addition or removal of addresses, I'll send a confirmation
 message to that address. When you receive it, simply reply to it
 to complete the transaction.
 
 If you need to get in touch with the human owner of this list,
 please send a message to:
 
 [EMAIL PROTECTED]
 
 Please include a FORWARDED list message with ALL HEADERS intact
 to make it easier to help you.
 
 --- Enclosed is a copy of the request I received.
 
 Return-Path: [EMAIL PROTECTED]
 Received: (qmail 84737 invoked from network); 22 Oct 2001 09:38:37 -
 Received: from unknown (HELO dns1.host2000.dk) (64.39.31.249)
   by pb1.pair.com with SMTP; 22 Oct 2001 09:38:37 -
 Received: from  fm (62.214.16.111) by SERVER249 (MailMax 4. 7. 1. 4) with ESMTP id 
44171560 for 
[EMAIL PROTECTED]; Mon, 22 
Oct 2001 11:53:38 +0200 WDT
 Message-ID: 008201c15add$b571f060$2904fe0a@fm
 From: Din Web Udbyder [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 References: [EMAIL PROTECTED]
 Subject: Sv: confirm unsubscribe from [EMAIL PROTECTED]
 Date: Mon, 22 Oct 2001 11:41:20 +0200
 MIME-Version: 1.0
 Content-Type: text/plain;
 charset=iso-8859-1
 Content-Transfer-Encoding: quoted-printable
 X-Priority: 3
 X-MSMail-Priority: Normal
 X-Mailer: Microsoft Outlook Express 5.00.2615.200
 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
 
 
 - Original Message -=20
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, October 22, 2001 11:05 AM
 Subject: confirm unsubscribe from [EMAIL PROTECTED]
 
 
  Hi! This is the ezmlm program. I'm managing the
  [EMAIL PROTECTED] mailing list.
 =20
  I'm working for my owner, who can be reached
  at [EMAIL PROTECTED]
 =20
  To confirm that you would like
 =20
 [EMAIL PROTECTED]
 =20
  removed from the php-general mailing list, please send an empty reply=20
  to this address:
 =20
 =
 [EMAIL PROTECTED]=
 et
 =20
  Usually, this happens when you just hit the reply button.
  If this does not work, simply copy the address and paste it into
  the To: field of a new message.
 =20
  or click here:
  =
 mailto:php-general-uc.1003741541.ehpfeaonkmonedcaocai-info=3Ddkwo.dk@list=
 s.php.net
 =20
  PLEASE NOTE: I haven't checked whether your address is currently
  on the mailing list.  To see what address you used to subscribe,
  look at the messages you

[PHP] Session and header() errrors

2001-10-04 Thread Web user

Why do the errors occur while running the scripts below? It seems that the
errors occured at the part of session and header(). Please give me some
advice!
Thank you!

Mike

System: PHP4.06 + Apache 1.3.20 Win32 + Win98 (the session configurations
are default in php.ini)

when the 1.php is running, the IE shows errors info as below :
-
Warning: Cannot send session cookie - headers already sent by (output
started at c:\program files\apache group\apache\htdocs\web1\html-head.inc:9)
in c:\program files\apache group\apache\htdocs\web1\1.php on line 3

Warning: Cannot send session cache limiter - headers already sent (output
started at c:\program files\apache group\apache\htdocs\web1\html-head.inc:9)
in c:\program files\apache group\apache\htdocs\web1\1.php on line 3

Warning: open(/tmp\sess_96ae897bcb501486860552d2df862863, O_RDWR) failed: m
(2) in c:\program files\apache group\apache\htdocs\web1\1.php on line 3
session_id: 96ae897bcb501486860552d2df862863


Warning: Cannot add header information - headers already sent by (output
started at c:\program files\apache group\apache\htdocs\web1\html-head.inc:9)
in c:\program files\apache group\apache\htdocs\web1\1.php on line 9

-
The scripts of 1.php: (1.php and 2.php are under the same base directory)
?
require(html-head.inc);
session_start();
$name=user;
session_register(name);
echo session_id: .session_id().br;
sleep(10);
header(Location: 2.php);
require(html-foot.inc);
?

-
The scripts of html-head.inc:
html
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titlepage title/title
/head
body

-
The scripts of html-foot.inc:
/body
/html









-- 
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] Re: mysql_fetch_array() doesn't work

2001-09-30 Thread Web user

Hello,
First, Thank you all for your help!
I  finally found the reason for why does  the IE always show info as below:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]

It is because the echo (including print) doesn't work at the line below,
echo trtda href=\profile.php?id=$arr['user_id']\  target='_top';
showing the error info as I mentioned. ( but it should work according to PHP
books)

It only works when  the $arr['user_id'] is out of the quotes.
echo trtda href=\profile.php?id=.$arr['user_id'].\
target='_top';
then IE showed no error any longer.

So I have to let all $arr['key']  out of the quotes, then the scripts are
Ok.

Regards
Mike

















-- 
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] Re: mysql_fetch_array() doesn't work

2001-09-30 Thread Web user

Hello,
First, Thank you all for your help!
I  finally found the reason for why does  the IE always show info as below:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]

It is because the echo (including print) doesn't work at the line
below,
echo trtda href=\profile.php?id=$arr['user_id']\  target='_top';
showing the error info as I mentioned. ( but it should work according to PHP
books)

It only works when  the $arr['user_id'] is out of the quotes.
echo trtda href=\profile.php?id=.$arr['user_id'].\
target='_top';
then IE showed no error any longer.

So I have to let all $arr['key']  out of the quotes, then the scripts are
Ok.

Regards
Mike















-- 
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] mysql_fetch_array() doesn't work

2001-09-26 Thread Web user

System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always show info as below:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]

What's the problem wiht mysql_fetch_array() or other?
What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean?

THANKS
Mike


The full code below:


?
$link=mysql_connect(localhost,,);
if($link==false){
echo Failed linking to database.;
exit();
}
$handler=mysql_select_db(database1);
if($handler==false)
echo Failed linking to database.;
$query=selct count(*) from users where sign=1;
$res=mysql_query($query);
$row=mysql_fetch_row($res);
$all=$row[0];
$step=5;
$pages=ceil($all/$step);   /*the number of pages needed to listed */
if(empty($offset))
$offset=0;
$query=select user_id, user_name, time, status, comment from users
where sign=1
order by user_name
limit $offset, $step;
$res=mysql_query($query);
echo tabletd align=centerUser/td
td align=centerAdded time/tdtd align=centerStatus/td/tr;
$num=mysql_num_rows($res);
for($i=0; $i$num; $i++) {
$arr=mysql_fetch_array($res);   /* HERE is line where the error occurs!!!
*/
echo trtd align=centera href=\profile.php?id=$arr['user_id']\
target='_top'
$arr['user_name']/a/td;
echo td align=center$arr['time']/td;
echo td align=center$arr['status']/td/tr;
echo tr colspan=3td$arr['comment']/td/tr;
}

echo /tablebrbrbr;

echo tabletrtd align='center';  /* show others in multi-pages */
for($i=0; $i$pages; $i++){
echo a href='$PHP_SELF?offset=$i*$step' target='_top'
echo ($i+1)./a;
echo nbsp;nbsp;;
}
echo /td/tr/table;

?


-
create table users (
user_id int not null auto_increment primary key,
user_name varchar(30),
time datetime,
status tinyint(1),
comment text,
sign tinyint(1) default '1'
);







-- 
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] mysql_fetch_array() doesn't work

2001-09-25 Thread Web user

System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98


?
..
..
$res=mysql_query($query);
$num=mysql_num_rows($res);
for($i=0; $i$num; $i++){
$arr=mysql_fetch_array($res);
...
}
...

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always show info as below:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in
c:\program files\apache group\apache\...\page.php on line ...

What's the problem wiht mysql_fetch_array() or other?

Thanks!
Mike







-- 
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] newbie : how to access functions in seperate files???

2001-09-03 Thread web-dev

speedboy wrote:
 
 What do people do with required files? I have a file called config.php
 which contains all my functions. It is 329526 bytes. Should I split this
 up into other files? I don't think so, but what do others think?

I too am curious about a recommended or best practice. I create a
function file that contains numerous functions for generating forms that
are used more than once in a site and it becomes large when the forms
are complex. But the alternative is to bloat the individual files by
including the function code on each page that uses it. Or, if you split
the one, large file into some number of smaller files, it increases the
administrative burden of knowing what is in each smaller file and
requiring the correct sub-file in the right context rather than
routinely requiring the one catch-all file every time one or more
function is needed.

Kris O.

-- 
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] sql query with join and same column twice...

2001-08-30 Thread Web Manager

Hello,

Here are 2 tables:

airport
-
airport_id
name
code
city_id


destination
---
destination_id
dest_name
airport_dep_id  // using airport.airport_id (departure)
airport_arr_id  // using airport.airport_id  has well (arrival)


I have 2 columns in the second table that uses the same name column in
the first table...

I dont know how to formulate my SQL query... I want to select the
destinations in the destination table with not the ID of each airport
but their names. I can do a join with one but with the second one, I get
no results... And this is confusing!

select dest.dest_name, air.name as airport1, air.name as airport2 from
destination, airport air where dest.airport_dep_id_id=air.airport_id and
dest.airport_arr_id=air.airport_id;

This is not good...

Any help?

Thanks!
--
Marc Andre Paquin

-- 
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] HTTP 500 server error

2001-08-29 Thread Web user

It always gets HTTP 500 server error, when I  try to run the php scripts on Windows98 
SE + PWS4.0. 
THE PHP installed is Ver 4.06 -win32, as a server module.

However I get a screen full of html codes when  I run c:\php\php.exe -i in MS-DOS 
command line

So what's problem with the installation or configuration?
Thanks

BAKER



[PHP] large external script to include in many pages

2001-08-13 Thread Web Manager

Hello,

I am testing a new DHTML code for navigation menus. I plan to use it
throughout my web pages made with PHP. The script is about 600 lines
long! 

Beside making a :

define (script1,  .
 .
 .
);

and calling the script1 name in my PHP pages...

this will be very, very long, is there a another way to create a kind of
variable ($myscript == 600 lines of the DHTML) that I could simply call
out in all my pages. Something like a script src=../myscript.js

The define approach doesn't seem to be very appropriate for a very long
text inclusion...

Thanks!
-- 
~
Marc Andre Paquin

-- 
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] Re: large external script to include in many pages

2001-08-13 Thread Web Manager

Henrik Hansen wrote:
 
 [EMAIL PROTECTED] (Web Manager) wrote:
 
   Hello,
  
   I am testing a new DHTML code for navigation menus. I plan to use it
   throughout my web pages made with PHP. The script is about 600 lines
   long!
  
   Beside making a :
  
   define (script1,  .
.
.
   );
  
   and calling the script1 name in my PHP pages...
  
   this will be very, very long, is there a another way to create a kind of
   variable ($myscript == 600 lines of the DHTML) that I could simply call
   out in all my pages. Something like a script src=../myscript.js
 
 I would go with the script tag if I were you.
 
 --
 Henrik Hansen


Hello,

well, I can't... I have HTML code (image tags) in the DHTML script and
this can not be in a .js file...

Thanks for your input!
-- 
~
Marc Andre Paquin

-- 
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] Editing Files Using POST Forms

2001-07-18 Thread RCA Web Development

I have created a php page that accepts a variable called $file using GET. It
then displays this in a textarea box. You can then edit the file and click a
button to save it and it POSTS it to the same page (edit.php) on the server.
This works but it adds slashes before any speech marks (). Can somebody
help me with this.

Below is an example of how it changes the code and the code for the page
edit.php

Regards,
Corin Rathbone
www.corin.org.uk
-

A page before editing:
html
head
title/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
meta name=author content=Corin Rathbone 2001
/head
body

div class=headingDelete A File/div

/body
/html
-

The same page after editing:

!DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.01 Transitional//EN\

html
head
title/title
meta http-equiv=\Content-Type\ content=\text/html; charset=iso-8859-1\
meta name=\author\ content=\Corin Rathbone 2001\
/head
body

div class=\heading\Delete A File/div

/body
/html
-

The edit.php page source:
?php
include config.php;

//Start Pages PHP here

if(isset($save)){
$fp = fopen($file, wb) or die(Could not open file!);
$worked = fwrite($fp, $contents) or die(Could not write file!);
fclose($fp) or die(Could not close file!);
$edit=false;
$save=true;
}
elseif(isset($file)){
$fp = fopen($file, rb) or die(Could not open file!);
$contents = fread($fp, filesize($file)) or die(Could not read file!);
fclose($fp) or die(Could not close file!);
$edit=true;
$save=false;
}
else{
$edit=false;
$save=false;
}

//End Pages PHP Here
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;

html
head
titleEdit A File - File Explorer For ?php print($root_url);?/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
meta name=author content=Corin Rathbone [EMAIL PROTECTED]
meta name=copyright content=Corin Rathbone 2001
link rel=stylesheet type=text/css href=main.css
/head
body
!-- Start Of Page Content --

div class=headingEdit A File/div

?php
if($edit){
print( Contents Of file: b );
print( $file );
print( /b\n );
print( p align=\center\\n );
print(  form action=\edit.php\ method=\post\ \n );
print( input type=\hidden\ name=\file\ value=\ );
print( $file );
print( \\n );
print( input type=\hidden\ name=\save\ value=\1\ );
print(   textarea name=\contents\ rows=\25\ cols=\90\\n );
print( $contents );
print(   /textareabr\n );
print(   input type=\submit\ value=\Save\\n );
print(  /form\n );
print( /p );
}
elseif($save){
print( p align=\center\\n );
print( File: b );
print( $file );
if($worked){print( /b has been saved! );}
else {print( /b has bnot/b been saved! );}
print( /p );
}
else {
print( p align=\center\bPlease Select A File To Be Save!/b/p );
}
?

!-- End Of Page Content --
BRBRBR
div class=copyrightcopy;a href=mailto:[EMAIL PROTECTED];Corin
Rathbone/a 2001/div

/body
/html


-- 
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] Enabling short tags in PHP 4.0.6

2001-07-13 Thread Coulee Web

Thank you - that did the trick! The php.ini file WAS in the wrong
folder. Too bad the ./configure command doesn't know where to put it!

Ralph Guzman wrote:
 
 Are you sure you have the php.ini file in the right directory? When looking
 at phpinfo() make sure php.ini is located where the Configuration File
 (php.ini) Path is set to.
 
 -Original Message-
 From: Coulee Web [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 10, 2001 6:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Enabling short tags in PHP 4.0.6
 
 I have just installed PHP 4.0.6 on my server and although the php.ini
 file shows that short open tags should be on, a look at phpinfo() shows
 they are off and of course the don't work. I have a huge site already
 developed using short tags and must turn them on. Does anyone know what
 is wrong? I even configured PHP with the --enable-short-tags option but
 still no luck.
 
 --
 ---
 Shane Lambert, Owner
 Coulee Web
 http://www.couleeweb.net/
 
 --
 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]

-- 
---
Shane Lambert, Owner
Coulee Web
http://www.couleeweb.net/

-- 
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] Enabling short tags in PHP 4.0.6

2001-07-10 Thread Coulee Web

I have just installed PHP 4.0.6 on my server and although the php.ini
file shows that short open tags should be on, a look at phpinfo() shows
they are off and of course the don't work. I have a huge site already
developed using short tags and must turn them on. Does anyone know what
is wrong? I even configured PHP with the --enable-short-tags option but
still no luck.

-- 
---
Shane Lambert, Owner
Coulee Web
http://www.couleeweb.net/

-- 
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] Generating thumbnails of JPEG/GIF images

2001-05-04 Thread Web master

I wrote a small function like the following to create my won thumbnails.

function make_tumb_nail($url){

  $size=GetImageSize(image/$url);
  $ht=$size[1];
  $wd=$size[0];

  if($ht$wd){
  $h=$ht;
  for($i=1.01;;){
   if($h121){
break;
   }
   $h=$ht/$i;
   $w=$wd/$i;
   $i=$i+0.01;
  }
  } else {
  $w=$wd;
  for($i=1.01;;){
   if($w91){
break;
   }
   $h=$ht/$i;
   $w=$wd/$i;
   $i=$i+0.01;
  }
  }
  $wd=floor(round($w));
  $ht=floor(round($h));
  $returnstring=width=$wd height=$ht border=0;
  return $returnstring;
}

This function returns the thumbnail width and height as string and use 
it along with the original string.

img src=image/?php $url ?  ? php make_thumb_nail($url) ?

Hope this helps.


Richard wrote:

 Greetings.
 
 Is there any quick way to generate thumbnails of existing pictures in a
 directory? It would seem quite worthless to create 120x120 images of ones
 that already exist, and upload duplicates.. Therefore, dynamic thumbnails
 would be perfect. Any solutions?
 
 PHP 4.0+ thanks.
 
 - Richard
 
 
 


-- 
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] very basic question, needs direction!

2001-05-03 Thread Web master

Hello,

I am using PHP as my main language in my websites. I am planning to set 
up my own server to host all my domains. Is there a place, where I can 
see, how do I set up a server with PHP as the main language and what are 
the hardware/software requirements for this?
All I need is just a url or if anybody already did this, please let me know.

Thanks in advance.


-- 
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] Paging a Recordset

2001-03-15 Thread Web master

you can use 'limit x,y' in MySql.

James Crowley wrote:

 Hi,
   I want to spread the results of a recordset over a number of pages. In ASP,
 I would have opened a connection with a client-side cursor... but with PHP
 (using it's ODBC functions), it only seems to be able to execute an SQL
 statement, and return all the results... which isn't very efficient if I
 have 500 results with 10 per page!
   Also, how do I change the cursor location?
 
 Regards,
 
 - James
 
 Editor, VB Web
 ==
 Web   - http://www.vbweb.co.uk
 Email - [EMAIL PROTECTED]
 ICQ#  - 60612011
 ==
 
 


-- 
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] Help! Can't redeclare already declared function in

2001-03-15 Thread Web master

I thought it will say, which function it can not redeclare.
How many functions you have in the file?
If it is small number, you could comment out each function and see which 
one is casuing the problem.


Jack Sasportas wrote:

 I just finished coding everything on a project it was working (all
 nighter), and now something I just changed is causing this error
 
 "Can't redeclare already declared function in "
 
 There is no duplication of functions declarations.
 
 The thing is it is basically saying that no matter what functions are in
 the file, you will get the error on whatever function is 1st function in
 the file of functions, and the line it always points to is the closing
 "}" of the function itself...
 
 Tried to get help on php.net, but didn't find anything.
 Any Ideas ?
 
 ___
 Jack Sasportas
 Innovative Internet Solutions
 Phone 305.665.2500
 Fax 305.665.2551
 www.innovativeinternet.com
 www.web56.net
 
 
 


-- 
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] Stripping Single Quotes

2001-03-15 Thread Web master

use the following code
$vals=explode("'", "'abc'");
$your_value=$vals[0]; //I am little confused, if it is not working try 
index1

Elan wrote:

 Hi,
 
 I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I
 strip the embedded single quotes) with a minimum of overhead?
 
 (In case you'r wondering: I created the quoted string to store it in
 MySQL, now I want to display the same string in a Webpage. Usually the
 strings I display do not have embedded single quotes, and I add the
 single quotes when I output the string printf("input type='text'
 value='%s'", $value); That works well enough for strings that don't
 already have embedded quotes. But when they do I want to get rid of them
 quickly and easily, otherwise I get ...value = ''some value'' and
 Netscape doesn't display the value embedded in two single quote
 characters).
 
 TIA,
 
 Elan
 


-- 
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] Need some help plz

2001-03-10 Thread Web Admin

Hi,
what's up Mick?! 
Okay, what have you written in your script?! You never
wrote it! try include ('./domain.php') instead of 
include ('domain.php') maybe it helps you! I tested
that on my FreeBSD 4.2+apache/php but it seems that
include ('domain.php') is also OK. Just give it a try or
add the directory which domain.php belongs to, to your
php include path.
Take care,
Ahmad

"Mick" [EMAIL PROTECTED] wrote in message 
98cr35$l7b$[EMAIL PROTECTED]">news:98cr35$l7b$[EMAIL PROTECTED]...
 Hi,
 
 I installed PHP4 onto my FreeBSD 4.2 computer but i'm getting this error,
 anyone able to tell me how i can fix it?
 
 
 Warning: Failed opening '/usr/local/apache/htdocs/mick/domain.php' for
 inclusion (include_path='') in Unknown on line 0
 
 Thanks in advanced
 
 
 
 
 -- 
 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] Combo Box containing field

2001-03-10 Thread Web Admin

Hi Michael,
Yes I do! Take a look at the code snippet below:

echo "select name=something";
$level2 = $db-execute("select typename from types");
   do {
   $value=$level2-fields[0];
   echo "option value=$value$value/option";
   $level2-nextRow();
} while (!$level2-EOF);
   $level2-close();
echo "/select";

Just change the query in the 2nd line of the code to the 
desired query. You'll see the result ;-)
Best of luck,
Ahmad Anvari da Code Guru
  - Original Message - 
  From: RealGM 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, March 10, 2001 4:21 PM
  Subject: [PHP] Combo Box containing field


  Hi,

  Does anyone know how I can create a combo box in my php file that reads the options 
in from a database field?

  I can create combo boxes fine containing values that I enter, but I want it to read 
the values from the database into the drop down box for the user to select.

  Thanks,
  Michael.





[PHP] Direction Help!

2001-02-27 Thread Web master

Hello Php Gurus,

Need help on direction. I am using PHP for a while now, I was able to 
develop very nice sites using PHP/MySql. Now I very comfortable in using 
PHP and I want to learn more advanced features of PHP. Can anyone tell 
me go from here??
I have used PHP for tradtional query based application so far.

Thanks in advance.
-Unni


-- 
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] incrementing a date!

2001-02-25 Thread Web Admin

hi,
try $tomorrow  = mktime(0,0,0,date("m")  ,date("d")+1,date("Y"));
or maybe better than this, if you convert the date to the standard
unix timestamp and use DATE function.
Best of luck,
Ahmad Anvari
  - Original Message - 
  From: kaab kaoutar 
  To: [EMAIL PROTECTED] 
  Sent: Sunday, February 25, 2001 2:36 PM
  Subject: [PHP] incrementing a date!


  Hi all!
  s there a way with which we can increment a date (by day) without extracting 
  the month the day and the year then increment some of them depending on the 
  day the month and the year ?
  ex: 2001-03-28 'll become 2001-04-01

  Thanks
  _
  Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


  -- 
  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] No same username

2001-02-25 Thread Web Admin

define a UNIQUE field :)

  - Original Message - 
  From: Brandon Feldhahn 
  To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  Sent: Sunday, February 25, 2001 4:03 PM
  Subject: [PHP] No same username


  how do i make somthing with my database that knows it the username
  entered is already a name in use?


  -- 
  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] No same username

2001-02-25 Thread Web Admin

Or better using:

create table test1 (t1 char(5), t2 char(5), primary key (t1), unique (t2)); 

when creating table. No duplicate records with the same t2 because it's unique.

Ahmad Anvari
  - Original Message - 
  From: Kath 
  To: Brandon Feldhahn ; [EMAIL PROTECTED] 
  Sent: Sunday, February 25, 2001 6:19 PM
  Subject: Re: [PHP] No same username


  
   $sql = "SELECT username FROM main_users WHERE username = '$username'";

   $result = mysql_query($sql);

   $num = mysql_numrows($result);

   if ($num  "0") { die ("That username already exists, please chose
  another"); }
  -
  That could do it :)

  - Kath

  - Original Message -
  From: "Brandon Feldhahn" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
  [EMAIL PROTECTED]
  Sent: Sunday, February 25, 2001 7:33 AM
  Subject: [PHP] No same username


   how do i make somthing with my database that knows it the username
   entered is already a name in use?
  
  
   --
   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] Change dir mode to writable for uploading..

2001-02-24 Thread Web Admin

Hi Dhaval,
You said in your previous e-mail 'C:\'. Are you using a NT based
server or Unix based? If your server is a unix based one, consider
trying this command:
chmod 777 /path/to/directory
Warning, this is a bit dangerous and might be vulnerable, are you
running your webserver with nobody? Anyone else has access to
write cgi scripts on your servers? If everything's set up carefully,
you can chown your directory to nobody. It will work with the current
permission.
Ahmad Anvari

  - Original Message - 
  From: Dhaval Desai 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, February 24, 2001 11:55 AM
  Subject: [PHP] Change dir mode to writable for uploading..


  Hi!

  I have problem uploading the file to a  directory...
  It says permission denied. THe problem is taht ther
  directory is on the web.
  I connect using WS_ftp.
  THe directory is set to:

  drwxr-xr-x

  How do I make it writable..?


  I am using form to upload the files there..


  Is there any way I can make the directory writable..?

  Thank You!

  Dhaval Desai

  __
  Do You Yahoo!?
  Get email at your own domain with Yahoo! Mail. 
  http://personal.mail.yahoo.com/

  -- 
  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] $result = $$function

2001-02-24 Thread Web Admin

Hi,
I didn't get why you haven't used this:
switch $var
  case something: $result=$build_result(); break;
  case somethingelse: $result=$build2(); break;
  blah blah blah... 

Ahmad
  - Original Message - 
  From: Peter Van Dijck 
  To: php gen list 
  Sent: Saturday, February 24, 2001 4:00 PM
  Subject: [PHP] $result = $$function


  Hi,
  I'd like to do:
  $function = "build_result()";
  $result = $$function;
  but it doesn't seem to work.
  The reason why I think I need it is that I have a generic function, but 
  within it I have to call another function depending on who called it. I 
  could build a switch within the generic function deciding which function to 
  call, but tht seems less elegant, as I'd have to adjust the generic 
  function every time a new function calls it.
  The build_result() function only gets called in certain cases by the 
  generic function (if it's not cached), so I can't just put it outside fo 
  the generic function.
  Any hints?
  Thanks!
  Peter
  ~
  http://liga1.com  ,a weblog on:
  - Localisation
  - Internationalisation
  - Globalisation
  - Accessibility


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

2001-02-14 Thread Web master

My understanding is, it simple supress the any messages generated from 
the result. So I guess it is local.

Karl J. Stubsjoen wrote:

 When you @ "at" a command (supress error messaging) within a function, is
 the scope of the @ within the function?
 
 Example:
 
 
 CloseODBC(1);
 
 # is error message supressed here too?
 
 
 function CloseODBC($connection_id)
 {
 # error messaging supressed
 @odbc_close($connection_id);
 
 }
 
 


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

2001-02-14 Thread Web master

My approach towards this problem was to parse the data before inserting 
and before displaying.
Before inserting the data entered by user, do something like 
str_replace($comments, "'","~") and do the same thing for " do a 
different character like | and then insert it into database.
Do the reverse before displaying the data, it should fix your problem..

Tanya Brethour wrote:

 Hi! I was hoping that someone could help me out. I am not positive if I
 understand whats going on.. so let me try to explain.
 
 This is a process to modify news articles in a MySQL database.
 
 (From the point after picking the article to modify)
 PHP Script #1:
   I grab everything from the database and stick it into the HTML form
 (textarea, text, etc). I allow the user to modify whatever they want.
 
 PHP Script #2:
  This script takes the new information and displays it to the user.. it is
 a preview of what it will look like with the changes.
 
 PHP Script #3:
  Updates the news article in the database.
 
 Now the problem I am having.. is that the description and content fields
 have qoutes in them. For example:
 Description: I like to run and walk. I love "smelly cheese."
 
 So.. when it tries to update the database. It will only store this as the
 description:
   I like to run and walk. I love\\
 
 I know that its because the qoutes are not being escaped correctly.. and
 it seems as though it is escaping the escape. 
 
 So my question is.. how can I keep my qoutes?
 
 Just FYI.. I am making the user enter in the description and content in
 html. So i cant just change the qoutes to HTMLTags because it would change
 my P and a href= etc.
 
 Below is an example of the code (shortened for an example):
 
 PHP Script #1: Editing description
 
 print'
 /textareabr
 Description:brtextarea name=describe cols=40 rows=10';
 echo $info["description"];
 print'
 /textareabr';
 
 PHP Script #2: (preview changes)
 
 input type=hidden name=describe value="?php print $describe?"
 bDescription:/bbr
 ?php print $describe? p
 
 PHP Script #3: (update database)
 $sql = "UPDATE news SET release_date='$date', title='$title',
 description='$describe', contact='$contact', content='$test', type='$type'
 WHERE news_id=$id";
 $result = mysql_query($sql)
 
 
 Thanks in advance.
 
 -Tanya
 
 
 
 
 
 
 


-- 
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] mysql +php+ array

2001-02-12 Thread Web master

Hi Ramiro,

Your code looks ok, why don't you try the following and tell me is 
working or not

$arr_aantal = explode (",", $aantal);
$arr_str_men = explode (",", $str_men);
$arr_recht = explode (",", $recht);
$arr_rechtverstek = explode (",", $rechtverstek);
$arr_verstekgelijk = explode (",", $verstekgelijk);
$arr_verstekongelijk = explode (",", $verstekongelijk);
rows = count($arr_aantal);

for($b=0; $b$rows; $b++):
  $sql = "INSERT INTO $table_name SET aantal='". trim($arr_aantal[$b]) ."',str_men='" 
. trim($arr_str_men[$b]) ."',recht ='"
.. trim($arr_recht[$b]) ."',rechtverstek='" . trim($arr_rechtverstek[$b])
.."',verstekgelijk='" . trim($arr_verstekgelijk[$b]) ."',verstekongelijk='" .
trim($arr_verstekongelijk   [$b]) . "', soorten=
'$bewaar'";
  mysql_query ($sql)
 or die ("cannot execute update query");
}

only change I made was to use the count from explode.


Ramiro Radjiman wrote:

 I have the following code:
 
 $arr_aantal = explode (",", $aantal);
 $arr_str_men = explode (",", $str_men);
 $arr_recht = explode (",", $recht);
 $arr_rechtverstek = explode (",", $rechtverstek);
 $arr_verstekgelijk = explode (",", $verstekgelijk);
 $arr_verstekongelijk = explode (",", $verstekongelijk);
 
 for($b=0; $b$rows; $b+=1){
 $sql = "INSERT INTO " . $table_name . " SET aantal='" .
 trim($arr_aantal[$b]) ."',str_men='" . trim($arr_str_men[$b]) ."',recht ='"
 .. trim($arr_recht[$b]) ."',rechtverstek='" . trim($arr_rechtverstek[$b])
 .."',verstekgelijk='" . trim($arr_verstekgelijk[$b]) ."',verstekongelijk='" .
 trim($arr_verstekongelijk   [$b]) . "', soorten=
 '$bewaar'";
 
 mysql_query ($sql)
  or die ("cannot execute update query");
 }
 
 if i do this the following sql statement is created,
 
 
 INSERT INTO testen SET
 aantal='22',str_men='2',recht='2',rechtverstek='2',verstekgelijk='2',verstek
 ongelijk='2',soorten='plat3mm'
 INSERT INTO testen SET
 aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
 jk='',soorten='plat3mm'
 INSERT INTO testen SET
 aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
 jk='',soorten='plat3mm'
 INSERT INTO testen SET
 aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
 jk='',soorten='plat3mm'
 INSERT INTO testen SET
 aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
 jk='',soorten='plat3mm'
 INSERT INTO testen SET
 aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
 jk='',soorten='plat3mm'
 INSERT INTO testen SET
 aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
 jk='',soorten='plat3mm'
 
 
 so the first array element goes wel, but the next contains no data, but i
 know for sure that there is dat in it. See above.
 
 Could anyone give me a clue?
 
 aantal=$arr_aantal[$b]   should work i thaught.
 or
  "aantal= ". $arr_aantal[$b] ." str_men=" . $arr_str_men[$b] . and so fort.
 
 
 
 
 
 


-- 
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] Hi, new guy here!

2001-02-09 Thread Brian Potter Web Design

Hello! My name is Brian Potter and I just finished the PHP Fast and Easy Web 
Development book. A friend of mine suggested I subscribe to this list. I am eager to 
interact with all of you! I do a webpage for my youth group as well as various 
professional web pages. I appreciate all of your help in advance!

-BRiAN



Re: [PHP] Modulus Formatting

2001-02-06 Thread Web Admin

Hi Michael,
Use a temporary variable [counter], if counter%3 == 0 then
write /trtr in the output. 

$counter=0; print "tr";
while($row = mysql_fetch_array($result)) {
echo "td".$row["user_id"]."/td"; $counter++;
if (!$counter%3) { echo "/trtr"; }
}
That's all ;-) 
Ahmad Anvari
 

  - Original Message - 
  From: Michael Hall 
  To: PHP List 
  Sent: Tuesday, February 06, 2001 10:03 AM
  Subject: [PHP] Modulus Formatting




   I can pull data out of a database using mysql_fetch_array and assemble
  it like this using a while statement:
   
   TRTD$data/TD/TR
   TRTD$data/TD/TR
   TRTD$data/TD/TR
   etc ...
   
   What I'd like to do is assemble it like this:
   
   TRTD$data/TDTD$data/TDTD$data/TD/TR
   etc...
   
   In other words, I need a break (/TRTR) every three times through the
   loop.
   
   I've tried several snippets of code from this list's archive  but none seem 
   to work. I've tried while statements, for statements and the list function
   in every combination I can think of ... no go. I know that modulus is
  what I need but I can't crack the right code combination.
   
   Does anyone have a solution or can they point me to a resource somewhere?
   
   
   Thanks 
   
   Mick
   
   


  -- 
  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] Save to Local Disk

2001-02-06 Thread Web Admin

Hi Karl,
Simply put a save button on your page. When it's clicked,
pass document.forms[0].textareaname.value to the other
script, (it's written in javascript, if you're familiar with that),
then you'll access the content of the text box.
to save it on a local disk, simply use javascript again, it
will help you save a file on disk. [altough there are some
security reasons which prohibit you write on the client's
side, you can still do that using the below script] it's a good
guide. however, you have to change some parts:

BODY 
FORM
TEXTAREA NAME="output" COLS=60 ROWS=10 WRAP="virtual"/TEXTAREABR
INPUT TYPE="button" VALUE="Read File" onClick="this.form.output.value= ''; 
fetchFile(this.form);" ID="2"BR

TEXTAREA NAME="input" COLS=60 ROWS=10 WRAP="virtual"/TEXTAREABR 
INPUT TYPE="button" VALUE="Save File" onClick="setFile(this.form.input.value);"
ID="3"P
INPUT TYPE="button" VALUE="New Window..." onClick="newRaisedWindow();" ID="4" 
/FORM 
/BODY 

hope it works,
Ahmad Anvari
- Original Message - 
  From: Karl J. Stubsjoen 
  To: PHP Mailing List 
  Sent: Tuesday, February 06, 2001 6:23 PM
  Subject: [PHP] Save to Local Disk


  Hello,

  I'd like to give the user an option to "Save to Disk" the contents of a text
  area.  Any ideas how to do this?

  Thanks!




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

2001-02-06 Thread Web Admin

Hi,
Consider using ImageCreateFromGif will help you. Then
use ImageTTFText  to write some text on the loaded gif
and ImageGIF it to output the image as gif :)
Ahmad Anvari
  - Original Message - 
  From: Brandon Orther 
  To: PHP User Group 
  Sent: Tuesday, February 06, 2001 7:50 PM
  Subject: [PHP] GD


  Hello,

  Hello I am starting to work with GD a little bit more lately and was looking
  for some more advanced stuff than just printing text on blue background.  I
  was wondering if there is a way to load an image into GD to use as the
  background image of a image I want to create.

  Does anyone know where I can get a couple good GD tutorials, other than
  making graphs.

  Thank you,

  
  Brandon Orther
  WebIntellects Design/Development Manager
  [EMAIL PROTECTED]
  800-994-6364
  www.webintellects.com
  


  -- 
  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] Passing an array as an argument.

2001-02-06 Thread Web Admin

Hi April,
I suggest you code your array into one string (it depends to the size)
then decode it at the other end using your own code. It's the easiest
trick to pass the array, compress it into one variable, then extract it at 
the other end.
Any other ideas? ;-)
Ahmad
  - Original Message - 
  From: April 
  To: PHP General 
  Sent: Tuesday, February 06, 2001 8:48 PM
  Subject: [PHP] Passing an array as an argument.


  How do you pass an array as an argument to a function?

  My code (or at least the important parts):


  function process_members($asker_rank, $email) {

  global $database_mysql;
  mysql_select_db($database_mysql);

  while (list ($key, $val) = each ($email)) {
 echo "$key = $valbr";
  }

  }


  #  This will display fine.   #
  while (list ($key, $val) = each ($email)) {
  echo "$key = $valbr";
  }


  #  Doing the same thing with the function here returns this error,
  though.  
  // Warning: Variable passed to each() is not an array or object in lib.inc
  on line 447
   process_members($asker_rank, $total_members, $email);


  -- 
  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] GD, TTF, and Anit-Alias

2001-02-06 Thread Web Admin

Hi Brandon,
You asked me in a private e-mail about anti-aliasing. As far
as I know if ImageTTFText function, if you use negative color
reference [such as -1, -2], It turns off the anti aliasing. I think
the text is automatically antialiased using a positive number.
Anyone, with a sharp idea? ;-)
Ahmad Anvari
  - Original Message - 
  From: Brandon Orther 
  To: PHP User Group 
  Sent: Tuesday, February 06, 2001 9:07 PM
  Subject: [PHP] GD, TTF, and Anit-Alias


  Hello

  I am making a php script that make an image with the text that I send to the
  script.  What I was wondering is if there was an anti-alias function in GD
  for my test.

  Thank you,

  
  Brandon Orther
  WebIntellects Design/Development Manager
  [EMAIL PROTECTED]
  800-994-6364
  www.webintellects.com
  


  -- 
  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] Web based Time Sheets for Professionals

2001-01-25 Thread Web Time Sheets

Announcing the eTech Online Time Sheet system for gathering Employee Time over the 
Internet. 
Online TimeSheets easily integrate with Payroll, Billing  Project Management. 

Simplified Time Tracking and Project Management is a click away. 
http://www.solutioncorp.com/timesheet.shtml

Please call us or visit our site.

Thank You

Gary P. Finley
eTech SolutionCorp

voice: 817-355-8883
http://www.SolutionCorp.com


If you have recieved the message in error, we apologize.
Please click below to send a remove request to us:
mailto:[EMAIL PROTECTED]?subject=RemoveName_TimeSheet


-- 
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-I18N] Web based Time Sheets for Professionals

2001-01-25 Thread Web Time Sheets

Announcing the eTech Online Time Sheet system for gathering Employee Time over the 
Internet. 
Online TimeSheets easily integrate with Payroll, Billing  Project Management. 

Simplified Time Tracking and Project Management is a click away. 
http://www.solutioncorp.com/timesheet.shtml

Please call us or visit our site.

Thank You

Gary P. Finley
eTech SolutionCorp

voice: 817-355-8883
http://www.SolutionCorp.com


If you have recieved the message in error, we apologize.
Please click below to send a remove request to us:
mailto:[EMAIL PROTECTED]?subject=RemoveName_TimeSheet


-- 
PHP Internationalization 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] BIG include file !!!

2001-01-10 Thread Web Master

I don't think so, I have bunch of include files, which have more than 5000 lines
and is running very fine.

Abe wrote:

 Hey Guys,

 I am developing an application in PHP.  I make use of an include file that
 contains regularly used functions.  As I am working I am taking more and
 more of the code out and putting it into functions straight into the include
 file.  This file is included on almost every page and I am worried that it
 is going to slow the pages down.  Will it have a large effect on the pages
 speed.  It's only about 400 lines at the moment but getting bigger the way I
 am working

 Is it likely to slow the pages much even if only some of the functions are
 called from particular pages.

 Thanks,
 Abe

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