Re: [PHP] newbie php/mysql need help

2005-03-13 Thread Burhan Khalid
p80 wrote:
I do a mysql request like this one:
SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where category like 
'sold' group by brand"
Try adding aliases to your query, such as :
SELECT DISTINCT (brand), COUNT (brand) AS brand_count FROM `machines` 
WHERE `category` LIKE 'sold' GROUP BY `brand`

Then, you can echo the result thusly:
while($row = mysql_fetch_assoc($result))
{
   echo $row['brand'];
   echo $row['brand_count'];
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include("sendmail.phps");

2005-03-13 Thread Burhan Khalid
John Taylor-Johnston wrote:
I want to include a phps file. But would like it to display the coloured 
formatting of a phps, instead of executing the code with in. Is this possible? 
This does not work:
include("sendmail.phps");
http://www.php.net/highlight-file
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] include("sendmail.phps");

2005-03-13 Thread Robbert van Andel
Read the contents of the file into a variable and then output the contents
of the variable via print or echo.

-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 13, 2005 10:09 PM
To: php-general@lists.php.net
Subject: [PHP] include("sendmail.phps");

I want to include a phps file. But would like it to display the coloured
formatting of a phps, instead of executing the code with in. Is this
possible? This does not work:
include("sendmail.phps");
Thanks,
John

--
John Taylor-Johnston

-
"If it's not Open Source, it's Murphy's Law."

  ' ' 'Collège de Sherbrooke:
 ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
- 819-569-2064

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign
Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

-- 
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] include("sendmail.phps");

2005-03-13 Thread John Taylor-Johnston
I want to include a phps file. But would like it to display the coloured 
formatting of a phps, instead of executing the code with in. Is this possible? 
This does not work:
include("sendmail.phps");
Thanks,
John

--
John Taylor-Johnston
-
"If it's not Open Source, it's Murphy's Law."

  ' ' 'Collège de Sherbrooke:
 ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
- 819-569-2064

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

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



RE: [PHP] php 4 & php 5

2005-03-13 Thread Hans Zaunere

> Do you mean by using virtual host directives of apache ?
> 
> But how about the configuration to make requests for certain
> directories to be handled by php4 or php5.
> 
> For ex.
> 
> /var/www/html/site needs php5 but /var/www/html/legacy does not
> support php5 so I have to run php4.
> 
> Any tips regarding the configuration of php and/or apache ?

Per option 1 below, they were saying two installs of Apache or one install of 
Apache directed to use different httpd.conf files, then to use different ports 
for each instance.  The same thing can be accomplished using two IP addresses 
if available, instead of two different points.


---
Hans Zaunere
President, Founder

New York PHP
http://www.nyphp.org

AMP Technology
Supporting Apache, MySQL and PHP


> > > > Is there a way to install two version of php on the same machine, and
> > > > use them for two different users?
> > >
> > > Option 1:
> > > Install two copies of Apache, with different httpd.conf files, on two
> > > different ports.
> > > Somebody gets stuck using http://example.com:81 (or any port but 80) but
> > > this gives everything you asked for.
> >
> > Or make Apache listen on two IPs - if your provider will do this, or it's 
> > your own
> box, there's not downside.  You could use two domains, or two different 
> subdomains.
> >
> > > Option 4:
> > > In terms of expenses/headaches, you will probably be better off just
> > > buying a second machine.  Problem solved.
> >
> > If you get another machine, you'll need two domains or subdomains anyway.  
> > Just
> put them on the same box, with two IPs.
> >
> > ---
> > Hans Zaunere
> > President, Founder
> >
> > New York PHP
> > http://www.nyphp.org
> >
> > AMP Technology
> > Supporting Apache, MySQL and PHP
> >
> > --
> > 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 Get URL?

2005-03-13 Thread Jeffery Fernandez
Labunski wrote:
How to get url of the page the php script is on?
In other words, I want to know whether I'm in page "news.php" or in 
"posts.php", or in some other page. Is there any simple way to get tis info?

Thanks,
Lab. 

 

if (basename($_SERVER['PHP_SELF']) == 'news.php')
{
   // do whatever you want
}
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] How to Get URL?

2005-03-13 Thread Labunski
How to get url of the page the php script is on?

In other words, I want to know whether I'm in page "news.php" or in 
"posts.php", or in some other page. Is there any simple way to get tis info?


