php-general Digest 13 Mar 2005 21:42:01 -0000 Issue 3336

Topics (messages 210607 through 210624):

inserting arabic into mysql
        210607 by: p80
        210613 by: AN.S

Re: Building PHP5 on Windows - VS.net?
        210608 by: Jim Plush

XHTML and dynamic javascripts
        210609 by: Robbert van Andel
        210611 by: Mikey
        210612 by: Robbert van Andel

How TO monitor upload speed?
        210610 by: zini10

A little disturbing query !!!
        210614 by: AN.S
        210615 by: Guillermo Rauch
        210619 by: Jochem Maas

passing variables between pages without sessions
        210616 by: Ross Hulford
        210617 by: Robbert van Andel
        210618 by: R. Van Tassel

Re: PHP causes Apache segmentation fault?
        210620 by: John Swartzentruber
        210621 by: John Swartzentruber
        210622 by: John Swartzentruber

Re: software catalog
        210623 by: Judson Vaughn

Image Galery
        210624 by: Fernando Cosso

Administrivia:

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

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

To post to the list, e-mail:
        php-general@lists.php.net


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

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

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

Anas

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

-- 

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
 

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 <![CDATA[ script goes here ]]>.  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

 

 


--- End Message ---
--- Begin Message ---
> 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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---
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, 

--- End Message ---
--- Begin Message ---
> 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.'%' );

--- End Message ---
--- Begin Message --- [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.

<?php

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



--- End Message ---
--- Begin Message ---
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. 

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
Pass the variables through the URL string

<a href="mypage.php?myvariable=myvalue">Click Here</a>

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

--- End Message ---
--- Begin Message ---
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?
--- End Message ---
--- Begin Message ---
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?
--- End Message ---
--- Begin Message --- 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.
--- End Message ---
--- Begin Message --- 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.


--- End Message ---
--- Begin Message ---
Hi

This e-mail is to promote the script Picture's Organizer made on PHP, MySQL.
Please don't think this is spam or something similar, because it's under the terms of the GNU General Public License.


The oficial page of the proyect is www.picturesorganizer.com.ar. There you'll find downloabled packages and a demo.
If you want to join on the proyect as developer, reporting bugs , translator or just send a suggestion, please e-mail me.
Thanks
Fernando Cosso





--- End Message ---

Reply via email to