php-general Digest 28 Jan 2006 07:51:37 -0000 Issue 3931

Topics (messages 229371 through 229392):

PHP Frameworks?
        229371 by: Jay Paulson
        229389 by: Richard K Miller

Re: doubt regarding while loop
        229372 by: David Grant
        229380 by: David Hall

PHP Job Opening in UAE
        229373 by: M Saleh EG
        229379 by: Miles Thompson

get key of array (key function sucks?)
        229374 by: Sjef
        229388 by: David Robley

questions regarding PHP and Forms
        229375 by: Paul Goepfert
        229376 by: Jay Paulson
        229377 by: Austin Denyer
        229378 by: Weber Sites LTD

PHP Newsletter
        229381 by: Jedidiah

php classes and data retrieval
        229382 by: robert

A black thumbnail.
        229383 by: tedd
        229384 by: Philip Hallstrom
        229390 by: Richard Correia
        229392 by: Weber Sites LTD

Adding XMLDBX to PHP CVS
        229385 by: Mark

Please help with apache 2
        229386 by: PHP
        229387 by: The Doctor

Re: Apache is not parsing .php files
        229391 by: Richard Correia

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 ---
Has anyone used any of the following frameworks?  What is the general
opinion of using frameworks etc?

WASP - http://wasp.sourceforge.net/content/
Symfony - http://www.symfony-project.com/
Prado - http://www.xisc.com/
WACT - http://www.phpwact.org/
CakePHP - http://www.cakephp.org/

--- End Message ---
--- Begin Message --- I haven't used them, but our local user group recently had a meeting on PHP frameworks[1]. The feeling of the people that have used them was that Symfony was a good project, and that CakePHP was a particularly large installation. No one mentioned having used Prado, WACT or WASP.

We also had the creator of PHP on Trax present on the framework he created that very closely resembles Ruby on Rails. His company used Trax to build KatrinaHousing.org, a site that helped hurricane victims find housing. I have a copy of his (John Peterson's) slides on my website[2].

Richard

[1] http://uphpu.org/article.php?story=2006011715500753
[2] http://richardkmiller.com/blog/archives/2006/01/eventful-month-in- technology (third section)

On Jan 27, 2006, at 10:25 AM, Jay Paulson wrote:

Has anyone used any of the following frameworks?  What is the general
opinion of using frameworks etc?

WASP - http://wasp.sourceforge.net/content/
Symfony - http://www.symfony-project.com/
Prado - http://www.xisc.com/
WACT - http://www.phpwact.org/
CakePHP - http://www.cakephp.org/

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


--- End Message ---
--- Begin Message ---
Suresh,

suresh kumar wrote:
> hi,
>    for eg 
>                           
> while(list(t1,t2,...)=mysql_fetch_row($result)):
>                             endwhile;

You could start with list($t1, $t2, ...) instead.  Personally, I'd done
it without assuming mysql_fetch_row is returning an array.

Try:

$t1 = "";
$t2 = "";
while ($row = mysql_fetch_row($result)) {
        list($t1, $t2) = $row;
        ...
}

echo $t1;

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg    0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

--- End Message ---
--- Begin Message ---
suresh kumar wrote:
while(list(t1,t2,...)=mysql_fetch_row($result)):

do you mean to use:
while(list($t1, $t2, . . .) = mysql_fetch_row($result)):

David Hall

--- End Message ---
--- Begin Message ---
Login Innovations, a new media & internet solutions studio in UAE is looking
for a resident-in-house PHP developer with at least 2 years experience.

Skills required:
OO knowledge and PHP5
PEAR aware
Framework and code libraries integration
CMS integration
SQL and PL-SQL (MySQL 4.x, MySQL 5)
XML and AJaX is plus

Send your resume to [EMAIL PROTECTED]

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

UAE = United Arab Emirates?

Do you want people on-site, or to work remotely?

Miles

At 02:05 PM 1/27/2006, M Saleh EG wrote:

Login Innovations, a new media & internet solutions studio in UAE is looking
for a resident-in-house PHP developer with at least 2 years experience.

Skills required:
OO knowledge and PHP5
PEAR aware
Framework and code libraries integration
CMS integration
SQL and PL-SQL (MySQL 4.x, MySQL 5)
XML and AJaX is plus

Send your resume to [EMAIL PROTECTED]


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.14.23/242 - Release Date: 1/26/2006

--- End Message ---
--- Begin Message ---
Hallo,
I am adding a value to a session variable (an array). Then I want to place 
the key of the array in another session variable to keep it for later use 
(so I can return to the array to write data to it). The key function should 
work there, but it seems to be a bit strange.

Imagine:

$array = array();
$array[] = "Yellow";
$array[] = "Geen";
$array[] = "Red";

foreach ($array as $key=>$value)
{
    print ("Key: " . $key . " has color " . $value . " | ");
    print ("current key = " . key($array) . "<br/>");
}

If you run the loop the key value returned from key is one higher than the 
key in $key, and the last key is null?

How do I get the present key without a problem??

Thanks!! 

--- End Message ---
--- Begin Message ---
Sjef wrote:

> Hallo,
> I am adding a value to a session variable (an array). Then I want to place
> the key of the array in another session variable to keep it for later use
> (so I can return to the array to write data to it). The key function
> should work there, but it seems to be a bit strange.
> 
> Imagine:
> 
> $array = array();
> $array[] = "Yellow";
> $array[] = "Geen";
> $array[] = "Red";
> 
> foreach ($array as $key=>$value)
> {
>     print ("Key: " . $key . " has color " . $value . " | ");
>     print ("current key = " . key($array) . "<br/>");
> }
> 
> If you run the loop the key value returned from key is one higher than the
> key in $key, and the last key is null?
> 
> How do I get the present key without a problem??

You've already got it in $key. I think you will find that foreach advances
the internal array pointer by one each time it loops, so what you have is
key($array) looking at the next array element from the one in $key and
$value.

Nothing wrong with key(), just a misunderstanding on your part about how
foreach works :-)