Thanks,
Lab. 

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



[PHP] PHP5 & JBOSS

2005-03-13 Thread david joffrin
Hi,
I searched on the net, found a lot of articles about it... followed all the 
various one by one, tried a lot, but I am getting the famous error: 
java.lang.UnsatisfiedLinkError: no php5servlet.dll in java.library.path.

Here is the steps I folllowed:
1) Get PHP5 PECL and copy to jbossweb-tomcat50.sar the phpsrvlt jar file. I 
modified the content of reflect.properties and servlet.porperties to refer 
to the php5servlet.dll library.
2) Copied to windows/system32 the php5servlet.dll and php5ts.dll.
3) web.xml contains the following line:
   
   php
   net.php.servlet
   2
   
   
   php
   *.php
   

I modified my application to display the java.librara.path which lists (of 
course) c:/windows/system32 path.

However, I am having the message just listed above.
Any clue?
Note that I have tried with the dll extension in the both property files, 
but still the same.

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


Re: [PHP] php 4 & php 5

2005-03-13 Thread mbneto
Hi Hans,

Do you mean by using virtual host directives of apache ?

But how about the configuration to make requests for certain
directories to be handled by php4 or php5.

For ex.

/var/www/html/site needs php5 but /var/www/html/legacy does not
support php5 so I have to run php4.

Any tips regarding the configuration of php and/or apache ?

- thks


On Fri, 4 Mar 2005 18:13:13 -0500, Hans Zaunere <[EMAIL PROTECTED]> wrote:
> 
> 
> > > Is there a way to install two version of php on the same machine, and
> > > use them for two different users?
> >
> > Option 1:
> > Install two copies of Apache, with different httpd.conf files, on two
> > different ports.
> > Somebody gets stuck using http://example.com:81 (or any port but 80) but
> > this gives everything you asked for.
> 
> Or make Apache listen on two IPs - if your provider will do this, or it's 
> your own box, there's not downside.  You could use two domains, or two 
> different subdomains.
> 
> > Option 4:
> > In terms of expenses/headaches, you will probably be better off just
> > buying a second machine.  Problem solved.
> 
> If you get another machine, you'll need two domains or subdomains anyway.  
> Just put them on the same box, with two IPs.
> 
> ---
> Hans Zaunere
> President, Founder
> 
> New York PHP
> http://www.nyphp.org
> 
> AMP Technology
> Supporting Apache, MySQL and PHP
> 
> --
> 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 Frameworks

2005-03-13 Thread Simon Reye
Jeffery Fernandez wrote:
Simon Reye wrote:
I'm moving away from Cold Fusion and am considering java or php.  I've 
mucked around with Struts and Coccoon on the java side and think they 
are great.  There does not however seem to be any well backed projects 
similar to these for php.

Can anyone point me to a good php MVC framework?
here you go: 
http://wact.sourceforge.net/index.php/MvcFrameworksWrittenInPhp

cheers,
Jeffery
Thanks Jeff,
There a quite a few in that list some not even out of alpha stage and 
some of the more popular ones have not had much work done to them in 
over a year.  Have you personally tried any of them?

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


Re: [PHP] PHP Frameworks

2005-03-13 Thread Jeffery Fernandez
Simon Reye wrote:
I'm moving away from Cold Fusion and am considering java or php.  I've 
mucked around with Struts and Coccoon on the java side and think they 
are great.  There does not however seem to be any well backed projects 
similar to these for php.

Can anyone point me to a good php MVC framework?
here you go: http://wact.sourceforge.net/index.php/MvcFrameworksWrittenInPhp
cheers,
Jeffery
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] PHP Frameworks

2005-03-13 Thread Simon Reye
I'm moving away from Cold Fusion and am considering java or php.  I've 
mucked around with Struts and Coccoon on the java side and think they 
are great.  There does not however seem to be any well backed projects 
similar to these for php.

Can anyone point me to a good php MVC framework?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: eregi expression for checking a domain

2005-03-13 Thread Jim Plush
also, note I used preg_match instead of ereg, preg is a better choice 
over ereg usually (flexibility, speed, etc)

Ross Hulford wrote:
Does anyone know a working eregi expression for determining a domain is 
valid? don't need the http:// just looking for www.thedomain.com

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


