|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Thu May 01 2008 - 15:49:29 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 1 May 2008 20:49:29 -0000 Issue 5435
Topics (messages 273759 through 273791):
Re: equivalent to perl shift function
273759 by: Robin Vickery
Re: check if any element of an array is not "empty"
273760 by: Robin Vickery
273761 by: Richard Heyes
Re: Question regarding fopen
273762 by: Joep Roebroek
273764 by: James Dempster
273765 by: Joep Roebroek
273766 by: James Dempster
273767 by: Joep Roebroek
273769 by: Joep Roebroek
Re: web based chat app
273763 by: Børge Holen
273772 by: paragasu
273791 by: Nitsan Bin-Nun
mysql query and maximum characters in sql statement
273768 by: Sanjeev N
273778 by: Wolf
273787 by: Jim Lucas
273789 by: Jim Lucas
Re: Fun with SOAP.
273770 by: Eric Butera
extending Xpath
273771 by: Andrew Mason
273782 by: Jim Lucas
Re: Xampp question, pretty much 0T
273773 by: Ryan S
273774 by: Jason Pruim
273777 by: Ryan S
273779 by: Jason Pruim
273784 by: Ryan S
273785 by: Jason Pruim
Categories like wordpress
273775 by: Ryan S
273776 by: Dan Joseph
273780 by: Richard Heyes
273781 by: Brady Mitchell
273783 by: Richard Heyes
273786 by: Ryan S
273788 by: Brady Mitchell
273790 by: Ryan S
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
2008/5/1 Richard Luckhurst <rluckhurst
resmaster.com>:
> Hi Chris,
>
> In perl ther is the concept of
_ which is the list of incoming parameter to a
> subroutine. It is possible to have something like
>
> my $sock = shift;
>
> As I understand this the first parameter of the
_ list would be shifted.
>
> I see for array_shift there must be an argument, the array name to shift, while
> in perl if the array name is omitted the
_ function list is used. Is ther a php
> equivalent to the
_ list or how might I use array_shift to achieve the same
> result as in perl?
I''ve no idea why you want to handle arguments in the same way as perl does -
but func_get_args() returns the array of arguments to the function and you can
shift that with array_shift() if you like.
http://www.php.net/manual/en/function.func-get-args.php
-robin
attached mail follows:
2008/4/30 Nathan Nobbe <quickshiftin
gmail.com>:
> On Wed, Apr 30, 2008 at 2:58 PM, Richard Heyes <richardh
phpguru.org> wrote:
>
> > but I was thinking if there is the function does that.
> >>
> >
> > array_filter(). Note this:
> >
> > "If no callback is supplied, all entries of input equal to FALSE (see
> > converting to boolean) will be removed."
> >
> > http://uk3.php.net/manual/en/function.array-filter.php
>
>
> i dont really see how that gets him the answer without at least checking the
> number of elements in the array after filtering it w/ array_filter;
Because an empty array evaluates to false when cast to bool (which is
implicit in a conditional).
So this should work fine:
if (array_filter($myArray)) {
// only do this if there's stuff worth bothering with in myArray
}
attached mail follows:
> i dont really see how that gets him the answer without at least checking the
> number of elements in the array after filtering it w/ array_filter; which if
> he wanted to reuse in several places would make sense to write a simple
> function for anyway..
Yes, on both counts.
--
Richard Heyes
+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+
attached mail follows:
Does anyone have an idea? Is this a bug in PHP? Because when I add or
remove one static letter in the filename, it does work. And if I don't
the file is created, but the $imgstr (random 8 characters) is replaced
by a totally different value (also random 8 characters).. I have no
idea where this new value comes from.
regards,
Joep
2008/4/29 Joep Roebroek <j.roebroek
gmail.com>:
> Hi, I'm having a strange problem with fopen
>
> For clearence, here is the phpinfo page:
> http://www.grondengoed.nl/phpinfo.php
>
> I will shortly explain the problem I'm having:
> $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' .
> $i . '.jpg';
> echo $imagenamesmall; // For debugging purposses --> returns
> exactly what I want.
>
> //attempt to create folder
>
mkdir($foldersystem);
>
chmod($foldersystem, 0777);
>
>
> //save picture
> if(!($handle = fopen($imagenamesmall, 'w'))){
> echo "Cannot open file (31)";
> exit;
> }
>
> //$imagesmall, contains the image resource
>
> if(fwrite($handle, $imagesmall) === FALSE) {
> echo "Cannot write to file (32)";
> exit;
> }
>
> fclose($handle);
>
> Erverything works perfectly fine.But one thing, it doesn't give the
> file the name that it should get. A name for instance has to be:
> 54961tdtdtdtd-s0.jpg
> The number is the id of the database row, the 8 characters are random.
> -s stands for small and 0 is the picture index.
> When I echo the value, I get what I want. But when I save it, the
> random 8 character string had become a totally different 8 character
> string :S.
>
> I have googled and checked things over and over again, cost me hours
> and I still haven't found the reason. What is noticeable is that when
> I leave one character away from the name, the value IS what it schould
> be:S.
>
> I really hope you can help me, if you need further info yust ask.
>
> Thanks in advance.
>
> regards,
>
> Joep Roebroek
>
attached mail follows:
<?php
$foldersystem = getcwd().'/test1';
$id = '54961';
$imgstr = 'tdtdtdtd'; //uniqid();
$i = 2;
$imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg';
echo $imagenamesmall; // For debugging purposses --> returns exactly what I
want.
//attempt to create folder
mkdir($foldersystem);
chmod($foldersystem, 0777);
//save picture
if(!($handle = fopen($imagenamesmall, 'w'))){
echo "Cannot open file (31)";
exit;
}
This code works for me. How about you ?
--
/James
On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek <j.roebroek
gmail.com> wrote:
> Does anyone have an idea? Is this a bug in PHP? Because when I add or
> remove one static letter in the filename, it does work. And if I don't
> the file is created, but the $imgstr (random 8 characters) is replaced
> by a totally different value (also random 8 characters).. I have no
> idea where this new value comes from.
>
> regards,
> Joep
>
> 2008/4/29 Joep Roebroek <j.roebroek
gmail.com>:
> > Hi, I'm having a strange problem with fopen
> >
> > For clearence, here is the phpinfo page:
> > http://www.grondengoed.nl/phpinfo.php
> >
> > I will shortly explain the problem I'm having:
> > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' .
> > $i . '.jpg';
> > echo $imagenamesmall; // For debugging purposses --> returns
> > exactly what I want.
> >
> > //attempt to create folder
> >
mkdir($foldersystem);
> >
chmod($foldersystem, 0777);
> >
> >
> > //save picture
> > if(!($handle = fopen($imagenamesmall, 'w'))){
> > echo "Cannot open file (31)";
> > exit;
> > }
> >
> > //$imagesmall, contains the image resource
> >
> > if(fwrite($handle, $imagesmall) === FALSE) {
> > echo "Cannot write to file (32)";
> > exit;
> > }
> >
> > fclose($handle);
> >
> > Erverything works perfectly fine.But one thing, it doesn't give the
> > file the name that it should get. A name for instance has to be:
> > 54961tdtdtdtd-s0.jpg
> > The number is the id of the database row, the 8 characters are random.
> > -s stands for small and 0 is the picture index.
> > When I echo the value, I get what I want. But when I save it, the
> > random 8 character string had become a totally different 8 character
> > string :S.
> >
> > I have googled and checked things over and over again, cost me hours
> > and I still haven't found the reason. What is noticeable is that when
> > I leave one character away from the name, the value IS what it schould
> > be:S.
> >
> > I really hope you can help me, if you need further info yust ask.
> >
> > Thanks in advance.
> >
> > regards,
> >
> > Joep Roebroek
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Strangely enough.. It does.. But I have also tried adding a letter
(which gives me the good result) and then renaming it... But then the
value is wrong again :S
I've never had a problem like this.. Very strange..
2008/5/1 James Dempster <letssurf
gmail.com>:
> <?php
>
> $foldersystem = getcwd().'/test1';
> $id = '54961';
> $imgstr = 'tdtdtdtd'; //uniqid();
> $i = 2;
>
>
> $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg';
> echo $imagenamesmall; // For debugging purposses --> returns exactly what I
> want.
>
> //attempt to create folder
> mkdir($foldersystem);
> chmod($foldersystem, 0777);
>
> //save picture
> if(!($handle = fopen($imagenamesmall, 'w'))){
> echo "Cannot open file (31)";
> exit;
> }
>
> This code works for me. How about you ?
>
> --
> /James
>
>
>
> On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek <j.roebroek
gmail.com> wrote:
> >
> >
> >
> > Does anyone have an idea? Is this a bug in PHP? Because when I add or
> > remove one static letter in the filename, it does work. And if I don't
> > the file is created, but the $imgstr (random 8 characters) is replaced
> > by a totally different value (also random 8 characters).. I have no
> > idea where this new value comes from.
> >
> > regards,
> > Joep
> >
> > 2008/4/29 Joep Roebroek <j.roebroek
gmail.com>:
> >
> >
> >
> >
> >
> >
> > > Hi, I'm having a strange problem with fopen
> > >
> > > For clearence, here is the phpinfo page:
> > > http://www.grondengoed.nl/phpinfo.php
> > >
> > > I will shortly explain the problem I'm having:
> > > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' .
> > > $i . '.jpg';
> > > echo $imagenamesmall; // For debugging purposses --> returns
> > > exactly what I want.
> > >
> > > //attempt to create folder
> > >
mkdir($foldersystem);
> > >
chmod($foldersystem, 0777);
> > >
> > >
> > > //save picture
> > > if(!($handle = fopen($imagenamesmall, 'w'))){
> > > echo "Cannot open file (31)";
> > > exit;
> > > }
> > >
> > > //$imagesmall, contains the image resource
> > >
> > > if(fwrite($handle, $imagesmall) === FALSE) {
> > > echo "Cannot write to file (32)";
> > > exit;
> > > }
> > >
> > > fclose($handle);
> > >
> > > Erverything works perfectly fine.But one thing, it doesn't give the
> > > file the name that it should get. A name for instance has to be:
> > > 54961tdtdtdtd-s0.jpg
> > > The number is the id of the database row, the 8 characters are random.
> > > -s stands for small and 0 is the picture index.
> > > When I echo the value, I get what I want. But when I save it, the
> > > random 8 character string had become a totally different 8 character
> > > string :S.
> > >
> > > I have googled and checked things over and over again, cost me hours
> > > and I still haven't found the reason. What is noticeable is that when
> > > I leave one character away from the name, the value IS what it schould
> > > be:S.
> > >
> > > I really hope you can help me, if you need further info yust ask.
> > >
> > > Thanks in advance.
> > >
> > > regards,
> > >
> > > Joep Roebroek
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
attached mail follows:
Do you have a piece of example code that will reproduce the problem?
--
/James
On Thu, May 1, 2008 at 12:26 PM, Joep Roebroek <j.roebroek
gmail.com> wrote:
> Strangely enough.. It does.. But I have also tried adding a letter
> (which gives me the good result) and then renaming it... But then the
> value is wrong again :S
>
> I've never had a problem like this.. Very strange..
>
> 2008/5/1 James Dempster <letssurf
gmail.com>:
> > <?php
> >
> > $foldersystem = getcwd().'/test1';
> > $id = '54961';
> > $imgstr = 'tdtdtdtd'; //uniqid();
> > $i = 2;
> >
> >
> > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i .
> '.jpg';
> > echo $imagenamesmall; // For debugging purposses --> returns exactly
> what I
> > want.
> >
> > //attempt to create folder
> > mkdir($foldersystem);
> > chmod($foldersystem, 0777);
> >
> > //save picture
> > if(!($handle = fopen($imagenamesmall, 'w'))){
> > echo "Cannot open file (31)";
> > exit;
> > }
> >
> > This code works for me. How about you ?
> >
> > --
> > /James
> >
> >
> >
> > On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek <j.roebroek
gmail.com>
> wrote:
> > >
> > >
> > >
> > > Does anyone have an idea? Is this a bug in PHP? Because when I add or
> > > remove one static letter in the filename, it does work. And if I don't
> > > the file is created, but the $imgstr (random 8 characters) is replaced
> > > by a totally different value (also random 8 characters).. I have no
> > > idea where this new value comes from.
> > >
> > > regards,
> > > Joep
> > >
> > > 2008/4/29 Joep Roebroek <j.roebroek
gmail.com>:
> > >
> > >
> > >
> > >
> > >
> > >
> > > > Hi, I'm having a strange problem with fopen
> > > >
> > > > For clearence, here is the phpinfo page:
> > > > http://www.grondengoed.nl/phpinfo.php
> > > >
> > > > I will shortly explain the problem I'm having:
> > > > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s'
> .
> > > > $i . '.jpg';
> > > > echo $imagenamesmall; // For debugging purposses --> returns
> > > > exactly what I want.
> > > >
> > > > //attempt to create folder
> > > >
mkdir($foldersystem);
> > > >
chmod($foldersystem, 0777);
> > > >
> > > >
> > > > //save picture
> > > > if(!($handle = fopen($imagenamesmall, 'w'))){
> > > > echo "Cannot open file (31)";
> > > > exit;
> > > > }
> > > >
> > > > //$imagesmall, contains the image resource
> > > >
> > > > if(fwrite($handle, $imagesmall) === FALSE) {
> > > > echo "Cannot write to file (32)";
> > > > exit;
> > > > }
> > > >
> > > > fclose($handle);
> > > >
> > > > Erverything works perfectly fine.But one thing, it doesn't give the
> > > > file the name that it should get. A name for instance has to be:
> > > > 54961tdtdtdtd-s0.jpg
> > > > The number is the id of the database row, the 8 characters are
> random.
> > > > -s stands for small and 0 is the picture index.
> > > > When I echo the value, I get what I want. But when I save it, the
> > > > random 8 character string had become a totally different 8
> character
> > > > string :S.
> > > >
> > > > I have googled and checked things over and over again, cost me
> hours
> > > > and I still haven't found the reason. What is noticeable is that
> when
> > > > I leave one character away from the name, the value IS what it
> schould
> > > > be:S.
> > > >
> > > > I really hope you can help me, if you need further info yust ask.
> > > >
> > > > Thanks in advance.
> > > >
> > > > regards,
> > > >
> > > > Joep Roebroek
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
>
attached mail follows:
This problem is getting stranger by the minute.
I will explain in a little more detail what the script is actually for..
It is an advert site and per advert, you can add 5 photo's..
Now you set the $i = 2; When I set the $i (which indictates the index
of the photo, so $i = 5; is the last photo) myself, it works..
But normally I get the $i from the database, because there is stored
how many photo's the already are in the advert.. When I use that value
it doesn't work at all.
When i set $i = 2.. It works :S,, but when the value it gets from the
db also is 2 than it doesn't work (it is like it just doesn't want me
to get it working :P)...
Reproduction would be very difficult, because it is in this very
specific situation...
Maybe I am able to give you access to the FTP but that is a bit risky
for me, not that I don't trust you, but the website is not mine..
regards,
Joep
2008/5/1 James Dempster <letssurf
gmail.com>:
> Do you have a piece of example code that will reproduce the problem?
>
> --
> /James
>
>
>
> On Thu, May 1, 2008 at 12:26 PM, Joep Roebroek <j.roebroek
gmail.com> wrote:
> > Strangely enough.. It does.. But I have also tried adding a letter
> > (which gives me the good result) and then renaming it... But then the
> > value is wrong again :S
> >
> > I've never had a problem like this.. Very strange..
> >
> > 2008/5/1 James Dempster <letssurf
gmail.com>:
> >
> >
> >
> > > <?php
> > >
> > > $foldersystem = getcwd().'/test1';
> > > $id = '54961';
> > > $imgstr = 'tdtdtdtd'; //uniqid();
> > > $i = 2;
> > >
> > >
> > > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i .
> '.jpg';
> > > echo $imagenamesmall; // For debugging purposses --> returns exactly
> what I
> > > want.
> > >
> > > //attempt to create folder
> > > mkdir($foldersystem);
> > > chmod($foldersystem, 0777);
> > >
> > > //save picture
> > > if(!($handle = fopen($imagenamesmall, 'w'))){
> > > echo "Cannot open file (31)";
> > > exit;
> > > }
> > >
> > > This code works for me. How about you ?
> > >
> > > --
> > > /James
> > >
> > >
> > >
> > > On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek <j.roebroek
gmail.com>
> wrote:
> > > >
> > > >
> > > >
> > > > Does anyone have an idea? Is this a bug in PHP? Because when I add or
> > > > remove one static letter in the filename, it does work. And if I don't
> > > > the file is created, but the $imgstr (random 8 characters) is replaced
> > > > by a totally different value (also random 8 characters).. I have no
> > > > idea where this new value comes from.
> > > >
> > > > regards,
> > > > Joep
> > > >
> > > > 2008/4/29 Joep Roebroek <j.roebroek
gmail.com>:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > Hi, I'm having a strange problem with fopen
> > > > >
> > > > > For clearence, here is the phpinfo page:
> > > > > http://www.grondengoed.nl/phpinfo.php
> > > > >
> > > > > I will shortly explain the problem I'm having:
> > > > > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s'
> .
> > > > > $i . '.jpg';
> > > > > echo $imagenamesmall; // For debugging purposses --> returns
> > > > > exactly what I want.
> > > > >
> > > > > //attempt to create folder
> > > > >
mkdir($foldersystem);
> > > > >
chmod($foldersystem, 0777);
> > > > >
> > > > >
> > > > > //save picture
> > > > > if(!($handle = fopen($imagenamesmall, 'w'))){
> > > > > echo "Cannot open file (31)";
> > > > > exit;
> > > > > }
> > > > >
> > > > > //$imagesmall, contains the image resource
> > > > >
> > > > > if(fwrite($handle, $imagesmall) === FALSE) {
> > > > > echo "Cannot write to file (32)";
> > > > > exit;
> > > > > }
> > > > >
> > > > > fclose($handle);
> > > > >
> > > > > Erverything works perfectly fine.But one thing, it doesn't give the
> > > > > file the name that it should get. A name for instance has to be:
> > > > > 54961tdtdtdtd-s0.jpg
> > > > > The number is the id of the database row, the 8 characters are
> random.
> > > > > -s stands for small and 0 is the picture index.
> > > > > When I echo the value, I get what I want. But when I save it, the
> > > > > random 8 character string had become a totally different 8
> character
> > > > > string :S.
> > > > >
> > > > > I have googled and checked things over and over again, cost me
> hours
> > > > > and I still haven't found the reason. What is noticeable is that
> when
> > > > > I leave one character away from the name, the value IS what it
> schould
> > > > > be:S.
> > > > >
> > > > > I really hope you can help me, if you need further info yust ask.
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > regards,
> > > > >
> > > > > Joep Roebroek
> > > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > >
> > >
> >
>
>
attached mail follows:
Small correction $i = 4, means the last photo not 5..
Not so important but still.:P
2008/5/1 Joep Roebroek <j.roebroek
gmail.com>:
> This problem is getting stranger by the minute.
> I will explain in a little more detail what the script is actually for..
> It is an advert site and per advert, you can add 5 photo's..
>
> Now you set the $i = 2; When I set the $i (which indictates the index
> of the photo, so $i = 5; is the last photo) myself, it works..
>
> But normally I get the $i from the database, because there is stored
> how many photo's the already are in the advert.. When I use that value
> it doesn't work at all.
>
> When i set $i = 2.. It works :S,, but when the value it gets from the
> db also is 2 than it doesn't work (it is like it just doesn't want me
> to get it working :P)...
>
> Reproduction would be very difficult, because it is in this very
> specific situation...
>
> Maybe I am able to give you access to the FTP but that is a bit risky
> for me, not that I don't trust you, but the website is not mine..
>
> regards,
>
> Joep
>
>
>
> 2008/5/1 James Dempster <letssurf
gmail.com>:
> > Do you have a piece of example code that will reproduce the problem?
> >
> > --
> > /James
> >
> >
> >
> > On Thu, May 1, 2008 at 12:26 PM, Joep Roebroek <j.roebroek
gmail.com> wrote:
> > > Strangely enough.. It does.. But I have also tried adding a letter
> > > (which gives me the good result) and then renaming it... But then the
> > > value is wrong again :S
> > >
> > > I've never had a problem like this.. Very strange..
> > >
> > > 2008/5/1 James Dempster <letssurf
gmail.com>:
> > >
> > >
> > >
> > > > <?php
> > > >
> > > > $foldersystem = getcwd().'/test1';
> > > > $id = '54961';
> > > > $imgstr = 'tdtdtdtd'; //uniqid();
> > > > $i = 2;
> > > >
> > > >
> > > > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i .
> > '.jpg';
> > > > echo $imagenamesmall; // For debugging purposses --> returns exactly
> > what I
> > > > want.
> > > >
> > > > //attempt to create folder
> > > > mkdir($foldersystem);
> > > > chmod($foldersystem, 0777);
> > > >
> > > > //save picture
> > > > if(!($handle = fopen($imagenamesmall, 'w'))){
> > > > echo "Cannot open file (31)";
> > > > exit;
> > > > }
> > > >
> > > > This code works for me. How about you ?
> > > >
> > > > --
> > > > /James
> > > >
> > > >
> > > >
> > > > On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek <j.roebroek
gmail.com>
> > wrote:
> > > > >
> > > > >
> > > > >
> > > > > Does anyone have an idea? Is this a bug in PHP? Because when I add or
> > > > > remove one static letter in the filename, it does work. And if I don't
> > > > > the file is created, but the $imgstr (random 8 characters) is replaced
> > > > > by a totally different value (also random 8 characters).. I have no
> > > > > idea where this new value comes from.
> > > > >
> > > > > regards,
> > > > > Joep
> > > > >
> > > > > 2008/4/29 Joep Roebroek <j.roebroek
gmail.com>:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > Hi, I'm having a strange problem with fopen
> > > > > >
> > > > > > For clearence, here is the phpinfo page:
> > > > > > http://www.grondengoed.nl/phpinfo.php
> > > > > >
> > > > > > I will shortly explain the problem I'm having:
> > > > > > $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s'
> > .
> > > > > > $i . '.jpg';
> > > > > > echo $imagenamesmall; // For debugging purposses --> returns
> > > > > > exactly what I want.
> > > > > >
> > > > > > //attempt to create folder
> > > > > >
mkdir($foldersystem);
> > > > > >
chmod($foldersystem, 0777);
> > > > > >
> > > > > >
> > > > > > //save picture
> > > > > > if(!($handle = fopen($imagenamesmall, 'w'))){
> > > > > > echo "Cannot open file (31)";
> > > > > > exit;
> > > > > > }
> > > > > >
> > > > > > //$imagesmall, contains the image resource
> > > > > >
> > > > > > if(fwrite($handle, $imagesmall) === FALSE) {
> > > > > > echo "Cannot write to file (32)";
> > > > > > exit;
> > > > > > }
> > > > > >
> > > > > > fclose($handle);
> > > > > >
> > > > > > Erverything works perfectly fine.But one thing, it doesn't give the
> > > > > > file the name that it should get. A name for instance has to be:
> > > > > > 54961tdtdtdtd-s0.jpg
> > > > > > The number is the id of the database row, the 8 characters are
> > random.
> > > > > > -s stands for small and 0 is the picture index.
> > > > > > When I echo the value, I get what I want. But when I save it, the
> > > > > > random 8 character string had become a totally different 8
> > character
> > > > > > string :S.
> > > > > >
> > > > > > I have googled and checked things over and over again, cost me
> > hours
> > > > > > and I still haven't found the reason. What is noticeable is that
> > when
> > > > > > I leave one character away from the name, the value IS what it
> > schould
> > > > > > be:S.
> > > > > >
> > > > > > I really hope you can help me, if you need further info yust ask.
> > > > > >
> > > > > > Thanks in advance.
> > > > > >
> > > > > > regards,
> > > > > >
> > > > > > Joep Roebroek
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > >
> > > >
> > >
> >
> >
>
attached mail follows:
On Wednesday 30 April 2008 10:45:30 paragasu wrote:
> On Wed, Apr 30, 2008 at 4:28 PM, paragasu <paragasu
gmail.com> wrote:
> > You want light outta it? use the jabber2 server as a backend. It'll be
> >
> > > done
> > > serving while you try to access the database. No need to do a square
> > > wheel,
> > > when a round one is invented
> >
> > is there any free jabber2 server i can use?
>
> i found the jabber2 main project website. but it is not suitable for what i
> wan't coz i want
> to integrate the chat to my website. so online member can chat to each
> other. i see a perl
> implementation but no php..
you build one. Thats the point of it wasn't it eh?
A friend and I made a chat with jabber throught second life (the game) and a
php webpage.
--
---
Børge Holen
http://www.arivene.net
attached mail follows:
> you build one. Thats the point of it wasn't it eh?
> A friend and I made a chat with jabber throught second life (the game) and
> a
> php webpage.
interesting. i really wan't to try out your chat implementation. may i?
i don't know how to integrate php with jabber since i don't have much
understanding
on how jabber works.. :).. may give me some idea..
attached mail follows:
umm sorry for interupting but.... RTFM / STFM?
btw, if you dont need history you can write an webby irc client
On 01/05/2008, paragasu <paragasu
gmail.com> wrote:
>
> > you build one. Thats the point of it wasn't it eh?
> > A friend and I made a chat with jabber throught second life (the game)
> and
> > a
> > php webpage.
>
>
> interesting. i really wan't to try out your chat implementation. may i?
> i don't know how to integrate php with jabber since *i don't have much
> understanding
> *on how jabber works.. :).. may give me some idea..
>
attached mail follows:
Hi,
I have written a program which imports the tab delimited file and insert all
the line from file to the mysql line by line.
I am succeding in the above case. but problem with the above method is its
taking to too much time while inserting into the database.
The file's size will be more than 5000 lines.
Then i tried to build a string of ; seperated queries. as follows
for($i=1; $i<sizeof($array); $i++){
$insert_string .= "insert into tablename (v1, v2..... v6)
values('$array[$i][1]', '$array[$i][2]'..... '$array[$i][6]');";
}
if(!empty($insert_string)){
mysql_query($insert_string, $conn) or die("query failed : ".mysql_errror());
}
Its throwing error saying check the manual for right syntax.....
After investigating in some sites i come to know that its problem of
limitations in query size.
I also tried with "SET GLOBAL max_allowed_packet=30000000;"
Then also its throwing the same error.
Can anybody tell me how to fix this error and reduce the inserting time with
a single statement instead of writing more insert statements
--
Regards,
Sanjeev
http://www.sanchanworld.com
http://webdirectory.sanchanworld.com - submit your site
attached mail follows:
---- Sanjeev N <sanjeev.res
gmail.com> wrote:
> Hi,
> I have written a program which imports the tab delimited file and insert all
> the line from file to the mysql line by line.
> I am succeding in the above case. but problem with the above method is its
> taking to too much time while inserting into the database.
> The file's size will be more than 5000 lines.
>
> Then i tried to build a string of ; seperated queries. as follows
>
> for($i=1; $i<sizeof($array); $i++){
> $insert_string .= "insert into tablename (v1, v2..... v6)
> values('$array[$i][1]', '$array[$i][2]'..... '$array[$i][6]');";
> }
> if(!empty($insert_string)){
> mysql_query($insert_string, $conn) or die("query failed : ".mysql_errror());
> }
>
> Its throwing error saying check the manual for right syntax.....
>
> After investigating in some sites i come to know that its problem of
> limitations in query size.
>
> I also tried with "SET GLOBAL max_allowed_packet=30000000;"
> Then also its throwing the same error.
>
> Can anybody tell me how to fix this error and reduce the inserting time with
> a single statement instead of writing more insert statements
>
Sure, check with a MySQL list via http://www.mysql.com
Otherwise, split it up into multiple inserts.
I currently have a script which reads a 550,000 CSV file and uses
<?php
// read file
// for each line, do the following
while ($in != EOF)
{
$line=explode ('","',$in);
$out="insert into table values('','$line[0]', .....)";
fwrite ($outf, $out);
}
then I have another file that
<?php
//read the file line by line
//connect to db
$sql = $inLine;
mysql_query($sql) or die();
?>
which all in all takes about 10 seconds to run the conversion and then the inserts.
HTH,
Wolf
attached mail follows:
Sanjeev N wrote:
> Hi,
> I have written a program which imports the tab delimited file and insert all
> the line from file to the mysql line by line.
> I am succeding in the above case. but problem with the above method is its
> taking to too much time while inserting into the database.
> The file's size will be more than 5000 lines.
>
> Then i tried to build a string of ; seperated queries. as follows
>
> for($i=1; $i<sizeof($array); $i++){
> $insert_string .= "insert into tablename (v1, v2..... v6)
> values('$array[$i][1]', '$array[$i][2]'..... '$array[$i][6]');";
> }
> if(!empty($insert_string)){
> mysql_query($insert_string, $conn) or die("query failed : ".mysql_errror());
> }
>
> Its throwing error saying check the manual for right syntax.....
>
> After investigating in some sites i come to know that its problem of
> limitations in query size.
>
> I also tried with "SET GLOBAL max_allowed_packet=30000000;"
> Then also its throwing the same error.
>
> Can anybody tell me how to fix this error and reduce the inserting time with
> a single statement instead of writing more insert statements
>
You are probably looking for something like this.
<?php
if ( count($array) ) {
$insert_string = "INSERT INTO tablename (v1, v2..... v6) VALUES ";
$data = array();
foreach ( $array AS $row ){
$row_clean = array_map('mysql_real_escape_string', $row);
$data[] = "('{$row_clean[1]}', '{$row_clean[2]}',.....'{$row_clean[6]}')";
}
$insert_string = join(', ', $data);
mysql_query($insert_string, $conn) or die("query failed : ".mysql_errror());
} else {
echo "Nothing to insert";
}
?>
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
attached mail follows:
Jim Lucas wrote:
> Sanjeev N wrote:
>> Hi,
>> I have written a program which imports the tab delimited file and
>> insert all
>> the line from file to the mysql line by line.
>> I am succeding in the above case. but problem with the above method is
>> its
>> taking to too much time while inserting into the database.
>> The file's size will be more than 5000 lines.
>>
>> Then i tried to build a string of ; seperated queries. as follows
>>
>> for($i=1; $i<sizeof($array); $i++){
>> $insert_string .= "insert into tablename (v1, v2..... v6)
>> values('$array[$i][1]', '$array[$i][2]'..... '$array[$i][6]');";
>> }
>> if(!empty($insert_string)){
>> mysql_query($insert_string, $conn) or die("query failed :
>> ".mysql_errror());
>> }
>>
>> Its throwing error saying check the manual for right syntax.....
>>
>> After investigating in some sites i come to know that its problem of
>> limitations in query size.
>>
>> I also tried with "SET GLOBAL max_allowed_packet=30000000;"
>> Then also its throwing the same error.
>>
>> Can anybody tell me how to fix this error and reduce the inserting
>> time with
>> a single statement instead of writing more insert statements
>>
>
> You are probably looking for something like this.
>
> <?php
>
> if ( count($array) ) {
> $insert_string = "INSERT INTO tablename (v1, v2..... v6) VALUES ";
> $data = array();
> foreach ( $array AS $row ){
> $row_clean = array_map('mysql_real_escape_string', $row);
> $data[] = "('{$row_clean[1]}',
> '{$row_clean[2]}',.....'{$row_clean[6]}')";
> }
> $insert_string = join(', ', $data);
> mysql_query($insert_string, $conn) or die("query failed :
> ".mysql_errror());
> } else {
> echo "Nothing to insert";
> }
>
> ?>
>
That would work, but will probably result in a query string that is too long.
I'll redo the above to fix that.
<?php
# How often do you want to insert??
$break_at = 100;
# Initialize the counter
$cnt = 0;
# Initial insert string
$insert_string = "INSERT INTO tablename (v1, v2..... v6) VALUES ";
# if there is data, then process, otherwise skip it.
if ( count($array) ) {
$data = array();
# Loop through data
foreach ( $array AS $row ) {
$cnt++;
# Clean the result data
$row_clean = array_map('mysql_real_escape_string', $row);
# Build data string and push it onto the data array.
$data[] = "('{$row_clean[1]}', '{$row_clean[2]}',.....'{$row_clean[6]}')";
# Break and insert if we are at the break point
if ( $cnt === $break_at ) {
# Reset Counter
$cnt = 0;
# Run insert
mysql_query($insert_string . join(', ', $data), $conn) or
die("query failed : ".mysql_error());
# Reset data array
$data = array();
} //if
} //foreach
# This should take care of any extra that didn't get processed in the foreach
if ( count($data) ) {
# Insert remaining data
mysql_query($insert_string . join(', ', $data), $conn) or
die("query failed : ".mysql_error());
} //if
} else {
echo "Nothing to insert";
} //if
?>
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
attached mail follows:
On Wed, Apr 30, 2008 at 3:53 PM, Larry Brown
<larry.brown
dimensionnetworks.com> wrote:
> I'm not sure how it looks etc with with soapui but I noticed you
> mentioning you don't want to mess with nusoap. I've used nusoap for
> both client and server uses for years and I'm really impressed with how
> easily it works. Using $soapInstance->request and
> $soapInstance->response the xml is displayed where you can see how it
> was created based on the array you fed the instance before sending for
> your message. It makes troubleshooting much easier for me.
>
> That being said I don't send attachments. However just doing a quick
> google on "nusoap attachments" (without the quotes) has mention of
> people sending MIME attachments and one listing an issue with DIME
> encoded attachments yet another explaining that he solved the DIME
> encoded issue and referred to "wrox book open source webservices page
> 315" which is an on-line book.
>
> Sorry no quick silver bullet, but I would highly recommend looking at
> nusoap if only as a test.
Hi Larry,
I am receiving a multipart mime attachment from Amazon. The idea is
we request a report and get a response. This response differs from
any other response I have seen in that it is multipart. I searched
all over the place for a way to get it to work correctly. The soapUI
program is the only one so far that has been able to show me that I
get a proper return value that can be parsed. soapUI shows me the
envelope XML and then has a button on the bottom that says there is an
attachment that I can save to a file. So from this I know that it is
possible to handle this type of request "correctly." I just haven't
been able to find any real examples on how to use it.
I wanted to keep everything using ext/soap since it is c code and very
fast. Plus there are other parts of this program already utilizing
it.
So far I have my backup plan working using curl, a regex, and simplexml. ;)
attached mail follows:
Hi,
I was wondering if it was possible to extend the DOMXpath object in a
similar fashion to the DomDocument.
I was hoping to write a wrapper to provide an interface similar to
prepared statements in the db libraries for the xpath processor.
$xpath = new myxpath();
$stmt = $xpath->prepare("/foo/bar[
foo = '?' ]");
$stmt->bindParam( '?', $potentiallynastystring );
$x = $stmt->execute();
I have tried :
final class timber_utils_domxpath extends DomXpath
{
public function __construct( DOMDocument $dom )
{
echo "in here";
parent::_construct( $dom );
}
}
but I get the following error
Fatal error: Call to undefined method DOMXPath::_construct()
Many thanks
Andrew
attached mail follows:
Andrew Mason wrote:
> Hi,
> I was wondering if it was possible to extend the DOMXpath object in a
> similar fashion to the DomDocument.
>
> I was hoping to write a wrapper to provide an interface similar to
> prepared statements in the db libraries for the xpath processor.
>
>
> $xpath = new myxpath();
>
> $stmt = $xpath->prepare("/foo/bar[
foo = '?' ]");
> $stmt->bindParam( '?', $potentiallynastystring );
> $x = $stmt->execute();
>
> I have tried :
>
> final class timber_utils_domxpath extends DomXpath
> {
> public function __construct( DOMDocument $dom )
> {
> echo "in here";
> parent::_construct( $dom );
> }
> }
>
>
> but I get the following error
> Fatal error: Call to undefined method DOMXPath::_construct()
Your missing an underscore. It needs two not one.
>
> Many thanks
> Andrew
>
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
attached mail follows:
/*
Top posting from my cell...
1. Format hard drive
2. Install redhat fc8 or Ubuntu 8.04
3. Load the new MySQL installation with your backup file
If you really have to stay with windoze, remove and re-install apache. Look at the system log files as they SHOULD tell you what was causing the crash.
*/
Hey Wolf,
Thanks for replying.
Would love to install Linux, problem is... dont know the first thing about it if things go wrong, I always wanted to learn what its all about but when I started to read up on it quickly got confused with all the different flavors out there... which one is right for me/ a total beginner? for every little thing I would probably have to join a linux list and post.. what about drivers for the bits and pieces of the laptop? what about software? most of the places I go to download software (freeware or shareware) is only for Win..
Would love to switch away from Win... but i think the OS guys will have to make it seem less of a mountain to climb to do so :(
Cheers!
R
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
attached mail follows:
On May 1, 2008, at 8:56 AM, Ryan S wrote:
>
> /*
> Top posting from my cell...
>
> 1. Format hard drive
> 2. Install redhat fc8 or Ubuntu 8.04
> 3. Load the new MySQL installation with your backup file
>
> If you really have to stay with windoze, remove and re-install
> apache. Look at the system log files as they SHOULD tell you what
> was causing the crash.
> */
>
> Hey Wolf,
> Thanks for replying.
>
> Would love to install Linux, problem is... dont know the first thing
> about it if things go wrong, I always wanted to learn what its all
> about but when I started to read up on it quickly got confused with
> all the different flavors out there... which one is right for me/ a
> total beginner? for every little thing I would probably have to join
> a linux list and post.. what about drivers for the bits and pieces
> of the laptop? what about software? most of the places I go to
> download software (freeware or shareware) is only for Win..
> Would love to switch away from Win... but i think the OS guys will
> have to make it seem less of a mountain to climb to do so :(
One option, I don't know what your budget is, but Apple's Macintosh OS
X is basically a flavor of Unix (FreeBSD if I remember right) with a
nice user interface on it.
You have the ability to dive into the commandline when you need to/
want to, but have the comfortable point/click user interface when you
don't want to worry about it.
Just something else to think about... Oh... And there's no virii for
the Mac :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
>
> /*
> Top posting from my cell...
>
> 1. Format hard drive
> 2. Install redhat fc8 or Ubuntu 8.04
> 3. Load the new MySQL installation with your backup file
>
> If you really have to stay with windoze, remove and re-install
> apache. Look at the system log files as they SHOULD tell you what
> was causing the crash.
> */
>
> Hey Wolf,
> Thanks for replying.
>
> Would love to install Linux, problem is... dont know the first thing
> about it if things go wrong, I always wanted to learn what its all
> about but when I started to read up on it quickly got confused with
> all the different flavors out there... which one is right for me/ a
> total beginner? for every little thing I would probably have to join
> a linux list and post.. what about drivers for the bits and pieces
> of the laptop? what about software? most of the places I go to
> download software (freeware or shareware) is only for Win..
> Would love to switch away from Win... but i think the OS guys will
> have to make it seem less of a mountain to climb to do so :(
<reply>
One option, I don't know what your budget is, but Apple's Macintosh OS
X is basically a flavor of Unix (FreeBSD if I remember right) with a
nice user interface on it.
You have the ability to dive into the commandline when you need to/
want to, but have the comfortable point/click user interface when you
don't want to worry about it.
Just something else to think about... Oh... And there's no virii for
the Mac :)
</reply>
Cant afford a new comp or a new OS and as for your last statement:
http://www.sophos.com.au/pressoffice/news/articles/2006/02/macosxleap.html
_almost_ no virii for the Mac :)
Cheers!
R
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
attached mail follows:
On May 1, 2008, at 9:30 AM, Ryan S wrote:
>
>
>
>>
>> /*
>> Top posting from my cell...
>>
>> 1. Format hard drive
>> 2. Install redhat fc8 or Ubuntu 8.04
>> 3. Load the new MySQL installation with your backup file
>>
>> If you really have to stay with windoze, remove and re-install
>> apache. Look at the system log files as they SHOULD tell you what
>> was causing the crash.
>> */
>>
>> Hey Wolf,
>> Thanks for replying.
>>
>> Would love to install Linux, problem is... dont know the first thing
>> about it if things go wrong, I always wanted to learn what its all
>> about but when I started to read up on it quickly got confused with
>> all the different flavors out there... which one is right for me/ a
>> total beginner? for every little thing I would probably have to join
>> a linux list and post.. what about drivers for the bits and pieces
>> of the laptop? what about software? most of the places I go to
>> download software (freeware or shareware) is only for Win..
>> Would love to switch away from Win... but i think the OS guys will
>> have to make it seem less of a mountain to climb to do so :(
> <reply>
> One option, I don't know what your budget is, but Apple's Macintosh OS
> X is basically a flavor of Unix (FreeBSD if I remember right) with a
> nice user interface on it.
>
> You have the ability to dive into the commandline when you need to/
> want to, but have the comfortable point/click user interface when you
> don't want to worry about it.
>
> Just something else to think about... Oh... And there's no virii for
> the Mac :)
>
> </reply>
>
>
> Cant afford a new comp or a new OS and as for your last statement:
> http://www.sophos.com.au/pressoffice/news/articles/2006/02/macosxleap.html
> _almost_ no virii for the Mac :)
None that have effected my computers here at work, or at home. No anti-
virus, no firewall's ;)
Oh and I'll take 1 over 97,467 anyday :)
http://www.macdailynews.com/index.php/weblog/comments/5393/
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
>
>
> Cant afford a new comp or a new OS and as for your last statement:
> http://www.sophos.com.au/pressoffice/news/articles/2006/02/macosxleap.html
> _almost_ no virii for the Mac :)
/*
None that have effected my computers here at work, or at home. No anti-
virus, no firewall's ;)
Oh and I'll take 1 over 97,467 anyday :)
http://www.macdailynews.com/index.php/weblog/comments/5393/
*/
Haha fair enough... but that will still leave you owning a Mac... will rather have the viruses than the shame! Plus you know nearly any software you download (shareware/freeware or even pirated) will support windows.. can you say the same for the Mac?
Anyway, lets not take this down the my daddy can beat up your daddy lane and make this into a Apple against M$ thread.
Cheers!
R
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
attached mail follows:
On May 1, 2008, at 11:43 AM, Ryan S wrote:
>
>
>>
>>
>> Cant afford a new comp or a new OS and as for your last statement:
>> http://www.sophos.com.au/pressoffice/news/articles/2006/02/macosxleap.html
>> _almost_ no virii for the Mac :)
> /*
> None that have effected my computers here at work, or at home. No
> anti-
> virus, no firewall's ;)
>
> Oh and I'll take 1 over 97,467 anyday :)
>
> http://www.macdailynews.com/index.php/weblog/comments/5393/
> */
>
> Haha fair enough... but that will still leave you owning a Mac...
> will rather have the viruses than the shame! Plus you know nearly
> any software you download (shareware/freeware or even pirated) will
> support windows.. can you say the same for the Mac?
> Anyway, lets not take this down the my daddy can beat up your daddy
> lane and make this into a Apple against M$ thread.
Don't intend to, so I'll stop after this next point :)
Over 25,000+ commercial products for the mac
Probably at least as many shareware/freeware aps
and with the new Mac's if you REALLY need to you can subject it to
running windows so it can basically run every single piece of software
out there :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
Hey!
Heres what i have to do, upload pics and each pic can be a part of x number of categores
for example:
A picture of a rose can be for birthday, as well as anniversary, or miss you, or love etc
exactly the same as how in wordpress an article can be in multiple categories like tech, current news, gadgets etc
Was wondering how to do this, and please tell me if I am on the wrong path but:
in the mysql db next to img name have a field called cate (or whatever for categories) and have a comma seperated list for each of the categories that the pic falls into and then do a mySql LIKE '%$param%' search if the user wants 'birthday'?
Is this how its done or am I barking up the wrong tree?
TIA
/R
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
attached mail follows:
On Thu, May 1, 2008 at 9:23 AM, Ryan S <genphp
yahoo.com> wrote:
> Hey!
>
> Heres what i have to do, upload pics and each pic can be a part of x
> number of categores
>
> for example:
> A picture of a rose can be for birthday, as well as anniversary, or miss
> you, or love etc
> exactly the same as how in wordpress an article can be in multiple
> categories like tech, current news, gadgets etc
>
> Was wondering how to do this, and please tell me if I am on the wrong path
> but:
> in the mysql db next to img name have a field called cate (or whatever for
> categories) and have a comma seperated list for each of the categories that
> the pic falls into and then do a mySql LIKE '%$param%' search if the user
> wants 'birthday'?
>
> Is this how its done or am I barking up the wrong tree?
>
> TIA
> /R
> **
>
>
>
Well you could go with a comma separated list of keywords, or you could
build a keywords table, and then a table for associating each picture with a
given keyword. So you have your images table with your image information,
then you have your keywords table with your keyword information, then an
associations table with the image id and keyword id link. Either way should
work ok.
--
-Dan Joseph
"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."
attached mail follows:
> Is this how its done or am I barking up the wrong tree?
You have multiple options:
1. Fully normalised, where you have three tables - one for your
"articles", one for your categories and a link table.
2. A "SET" MySQL datatype which will allow upto 32 predefined
categories.
3. A simple CHAR type with the category names, (or if you use numeric
IDs, you could have many more categories).
The former is, IIRC, faster, but more work to implement. Whereas the
latter two are very fast to implement but somewhat slower to query. For
the last two cases the MySQL function FIND_IN_SET() will be very useful.
--
Richard Heyes
+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+
attached mail follows:
On May 1, 2008, at 743AM, Richard Heyes wrote:
>> Is this how its done or am I barking up the wrong tree?
>
> You have multiple options:
>
> 1. Fully normalised, where you have three tables - one for your
> "articles", one for your categories and a link table.
This is the route that I would suggest, it's the most flexible and
fastest to query.
Just to expound a little...
images table:
- image_id
- image_filename
category table
- category_id
- category_name
image_category_mapping table:
- image_id
- category_id
Then when you want to get all of the images for a category:
SELECT image_id, image_filename
FROM images JOIN image_category_mapping ON images.image_id =
image_category_mapping.image_id
WHERE category_id = 10;
Getting all the categories an image is in:
SELECT category_id
FROM image_category_mapping
WHERE image_id = 42;
It seems like more work than the route you described, but it's way
more flexible, and as Richard pointed out, it's fully normalized.
Brady
attached mail follows:
> it's the most flexible and
> fastest to query.
Mmm, that's debateable. Not knowing the ins and outs of MySQL I'd hazard
a guess that reading an extra 255 bytes from the table file might be
faster in some circumstances than opening two extra table files. And I
don't see why it's more flexible...?
The latter two solutions I suggested are certainly easier to work with
and (with todays hardware), speed isn't always a factor.
--
Richard Heyes
+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+
attached mail follows:
Hey!
Thanks for replying guys!
<clip>
> 1. Fully normalised, where you have three tables - one for your
> "articles", one for your categories and a link table.
This is the route that I would suggest, it's the most flexible and
fastest to query.
....
</clip>
Anyone happen to have a little PHP code as an example here ( a little more than Brady gave me)? or links to where i can read up on this mySql and php side as I have never done anything like this before.
TIA,
R
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
attached mail follows:
On May 1, 2008, at 843AM, Richard Heyes wrote:
>> it's the most flexible and fastest to query.
>
> Mmm, that's debateable. Not knowing the ins and outs of MySQL I'd
> hazard a guess that reading an extra 255 bytes from the table file
> might be faster in some circumstances than opening two extra table
> files. And I don't see why it's more flexible...?
Good point, I should have said "can be more flexible and faster to
query". I've found that every time I try to do something like this
without having a mapping table that I eventually end up wanting to
move to the mapping table setup. Of course that might just be because
I'm so used to doing it that way.
Certainly that doesn't mean that other solutions are wrong or bad in
any way. I need to learn to not speak in absolutes. :)
> The latter two solutions I suggested are certainly easier to work
> with and (with todays hardware), speed isn't always a factor.
Yes, another great point.
Brady
attached mail follows:
Hey,
Am not really used to using the JOIN in SQL so am a bit confused as to what kind of data I need to enter into this table:
image_category_mapping table:
- image_id
- category_id
for all of this to work... mind explaining a bit?
Thanks!
Ryan
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]