In simplified terms, the first time through the foreach loop, this happens:

pointer at element 0
$key gets value 0
$value gets value Yellow
pointer moved to element 1

Then you use key(), which gives you - guess what?



Cheers
-- 
David Robley

"I'll tempt Adam tonight," she said evilly.

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

I am  writing my first website in php.  I have a few questions.

1) I need to do vaildation on form values that I have entered into a
form.  Is there a way I can write the vaildation code on the same page
as the form in php?

2)  I have a drop down menu on one of my form fields.  What I want to
do is if a certain item is seelected I want to have a new textbox
appear below the drop down menu.  Is there a way to do this in php?

Thanks

Paul

--- End Message ---
--- Begin Message ---
> 1) I need to do vaildation on form values that I have entered into a
> form.  Is there a way I can write the vaildation code on the same page
> as the form in php?

Yes there sure is. :)

if (isset($submit)) {
    // data validation etc.
}
else {
    // display html form
}

> 2)  I have a drop down menu on one of my form fields.  What I want to
> do is if a certain item is seelected I want to have a new textbox
> appear below the drop down menu.  Is there a way to do this in php?

You'll have to do this via JavaScript. =/

Hope that helps!

--- End Message ---
--- Begin Message ---
On Fri, 27 Jan 2006 12:28:07 -0700
Paul Goepfert <[EMAIL PROTECTED]> wrote:
>
> I am  writing my first website in php.  I have a few questions.
> 
> 1) I need to do vaildation on form values that I have entered into a
> form.  Is there a way I can write the vaildation code on the same page
> as the form in php?

Yes.  What you do is check to see if you have any input, if not then
display the form, if you do then validate the input and skip the
display. 

> 2)  I have a drop down menu on one of my form fields.  What I want to
> do is if a certain item is seelected I want to have a new textbox
> appear below the drop down menu.  Is there a way to do this in php?

It depends.  If you want the text box to appear immediately then no,
you'll need JavaScript.  If you're ok with the user hitting submit and
being re-desplayed the same page, this time with the text box showing,
then that is trivial in php.  You can use the same process as the
validation in (1) above.