[PHP] Re: eregi expression for checking a domain

2005-03-13 Thread Jim Plush
this should work for any web address starting with www.
// test for domain
$domain = "www.example.com";
// This pattern will match anything that STARTS with www followed by a 
period, followed by at least 2 characters,
// numbers and periods followed by a period followed by at least two 
characters
$pattern = "#^www\.([a-zA-Z0-9.-]{2,}\.[a-zA-Z]{2,})$#";

if(preg_match($pattern, $domain, $matches))
{
echo 'Matched. Domain is: '.$matches[1];
} else {
echo 'NO MATCHY DUDE';
}
Ross Hulford wrote:
Does anyone know a working eregi expression for determining a domain is 
valid? don't need the http:// just looking for www.thedomain.com

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


[PHP] Re: passing variables between pages without sessions

2005-03-13 Thread Jim Plush
Ross, is there a reason you don't want to use sessions again?
Creating an associative array of each pages answers is much cleaner than 
passing hidden fields or get vars.

Another option you could use it write the files to disk after each page 
save, that way if anything goes wrong(IE user computer shuts down) you 
dont have to have them start from scratch, you can load all the data 
from disk and have them start where they left off. If you're going to do 
multi page that option is the best for not pissing off customers because 
they can finish the form on their timeline.

Ross Hulford wrote:
I am creating a form but instead of having a long form I want to break it 
down into a few stages but need to pass the variables bewteen the pages.

I have done this before using sessions but would like to know if there is an 
alternative way to do this?

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


[PHP] eregi expression for checking a domain

2005-03-13 Thread Ross Hulford
Does anyone know a working eregi expression for determining a domain is 
valid? don't need the http:// just looking for www.thedomain.com

cheers,


R. 

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



RE: [PHP] newbie php/mysql need help

2005-03-13 Thread Robbert van Andel
Simple but should work.

$query = " SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where
category like 'sold' group by brand;";

$result = mysql_query($query) or die(mysql_error());

While($data = mysql_fetch_array($result)) {
echo "{$data[0]} - {$data[1]}\n";
}

-Original Message-
From: p80 [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 13, 2005 4:35 PM
To: php-general@lists.php.net
Subject: [PHP] newbie php/mysql need help


I do a mysql request like this one:

SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where category like 
'sold' group by brand"

I get this from mysql:
brand COUNT( brand)
brandx4
brandy12

how can I echo this result in php?

thanx in advance

Pat

-- 
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] newbie php/mysql need help

2005-03-13 Thread p80

I do a mysql request like this one:

SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where category like 
'sold' group by brand"

I get this from mysql:
brand COUNT( brand)
brandx4
brandy12

how can I echo this result in php?

thanx in advance

Pat

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



[PHP] ayuda

2005-03-13 Thread Pedro Luis Cruz Riguetti

-- 




como pueddo hacer para salir de esta lista 

---
Banco de Crédito BCP - Dedicados a hacerte la Banca más simple.
Visita nuestra Banca por Internet http://www.viabcp.com
---

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



RE: [PHP] software catalog

2005-03-13 Thread Robbert van Andel
I've used Zen Cart (http://www.zen-cart.com/modules/frontpage/) in the past.

-Original Message-
From: Judson Vaughn [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 13, 2005 3:05 PM
To: [EMAIL PROTECTED]
Cc: Ryan A; php
Subject: Re: [PHP] software catalog

X-Cart has a very nice feature for delivering "intangibles". But it is 
around $285.

Jud.



Judson Vaughn
[EMAIL PROTECTED] | [EMAIL PROTECTED]
Seiter Vaughn  Communications
12455 Plowman Court
Herndon, VA 20170
703.450.9740
svc


Richard Lynch wrote:
>>Hey!
>>Anybody know of a "software catalog" (or cart preferably) that is free?
>>
>>A site i am working for sells software, now they want to have a cart
>>feature
>>so people can put the packages in a cart and get discounts etc if they
>>purchase more than 1 product...they are using 2checkout for processing.
>>
>>I checked the usual places and google of "php software cart" but got back
>>garbled results, most of that carts are for tangible products :-(
> 
> 
> This might have "sells intangibles" as a feature check point:
> 
> http://l-i-e.com/compare/index.htm?date=1970-01-01
> 
> Or you can add it and check back after some people "vote"
> 
> Disclaimer: I hacked this up after the umpteen flame war about PHP
> Shopping Carts on this list in, oh, call it 2000 or so...  God only knows
> which of those solutions is way out of date or whatever.  Caveat Emptor.
> 

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

2005-03-13 Thread Judson Vaughn
X-Cart has a very nice feature for delivering "intangibles". But it is 
around $285.

Jud.

Judson Vaughn
[EMAIL PROTECTED] | [EMAIL PROTECTED]
Seiter Vaughn  Communications
12455 Plowman Court
Herndon, VA 20170
703.450.9740
svc
Richard Lynch wrote:
Hey!
Anybody know of a "software catalog" (or cart preferably) that is free?
A site i am working for sells software, now they want to have a cart
feature
so people can put the packages in a cart and get discounts etc if they
purchase more than 1 product...they are using 2checkout for processing.
I checked the usual places and google of "php software cart" but got back
garbled results, most of that carts are for tangible products :-(

This might have "sells intangibles" as a feature check point:
http://l-i-e.com/compare/index.htm?date=1970-01-01
Or you can add it and check back after some people "vote"
Disclaimer: I hacked this up after the umpteen flame war about PHP
Shopping Carts on this list in, oh, call it 2000 or so...  God only knows
which of those solutions is way out of date or whatever.  Caveat Emptor.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP causes Apache segmentation fault?

2005-03-13 Thread John Swartzentruber
On 3/13/2005 3:55 PM John Swartzentruber wrote:
On 3/11/2005 11:57 AM John Swartzentruber wrote:
I am running Fedora core3 with Apache 2.0.52 (from default RPMs), 
MySQL 4.1.10 (from RPMs from MySQL site), and PHP 5.0.3 built from 
source.

I'm going through the PHP manual and trying some of the mysqli 
examples. The last one I tried didn't work. The problem appears to 
be this line:

$row = $result->fetch_array(MYSQLI_ASSOC);
Using MYSQLI_BOTH also fails, and MYSQLI_NUM works.
This is what is in my httpd error log:
[Thu Mar 10 17:07:06 2005] [notice] child pid 29903 exit signal 
Segmentation fault (11)

I've reported this as a PHP bug and then continued to do some more 
research. What I'm finding is very odd.

When I run this script under apache, it appears that there is a clash 
between the structures used in a MySQL library and what is in the 
mysql.h header file. When I do a phpinfo(), it says that my mysqli 
client API version is "3.23.58". That seems wrong. I have MySQL 4.1.10a 
installed. This version difference *could* explain the difference, but I 
have no idea why it would be using the old version. The libmysql 
libraries and programs are all dated March 9, 2005 or later. The 
--with-mysqli configure parameter points to a mysql_config program with 
that date. Why would it think it was using an older API?

Another very weird thing is that when I run the script directly from the 
command line, the structure looks good and has all of the correct (i.e., 
expected) values. What is different about running PHP from the command 
line and from Apache that would cause it to use different MySQL structures?
Sorry to reply to myself, but here's the succinct question:
When I run phpinfo(), it says my mysqli API client version is 3.23.58. 
When I run "php -i" from the command line it says it is 4.1.10a. The 
latter is correct. What would cause the discrepancy? The server has been 
stopped and started many times, and PHP rebuilt a few times, so it isn't 
a browser buffer issue.

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


Re: [PHP] PHP causes Apache segmentation fault?

2005-03-13 Thread John Swartzentruber
On 3/11/2005 11:57 AM John Swartzentruber wrote:
I am running Fedora core3 with Apache 2.0.52 (from default RPMs), 
MySQL 4.1.10 (from RPMs from MySQL site), and PHP 5.0.3 built from 
source.

I'm going through the PHP manual and trying some of the mysqli 
examples. The last one I tried didn't work. The problem appears to be 
this line:

$row = $result->fetch_array(MYSQLI_ASSOC);
Using MYSQLI_BOTH also fails, and MYSQLI_NUM works.
This is what is in my httpd error log:
[Thu Mar 10 17:07:06 2005] [notice] child pid 29903 exit signal 
Segmentation fault (11)
I've reported this as a PHP bug and then continued to do some more 
research. What I'm finding is very odd.

When I run this script under apache, it appears that there is a clash 
between the structures used in a MySQL library and what is in the 
mysql.h header file. When I do a phpinfo(), it says that my mysqli 
client API version is "3.23.58". That seems wrong. I have MySQL 4.1.10a 
installed. This version difference *could* explain the difference, but I 
have no idea why it would be using the old version. The libmysql 
libraries and programs are all dated March 9, 2005 or later. The 
--with-mysqli configure parameter points to a mysql_config program with 
that date. Why would it think it was using an older API?

Another very weird thing is that when I run the script directly from the 
command line, the structure looks good and has all of the correct (i.e., 
expected) values. What is different about running PHP from the command 
line and from Apache that would cause it to use different MySQL structures?

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


Re: [PHP] A little disturbing query !!!

2005-03-13 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
Hello, 
I have a query that I'm unable to work it out, each time I run it I get
some error, I need your help. 

I have a webtemplates table which contains some basic information about
each template (author, price, description, ...etc). I created a search
form that a user can use to search by type(by description, author,
..etc) he chooses the type he want (radio button) then types his
searchterm,  and the following query works very fine:
$query = "SELECT * FROM templates where ".$_POST[searchtype]." LIKE
'%".$_POST[searchterm]."%'";
But now I need the search to be more advanced, the user may enter a
price range to find results within a range of two numbers, I have added
to the form two textfields the first for the low price ($lprice) the
second for the high price ($hprice).. the 'price' field is located in
the same table (templates).
Now I want to  add to the query to make it does the following:
- if the user doesn't type any price range, the above query will be
executed.
- if he typed a price range, it'll be taken into consideration with the
within the cretirea he wanted.
for example, he may search for templates authored by John and their
prices are between 30 and 50.
I'm a php newbie, so I got error messages each time I try to extend my
simple query, I hope I can find some assistance here :)
basically no want to add a dynamic number of search criteria (bits of the 
WHERE
clause) to a base query. lets assume that you just want to AND the search 
criteria.

$qry= 'SELECT * FROM templates'; // better to specify the fields you want.
$where  = array();
// I leave the error checking out for simplicity...
// you are checking/sanitizing the user submitted values before using them I 
hope.
// e.g. that searchtype is a field, searchterm has quotes/etc escaped, lprice &
// hprice are actually numeric, greater than zero, etc.
if (isset($_POST['searchtype']) && isset($_POST['searchterm'])) {
$where[] = '{$_POST['searchtype']} LIKE %{$_POST['searchterm']}%'";
}
if (isset($_POST['lprice'])) {
// the following expression is a ternary operator - alternative form of
// an 'if' statement
$where[] = isset($_POST['hprice'])
 ? "price >= $_POST['lprice'] AND price <= $_POST['hprice']";
 : "price >= $_POST['lprice']";
}
if (count($where)) {
$qry .= ' WHERE '.join(' AND ',$where);
}
?>
play with this code. use echo, print(), print_r(), var_dump() etc to find
out what it does. look up functions you don't know (e.g. possibly join())
in the manual then if you get stuck, by all means ask questions :-)
have fun.
Thank You, 

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


RE: [PHP] passing variables between pages without sessions

2005-03-13 Thread R. Van Tassel
Pass the variables through the URL string

Click Here

On the next page echo $myvariable and get "myvalue".



-Original Message-
From: Ross Hulford [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 13, 2005 3:06 PM
To: php-general@lists.php.net
Subject: [PHP] passing variables between pages without sessions

I am creating a form but instead of having a long form I want to break it 
down into a few stages but need to pass the variables bewteen the pages.

I have done this before using sessions but would like to know if there is an

alternative way to do this?

R. 

-- 
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] passing variables between pages without sessions

2005-03-13 Thread Robbert van Andel
With each subsequent page load, have hidden fields that store the values of
the previous page's form.  There might be another way, but that comes to
mind.


-Original Message-
From: Ross Hulford [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 13, 2005 2:06 PM
To: php-general@lists.php.net
Subject: [PHP] passing variables between pages without sessions

I am creating a form but instead of having a long form I want to break it 
down into a few stages but need to pass the variables bewteen the pages.

I have done this before using sessions but would like to know if there is an

alternative way to do this?

R. 

-- 
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] passing variables between pages without sessions

2005-03-13 Thread Ross Hulford
I am creating a form but instead of having a long form I want to break it 
down into a few stages but need to pass the variables bewteen the pages.

I have done this before using sessions but would like to know if there is an 
alternative way to do this?

R. 

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



Re: [PHP] A little disturbing query !!!

2005-03-13 Thread Guillermo Rauch
> Hello,
Hi, 
> $query = "SELECT * FROM templates where ".$_POST[searchtype]." LIKE
> '%".$_POST[searchterm]."%'";

Although it works, always put the array index as a string between quotes.
$_POST[searchterm] to $_POST['searchterm']

> 
> But now I need the search to be more advanced, the user may enter a
> price range to find results within a range of two numbers, I have added
> to the form two textfields the first for the low price ($lprice) the
> second for the high price ($hprice).. the 'price' field is located in
> the same table (templates).

You can start with a basic query like

$sql = 'SELECT * FROM `templates` WHERE `price` < %s AND `price` > %s
AND `%s` LIKE '%s';

If there's no start price, you put in the query `price` + 1, as
`price` will be always lower than `price` + 1.

if(!_POST['sprice'] ) {
  $sprice = '`price` + 1;
}

And the same with endprice ($eprice)..

Then you replace the %s

$sql = sprintf( $sql, $sprice, $eprice, $a, '%'.$b.'%' );

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



[PHP] A little disturbing query !!!

2005-03-13 Thread [EMAIL PROTECTED]
Hello, 
I have a query that I'm unable to work it out, each time I run it I get
some error, I need your help. 

I have a webtemplates table which contains some basic information about
each template (author, price, description, ...etc). I created a search
form that a user can use to search by type(by description, author,
..etc) he chooses the type he want (radio button) then types his
searchterm,  and the following query works very fine:

$query = "SELECT * FROM templates where ".$_POST[searchtype]." LIKE
'%".$_POST[searchterm]."%'";

But now I need the search to be more advanced, the user may enter a
price range to find results within a range of two numbers, I have added
to the form two textfields the first for the low price ($lprice) the
second for the high price ($hprice).. the 'price' field is located in
the same table (templates).

Now I want to  add to the query to make it does the following:

- if the user doesn't type any price range, the above query will be
executed.

- if he typed a price range, it'll be taken into consideration with the
within the cretirea he wanted.

for example, he may search for templates authored by John and their
prices are between 30 and 50.

I'm a php newbie, so I got error messages each time I try to extend my
simple query, I hope I can find some assistance here :)