Regards,
Ozz.

Attachment: pgpyozMWSeeRP.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Check out this list of code examples to help with #1
http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=validatio
n

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
Free Uptime Monitor : http://uptime.weberdev.com
PHP content for your site : http://content.weber-sites.com
 

-----Original Message-----
From: Paul Goepfert [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 27, 2006 9:28 PM
To: php-general@lists.php.net
Subject: [PHP] questions regarding PHP and Forms

Hi all,

I am  writing my first website in php.  I have a few questions.

1) I need to do vaildation on form values that I have entered into a form.
Is there a way I can write the vaildation code on the same page as the form
in php?

2)  I have a drop down menu on one of my form fields.  What I want to do is
if a certain item is seelected I want to have a new textbox appear below the
drop down menu.  Is there a way to do this in php?

Thanks

Paul

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

--- End Message ---
--- Begin Message ---
I send out a daily email to an email list.  I have only been doing this for
about a week, and realized today that each one of them so far has had at
least one mysterious exclamation point somewhere in the email.  This is
sometimes in the middle of the word or sentence, but always out of place.  I
have tried replacing my quotation marks with single quotes, &quot;, and
adding a backslash before them as I was told the issue had something to do
with these, but none of this has helped.  

 

So first question.How do I lose this exclamation point?

 

And second questions.Is there anyway around changing my quotation marks to
something else or is that just part of it?

 

Thanks,

 

Jedidiah 


--- End Message ---
--- Begin Message ---
Hello!
I have a database and php classes and I'm not sure the best way I should be retrieving the data.

as below, if 'other' (line 9) is stored in the database as an id of a record in another table,
should my getData() method:

a. return the id as part of the MyObj object and whatever function
that called it is responsible for matching the id to the name?
or
b. should it look up the value from within the class?

(I read something about JOIN or stuff beyond SELECT --sorry i'm kinda just getting into this-- could bring a database to it's knees)

Also I thought that with OOP you are supposed to keep the classes independent of each other, but I was thinking if I need a MyObj I would want all the data in a ready usable form and not a mix of data and database ids.

I'm not sure what is the best practice or even if there is a correct one, but suggestions would be appreciated!

-robert


here is my set up:

DATABASE:
myobj_table with id, name, other as columns
other_table with id, name as columns

PHP CLASSES:
   1: <?php
   2:
   3: /* base object data structure */
   4: class MyObj {
   5:
   6:   function MyObj($id, $name, $other) {
   7:     $this->id = $id;
   8:     $this->name = $name;
   9:     $this->other = $other; // ?? ID OR VALUE ??
  10:   }
  11:
  12:   // getters/setters
  13:
  14: }
  15:
  16:
  17: /* create/update/delete database methods */
  18: class MyObjData {
  19:
  20:   var $_id;
  21:   var $_items;
  22:
  23:   function MyObjData($id) {
  24:     $this->_id = $id;
  25:   }
  26:
  27:   function getData() {
28: $query = "select * from myobject_table where id='" . $this- >_id . "'"; 29: $records = getDatabaseRecords($query); // some db action: returns an array of records
  30:     foreach ($records as $record) {
  31:       $data = new MyObj(
  32:           $record['id']
  33:         , $record['name']
  34:         , $record['other']
  35:         );
  36:       $this->_items[] = $data;
  37:       unset($data);
  38:     }
  39:     return $this->_items;
  40:   }
  41:
  42:   // other methods
  43:
  44: }
  45:
  46:
  47:
  48: ?>

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

I'm trying to create a thumbnail from a jpeg stored in a long blob in mySQL.

What's wrong here? I get an image that's the correct size, but it's black.

Any ideas?

Thanks.

tedd

<code>

$dbQuery = "SELECT image_type, image, image_width, image_height ";
$dbQuery .= "FROM pictures ";
$dbQuery .= "WHERE image_Id = $pic_id";
$result = mysql_query($dbQuery) or die("Couldn't get file list");