Thank You, 

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



Re: [PHP] inserting arabic into mysql

2005-03-13 Thread [EMAIL PROTECTED]
Hello, 

Try to set the charachter encoding of your page to: Arabic(Windows-1256)

Anas

>
SSBoYXZlIGEgdGV4dCBhcmVhIGZvcm0gYW5kIHdoZW4gSSBpbnNlcnQgaXQgaW50byBteXNxbCBJ
>
IGdldCBsZXR0ZXJzIGxpa2UgCnRoaXM6CsOZIsOZxaDDmMKow5jCqsOZ4oCgw5kiw5nigKbDmeKA
>
oMOYwqjDmcWgw5jCqsOZIiDDmeKAoMOZxaDDmMKow5kiCsOYwqjDmcWgIArDmSLDmMKow5jCrMOZ
>
xaAuLi4KaW5zdGVhZCBvZiBhcmFiaWMgbGV0dGVycy4gYW55dGhpbmcgSSBrbm93IGRvIHRvIGdl
> dCBpdCByaWdodD8KCnRoYW54IGluIGFkdmFuY2UK
> 
> 
> 

-- 

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



RE: [PHP] XHTML and dynamic javascripts

2005-03-13 Thread Robbert van Andel
Thanks, that worked.  

-Original Message-
From: Mikey [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 13, 2005 12:18 PM
To: php-general@lists.php.net
Subject: RE: [PHP] XHTML and dynamic javascripts

> Now down to the PHP specific question.  Is there a way to 
> generate an externally linked javascript file?  The 
> javascript functions in question are created from data 
> sitting in a MySQL data, so I can't hard code the javascript.

Yes, just change the .js extension to .php

HTH,

Mikey

-- 
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] XHTML and dynamic javascripts

2005-03-13 Thread Mikey
> Now down to the PHP specific question.  Is there a way to 
> generate an externally linked javascript file?  The 
> javascript functions in question are created from data 
> sitting in a MySQL data, so I can't hard code the javascript.

Yes, just change the .js extension to .php

HTH,

Mikey

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



[PHP] How TO monitor upload speed?

2005-03-13 Thread zini10
is it possible to watch upload speed (HTTP Post upload) using php alone?
i know this is possible using a combination of php and cgi(cgi for upload 
and php for monitoring the upload) but it's complicated and thus 
unreliable...
do u have any other ideas?

thanks.

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



[PHP] XHTML and dynamic javascripts

2005-03-13 Thread Robbert van Andel
 

I am working to convert my website to XHTML and ran into a compliance
problem with several dynamically created javascripts.  According to the
XHTML specification, embedded javascripts are now supposed to now be
enclosed with .  The problem is that it's not
supported by IE or firefox and throughs javascript errors.  So the other
option is to use externally linked javascript files.  

 

Now down to the PHP specific question.  Is there a way to generate an
externally linked javascript file?  The javascript functions in question are
created from data sitting in a MySQL data, so I can't hard code the
javascript.

 

Thanks,

Robbert van Andel

 

 



[PHP] Re: Building PHP5 on Windows - VS.net?