if(mysql_num_rows($result) == 1)
{
$fileType = @mysql_result($result, 0, "image_type");
$fileContent = @mysql_result($result, 0, "image");
$width_orig = @mysql_result($result, 0, "image_width");
$height_orig = @mysql_result($result, 0, "image_height");

// Set a maximum height and width
$width = 200;
$height = 200;

if ($width && ($width_orig < $height_orig))
   {
   $width = ($height / $height_orig) * $width_orig;
   }
else
   {
   $height = ($width / $width_orig) * $height_orig;
   }

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($fileContent);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

// Output
imagejpeg($image_p, null, 100);
}

</code>
--
--------------------------------------------------------------------------------
http://sperling.com/

--- End Message ---
--- Begin Message ---
(skip down)

I'm trying to create a thumbnail from a jpeg stored in a long blob in mySQL.
What's wrong here? I get an image that's the correct size, but it's black.

Any ideas?

<code>

$dbQuery = "SELECT image_type, image, image_width, image_height ";
$dbQuery .= "FROM pictures ";
$dbQuery .= "WHERE image_Id = $pic_id";
$result = mysql_query($dbQuery) or die("Couldn't get file list");

if(mysql_num_rows($result) == 1)
{
$fileType = @mysql_result($result, 0, "image_type");
$fileContent = @mysql_result($result, 0, "image");
$width_orig = @mysql_result($result, 0, "image_width");
$height_orig = @mysql_result($result, 0, "image_height");

// Set a maximum height and width
$width = 200;
$height = 200;

if ($width && ($width_orig < $height_orig))
  {
  $width = ($height / $height_orig) * $width_orig;
  }
else
  {
  $height = ($width / $width_orig) * $height_orig;
  }

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($fileContent);

imagecreatefromjpeg takes a *filename* not the actual contents of the file itself. So $image is going to be invalid so your next command isn't going to do what you think which means you're going to get black as that's probably the first/default color of $image_p.

-philip


imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

// Output
imagejpeg($image_p, null, 100);
}

</code>
--
--------------------------------------------------------------------------------
http://sperling.com/

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



--- End Message ---
--- Begin Message ---
Hi Tedd,

Dynamic Thumbnail generation:
http://www.weberdev.com/ViewArticle-388.html




On 1/28/06, tedd <[EMAIL PROTECTED]> wrote:
>
> Hi:
>
> I'm trying to create a thumbnail from a jpeg stored in a long blob in
> mySQL.
>
> What's wrong here? I get an image that's the correct size, but it's black.
>
> Any ideas?
>
> Thanks.
>
> tedd
>
> <code>
>
> $dbQuery = "SELECT image_type, image, image_width, image_height ";
> $dbQuery .= "FROM pictures ";
> $dbQuery .= "WHERE image_Id = $pic_id";
> $result = mysql_query($dbQuery) or die("Couldn't get file list");
>
> if(mysql_num_rows($result) == 1)
> {
> $fileType = @mysql_result($result, 0, "image_type");
> $fileContent = @mysql_result($result, 0, "image");
> $width_orig = @mysql_result($result, 0, "image_width");
> $height_orig = @mysql_result($result, 0, "image_height");
>
> // Set a maximum height and width
> $width = 200;
> $height = 200;
>
> if ($width && ($width_orig < $height_orig))
>    {
>    $width = ($height / $height_orig) * $width_orig;
>    }
> else
>    {
>    $height = ($width / $width_orig) * $height_orig;
>    }
>
> // Resample
> $image_p = imagecreatetruecolor($width, $height);
> $image = imagecreatefromjpeg($fileContent);
> imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
> $width_orig, $height_orig);
>
> // Output
> imagejpeg($image_p, null, 100);
> }
>
> </code>
> --
>
>

--- End Message ---
--- Begin Message ---
Check out this article : http://www.weberdev.com/ViewArticle-3.html

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP & MySQL Forums : http://www.weberforums.com
Learn PHP & MySQL Playing Trivia : http://www.webertrivia.com
Free Uptime Monitor : http://uptime.weberdev.com
 

-----Original Message-----
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 28, 2006 2:43 AM
To: php-general@lists.php.net
Subject: [PHP] A black thumbnail.

Hi:

I'm trying to create a thumbnail from a jpeg stored in a long blob in mySQL.

What's wrong here? I get an image that's the correct size, but it's black.

Any ideas?

Thanks.

tedd

<code>

$dbQuery = "SELECT image_type, image, image_width, image_height "; $dbQuery
.= "FROM pictures "; $dbQuery .= "WHERE image_Id = $pic_id"; $result =
mysql_query($dbQuery) or die("Couldn't get file list");

if(mysql_num_rows($result) == 1)
{
$fileType = @mysql_result($result, 0, "image_type"); $fileContent =
@mysql_result($result, 0, "image"); $width_orig = @mysql_result($result, 0,
"image_width"); $height_orig = @mysql_result($result, 0, "image_height");

// Set a maximum height and width
$width = 200;
$height = 200;

if ($width && ($width_orig < $height_orig))
    {
    $width = ($height / $height_orig) * $width_orig;
    }
else
    {
    $height = ($width / $width_orig) * $height_orig;
    }

// Resample
$image_p = imagecreatetruecolor($width, $height); $image =
imagecreatefromjpeg($fileContent);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
$width_orig, $height_orig);

// Output
imagejpeg($image_p, null, 100);
}

</code>
--
----------------------------------------------------------------------------
----
http://sperling.com/

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

--- End Message ---
--- Begin Message ---
I am thinking about adding XMLDBX, a pretty good XML serializer to CVS. It
is documented and available at www.mohawksoft.org.

Any comments?

--- End Message ---
--- Begin Message ---
Help, I can't find anything on this.
 
I upgraded from apache 1.3 to apache 2.2
 
My problem is, I currently have .htm files being parsed as php, that works fine.
 
However, if I have the php_engine turned off for a directory, any .htm files will now prompt firefox to download it.
 
How do I stop this? I need to keep .htm files parsed for php, but I also need to be able to turn php off for certain directories and still allow regular .htm files to be seen.
 
Thanks.
 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006

--- End Message ---
--- Begin Message ---
On Fri, Jan 27, 2006 at 06:03:50PM -0800, PHP wrote:
> Help, I can't find anything on this.
> 
> I upgraded from apache 1.3 to apache 2.2
> 
> My problem is, I currently have .htm files being parsed as php, that works 
> fine.
> 
> However, if I have the php_engine turned off for a directory, any .htm files 
> will now prompt firefox to download it.
> 
> How do I stop this? I need to keep .htm files parsed for php, but I also need 
> to be able to turn php off for certain directories and still allow regular 
> .htm files to be seen.
> 
> Thanks.
>

HAve you examined you php.ini and httpd.conf for any changes?
 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 

Content-Description: "AVG certification"
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006
> 

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

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]       Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
Born 29 Jan 1969 Redhill Surrey UK

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--- End Message ---
--- Begin Message ---
have you added .php .php3 .php4 extenstions to be treated as  php files?


Thanks,
Richard


On 1/27/06, sanjay <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a strange problem while trying to run php based applications.
>
> Lets start with phpMyAdmin, a very popular open source tool to manage
> MySQL written in php.
> I have already installed phpMyAdmin and was running fine.
> One day suddenly when I pointed my browser at :
> http://localhost/phpMyAdmin
> Instead of running the phpMyAdmin browser opened a message window with
> options-
> "Open With" or "Save to disk" .
> I am sure its not browser problem because I tried on Firefox-1.5,
> Mozilla, Epiphany and Konqueror.
>
> One more point I would like to add here that if I write one small php
> program and
> save it in as php file (test.php) then
> http://localhost/test.php
> executes properly
>
> I am using Fedora 2 and apache2, php-4.3x and mysql-3.x were part of the
> Fedora installation.
> The only change I made in the /etc/php.ini file was to increase the
> memory limit from 8MB to 12MB.
> (Then restarted the http server)
> Now even php.ini file is in the original state but problem is still there.
> The http.conf file is unchanged.
>
>
> Can any one give me some sort of idea.
>
> Thanks,
>
> Sanjay
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to