2005-03-13 Thread Jim Plush
do you happen to remember what issues you may have had?
thanks again
[EMAIL PROTECTED] wrote:
Jim,
   i had only minor issues, but it builds fine otherwise.
"Jim Plush" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Has anyone successfully built php5 using visual studio.net ? or is VC6 
still only supported?

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


[PHP] inserting arabic into mysql

2005-03-13 Thread p80
I have a text area form and when I insert it into mysql I get letters like 
this:
Ã"ÃÅÃÂÃÂÃâÃ"ÃâÃâÃÂÃÅÃÂÃ" ÃâÃÅÃÂÃ"
ÃÂÃÅ 
Ã"ÃÂÃÂÃÅ...
instead of arabic letters. anything I know do to get it right?

thanx in advance


Re: [PHP] SimpleXML add a node

2005-03-13 Thread Claudio
@richard
> I dunno about that whole try/catch thing, but if you're not going to USE
> it to catch the errors, then you might as well be old school and check the
> return values of all these functions.

that sounds good, but , so far I know, if the API says that a function _can_ 
throw an exception, I _must_ catch it. In this case 'importNode', 
'appendChild', and 'createElement'. If I'm wrong please correct me.

> Since it "works" once and not the second time, I'd be looking to see if
> the XML produced on the first go-around is actually VALID, since, if it's
> not, that would cause this problem, I think.

The first time 'dom_import_simplexml' returns a DOMElement, the second a 
DOMDocument. I don't know why.
The string version of the first SimpleXML is: (that produces a DOMElement)

The string version of the second SimpleXML is: (that produce a DOMDocument)


@jason
I'm alredy using the 'dom_import_simplexml' function (line 5, code anexed)

@jochem
'instanceof' used now, thanks for reminding. Also if in this case it wasn't 
the prpblem.


last of all, a probalbly readable version of the code:
---
// check if there is a valid simplexml document
if (!($this->configXML instanceof SimpleXMLElement)) 
$this->createConfigXML();
   $dom = new DOMDocument('1.0');
   // create a DOMElement from SimpleXML
   $domElem = dom_import_simplexml($this->configXML);
   if ( $domElem === false ) return false;
  echo "\n\r".'1:';var_dump($domElem);echo "\n\r";
try {
 // import DOMElement(simplexml) to empty DOMDocument
 $domNode = $dom->importNode($domElem,true);
 if ( $domNode === false ) return false;
  // append the imported node to the DOMDocument
 $domNode = $dom->appendChild($domNode);
  // create new DOMElement
  $domElem = $dom->createElement(($mode? 'softactive':'active'));
 // add new Element to DOMElement(simplexml)
  $domNode->appendChild( $domElem );
} catch(Exception $e) {
  echo 'EXCEPTION: '.$e->getMessage().'';
  return false;
}
   // redefine old simplexml
   $simplexml = simplexml_import_dom($dom);
   if ($simplexml === false) return false;
   $this->configXML = $simplexml;
  echo '2:';echo $this->configXML->asXML();echo "\n\r";
}
return true;

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