php-general Digest 13 Dec 2008 03:24:35 -0000 Issue 5842
Topics (messages 284542 through 284573):
Re: Need a brain to bounce some Mysql/DB thoughts off of!!
284542 by: Robert Cummings
284545 by: ceo.l-i-e.com
284546 by: Daniel Brown
284547 by: Frank Stanovcak
284550 by: Robert Cummings
Re: Foreign Keys Question
284543 by: phphelp -- kbk
284553 by: Colin Guthrie
284555 by: tedd
Question on if() priorities
284544 by: Frank Stanovcak
284548 by: Maciek Sokolewicz
284549 by: Maciek Sokolewicz
284551 by: Frank Stanovcak
284552 by: Frank Stanovcak
Re: Chrome 1.0 released
284554 by: Dotan Cohen
284556 by: Richard Heyes
284557 by: Robert Cummings
284559 by: Dotan Cohen
Credit Card processing: Chase PaymenTech
284558 by: phphelp -- kbk
question on parameter specification in href tag
284560 by: Xaver Thum
284561 by: Robert Cummings
284562 by: Daniel Brown
284563 by: Xaver Thum
Using a class inside of a class
284564 by: Richard Kurth
284573 by: Robert Cummings
Resource ID# 5 and Resource id #5 8561 errors....help
284565 by: Terion Miller
284566 by: Daniel P. Brown
284567 by: Terion Miller
284568 by: Terion Miller
284569 by: Daniel P. Brown
284570 by: Terion Miller
284571 by: Jim Lucas
Instructions on compiling PHP 5.2.8 for Mac OS X Server 10.4.11
284572 by: Rene Fournier
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:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Fri, 2008-12-12 at 06:34 -0600, Jay Blanchard wrote:
> [snip]
> It's Christmas... the season of giving and tolerance :|
> [/snip]
>
> We will return you to your regularly scheduled Robert Cummings Jan 2nd,
> 2009
Are you suggesting I'm not tolerant? Pfff.
:)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
I would set it up that a person could elect to work with one or more
Departments. If they work on a College, they work on all Departments in that
college.
Another option is to just let them do one Dept at a time, and that's it.
Kind of depends on what people actually DO in this work, most of the time.
If the whole-college work is rare, then don't bother with it.
--- End Message ---
--- Begin Message ---
On Fri, Dec 12, 2008 at 10:35, Robert Cummings <[email protected]> wrote:
>
> Are you suggesting I'm not tolerant? Pfff.
Not since you've let those crosses on the lawn burn out. ;-P
And yet, despite all of this, poor ol' [email protected] is
left in the cold.
--
</Daniel P. Brown>
http://www.parasane.net/
[email protected] || [email protected]
50% Off Hosting! http://www.pilotpig.net/specials.php
--- End Message ---
--- Begin Message ---
"Robert Cummings" <[email protected]> wrote in message
news:1229096146.22284.27.ca...@localhost...
> On Fri, 2008-12-12 at 06:34 -0600, Jay Blanchard wrote:
>> [snip]
>> It's Christmas... the season of giving and tolerance :|
>> [/snip]
>>
>> We will return you to your regularly scheduled Robert Cummings Jan 2nd,
>> 2009
>
> Are you suggesting I'm not tolerant? Pfff.
>
> :)
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
if you break it down he actually said you are very tollerant, but there is
an explicit limiter of Jan 2nd on the degree of tollerance supplied by the
said Cummings system.
--- End Message ---
--- Begin Message ---
On Fri, 2008-12-12 at 11:02 -0500, Daniel Brown wrote:
> On Fri, Dec 12, 2008 at 10:35, Robert Cummings <[email protected]> wrote:
> >
> > Are you suggesting I'm not tolerant? Pfff.
>
> Not since you've let those crosses on the lawn burn out. ;-P
Those aren't crosses... they're plus symbols, I was teaching my son
basic addition when suddenly a bolt of lightning smacked our car, which
then exploded and splashed our symbols with burning gasoline and car
wreckage. Yeah, that's what REEEEEEALLY happened!
> And yet, despite all of this, poor ol' [email protected] is
> left in the cold.
There's a php-db list? What for?
;)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
In my enrollment database, we keep historical information. My client
is a big computer training organization (for which I also teach). The
enrollment information is quite fluid -- people are always canceling
or rescheduling. It is important for us to know a person's history.
$.02
Ken
On Dec 12, 2008, at 9:16 AM, tedd wrote:
At 2:50 PM +0000 12/12/08, Colin Guthrie wrote:
'Twas brillig, and tedd at 12/12/08 14:36 did gyre and gimble:
That's neat and a lot more powerful than I thought. It's like
following a linked list to it's end while removing all traces of
the thread.
Exactly
And I understand the "instructor delete" was not intended.
Yeah indeed. I had a db structure in my head and the statement
made vague sense with that in mind, but it totally failed to leak
through my hands on to the keyboard :P
There are three main options here:
* ON DELETE CASCADE (if the FK's referenced table has it's record
deleted, delete the record here too).
* ON DELETE RESTRICT (if the FK's referenced table has it's
record deleted stop that whole transaction - e.g. *prevent* the
delete).
* ON DELETE SET NULL (if the FK's referenced table has it's
record deleted, set this tables reference to NULL).
All three are useful in different contexts. I use them extensively
to ensure good data integrity. The trade off on extra load on
insert/update is IMO well worth it.
Col
Col:
That's all good to know.
My first tendency is to keep everything. After all, memory is cheap
and access times are always reducing.
While it's true that having a bunch of worthless data doesn't
accomplish anything and slows the process of dealing with it. But,
technology in access times and storage capabilities are getting to
the point of making the decision to keep/delete worthless data moot.
As such, I think the need for FK deletions will become less and
perhaps disappear from the language. For some reason, I look upon
deletions in similar light as renumbering a table's index after
deletion of a record -- like "what's the point?"
I'm just rambling -- thanks again for your insight.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
'Twas brillig, and tedd at 12/12/08 15:16 did gyre and gimble:
My first tendency is to keep everything. After all, memory is cheap and
access times are always reducing.
While it's true that having a bunch of worthless data doesn't accomplish
anything and slows the process of dealing with it. But, technology in
access times and storage capabilities are getting to the point of making
the decision to keep/delete worthless data moot.
As such, I think the need for FK deletions will become less and perhaps
disappear from the language. For some reason, I look upon deletions in
similar light as renumbering a table's index after deletion of a record
-- like "what's the point?"
I'm just rambling -- thanks again for your insight.
Rambling is good... I'll continue!
With data retention and data protection laws (something that can vary
around the world making life for web-based providers like ourselves even
more complex), I think it is increasingly important that information
about a given person can be scrubbed very easily. Keeping the data may
be cheap from a storage/access perspective, but complying with laws and
regulations can be wearisome and time consuming.
If you FKs are fully up-to-date and have proper cascading you can be
sure that a simple:
DELETE FROM users WHERE user_id=123;
really will delete all the information you store about that individual.
You just have to look at the hullabaloo over the "deactivated" Facebook
accounts etc. to realise that hiding or disabling data is not enough in
many cases.
Food for thought!
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
--- End Message ---
--- Begin Message ---
At 4:34 PM +0000 12/12/08, Colin Guthrie wrote:
'Twas brillig, and tedd at 12/12/08 15:16 did gyre and gimble:
My first tendency is to keep everything. After all, memory is cheap
and access times are always reducing.
While it's true that having a bunch of worthless data doesn't
accomplish anything and slows the process of dealing with it. But,
technology in access times and storage capabilities are getting to
the point of making the decision to keep/delete worthless data moot.
As such, I think the need for FK deletions will become less and
perhaps disappear from the language. For some reason, I look upon
deletions in similar light as renumbering a table's index after
deletion of a record -- like "what's the point?"
I'm just rambling -- thanks again for your insight.
Rambling is good... I'll continue!
With data retention and data protection laws (something that can
vary around the world making life for web-based providers like
ourselves even more complex), I think it is increasingly important
that information about a given person can be scrubbed very easily.
Keeping the data may be cheap from a storage/access perspective, but
complying with laws and regulations can be wearisome and time
consuming.
If you FKs are fully up-to-date and have proper cascading you can be
sure that a simple:
DELETE FROM users WHERE user_id=123;
really will delete all the information you store about that individual.
You just have to look at the hullabaloo over the "deactivated"
Facebook accounts etc. to realise that hiding or disabling data is
not enough in many cases.
Food for thought!
Col
Col:
I'll continue rambling.
Excellent point -- Yes, I forgot about security issues. For example
most on-line credit card processing agreements state that you must
delete the actual credit card information (i.e., cc and cvs numbers)
within 24 hours of a customer's purchase.
I often have problems explaining that to clients who want to keep
such information on-line. I tell them what they do with the hard copy
of that information is their business, but I'm not going to jail to
keep that data in a database for them.
Anyone else experienced that problem? And if so, how did you handle it?
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
I can't seem to find a reference to this in the manual, but is there an
order of precedence for and or xor in an if statement? Kind of like PPMDAS
or polish notation for math (PPMDAS = Powers. Parenthacies.
Multiplication...)
I ask because this seems to be working for me, but I want to make sure it is
doing what I think it is.
(code follows)
if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and
(($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and
(($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
(end code)
which is if either of the first set, and either of the second set, and
either of the third set is true return true.
Thanks in advance!
Frank
--- End Message ---
--- Begin Message ---
Frank Stanovcak wrote:
I can't seem to find a reference to this in the manual, but is there an
order of precedence for and or xor in an if statement? Kind of like PPMDAS
or polish notation for math (PPMDAS = Powers. Parenthacies.
Multiplication...)
I ask because this seems to be working for me, but I want to make sure it is
doing what I think it is.
(code follows)
if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and
(($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and
(($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
(end code)
which is if either of the first set, and either of the second set, and
either of the third set is true return true.
Thanks in advance!
Frank
http://nl.php.net/manual/en/language.operators.php#language.operators.precedence
--- End Message ---
--- Begin Message ---
Frank Stanovcak wrote:
I can't seem to find a reference to this in the manual, but is there an
order of precedence for and or xor in an if statement? Kind of like PPMDAS
or polish notation for math (PPMDAS = Powers. Parenthacies.
Multiplication...)
I ask because this seems to be working for me, but I want to make sure it is
doing what I think it is.
(code follows)
if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and
(($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and
(($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
(end code)
which is if either of the first set, and either of the second set, and
either of the third set is true return true.
Thanks in advance!
Frank
http://nl.php.net/manual/en/language.operators.php#language.operators.precedence
--- End Message ---
--- Begin Message ---
Thanks. Don't know how I could have missed that.
"Maciek Sokolewicz" <[email protected]> wrote in message
news:[email protected]...
> Frank Stanovcak wrote:
>> I can't seem to find a reference to this in the manual, but is there an
>> order of precedence for and or xor in an if statement? Kind of like
>> PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies.
>> Multiplication...)
>>
>> I ask because this seems to be working for me, but I want to make sure it
>> is doing what I think it is.
>>
>> (code follows)
>> if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and
>> (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and
>> (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
>> (end code)
>>
>> which is if either of the first set, and either of the second set, and
>> either of the third set is true return true.
>>
>> Thanks in advance!
>> Frank
> http://nl.php.net/manual/en/language.operators.php#language.operators.precedence
>
--- End Message ---
--- Begin Message ---
Thanks. Don't know how I could have missed that.
"Maciek Sokolewicz" <[email protected]> wrote in message
news:[email protected]...
> Frank Stanovcak wrote:
>> I can't seem to find a reference to this in the manual, but is there an
>> order of precedence for and or xor in an if statement? Kind of like
>> PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies.
>> Multiplication...)
>>
>> I ask because this seems to be working for me, but I want to make sure it
>> is doing what I think it is.
>>
>> (code follows)
>> if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and
>> (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and
>> (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
>> (end code)
>>
>> which is if either of the first set, and either of the second set, and
>> either of the third set is true return true.
>>
>> Thanks in advance!
>> Frank
> http://nl.php.net/manual/en/language.operators.php#language.operators.precedence
>
--- End Message ---
--- Begin Message ---
2008/12/12 Richard Heyes <[email protected]>:
> Well it's not really related to PHP, but certainly web development in
> general. Personally, I was surprised by the jump from 0.4 to 1.0.
> Judging by other Google betas (eg Gmail) I was expecting it to be in
> beta for the next decade or so.
>
As seen on ./, it seems that Google may be pressing OEMs to include
Chrome bundled on new computers. That cannot happen with a beta web
browser.
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü
--- End Message ---
--- Begin Message ---
> As seen on ./, it seems that Google may be pressing OEMs to include
> Chrome bundled on new computers. That cannot happen with a beta web
> browser.
Great. Can't fault them. Even in its beta state, I think it's better
than MSIE. I still use Firefox though...
--
Richard Heyes
HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated December 5th)
--- End Message ---
--- Begin Message ---
On Fri, 2008-12-12 at 18:39 +0200, Dotan Cohen wrote:
> 2008/12/12 Richard Heyes <[email protected]>:
> > Well it's not really related to PHP, but certainly web development in
> > general. Personally, I was surprised by the jump from 0.4 to 1.0.
> > Judging by other Google betas (eg Gmail) I was expecting it to be in
> > beta for the next decade or so.
> >
>
> As seen on ./, it seems that Google may be pressing OEMs to include
> Chrome bundled on new computers. That cannot happen with a beta web
> browser.
Do you mean "as seen on /." ?
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
2008/12/12 Robert Cummings <[email protected]>:
> Do you mean "as seen on /." ?
>
I do, at least.. at least I mean what I say... that's the same thing, you know.
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü
--- End Message ---
--- Begin Message ---
Hello - - --- -- - --
I need to develop Credit Card processing for my current application.
We have our own shopping cart. We have been trying in vain to get
technical information from PaymenTech for *months* -- but it seems
that Chase sold part of it, or split it off into a separate company
-- or something. in any case, they seem extremely distracted and
unresponsive.
By doing some heavy googling, I was able to find some code from a PHP
developer's web site, mostly for the format of the xml strings to
pass to them.
I can't believe that they don't have a processing object for PHP
already available, but it seems not. I see in the archives a couple
of requests to the group for code, but the most recent was a couple
of years old. So, I'll ask again:
Anybody have modules, code, tips, land mines, or any other
information for doing credit card processing with PaymenTech that you
would be willing to share?
Many thanks - - -
Ken
--- End Message ---
--- Begin Message ---
Hi,
I want to set a link like
<a href="http://www.anyurl.com?mypar=17&color=red"> ...
into my HTML file; that works fine.
But if I specify a hex color like #CC0000 instead of "red",
<a href="http://www.anyurl.com?mypar=17&color=#CC0000"> ...
the color is ignored (probably because # starts a PHP comment).
Is there any workaround for this problem ?
Thanks and Regards
Xaver
--- End Message ---
--- Begin Message ---
On Thu, 2008-12-11 at 11:30 +0100, Xaver Thum wrote:
> Hi,
>
> I want to set a link like
>
> <a href="http://www.anyurl.com?mypar=17&color=red"> ...
>
> into my HTML file; that works fine.
>
> But if I specify a hex color like #CC0000 instead of "red",
>
> <a href="http://www.anyurl.com?mypar=17&color=#CC0000"> ...
>
> the color is ignored (probably because # starts a PHP comment).
> Is there any workaround for this problem ?
>
> Thanks and Regards
urlencode()
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
On Thu, Dec 11, 2008 at 05:30, Xaver Thum <[email protected]> wrote:
>
> But if I specify a hex color like #CC0000 instead of "red",
>
> <a href="http://www.anyurl.com?mypar=17&color=#CC0000"> ...
>
> the color is ignored (probably because # starts a PHP comment).
> Is there any workaround for this problem ?
Hey, X;
Actually, it's skipped because it's seen as a page anchor. That's
a client-side only thing, and the browser would then be looking for:
<a name="CC0000" id="CC0000"></a>
Instead, skip the hashmark:
<a href="http://www.anyurl.com/?mypar=17&color=CC0000"> ...
.... and have it parsed similarly to this:
<?php
if(strlen($_GET['color']) == 6 &&
preg_match('/[a-f0-9]{6}/i',trim($_GET['color']))) {
// Color is a legitimate HTML hexadecimal color
$_GET['color'] = strtoupper($_GET['color']); // Set upper-case
} else {
// Color is not legit, was not supplied, or this may be a lame
hack attempt
$_GET['color'] = 'CC0000'; // Force default color
}
$color = '#'.$_GET['color'];
?>
--
</Daniel P. Brown>
http://www.parasane.net/
[email protected] || [email protected]
50% Off Hosting! http://www.pilotpig.net/specials.php
--- End Message ---
--- Begin Message ---
Hi,
thanks for the quick solutions !
Regards Xaver
""Xaver Thum"" <[email protected]> schrieb im Newsbeitrag
news:[email protected]...
> Hi,
>
> I want to set a link like
>
> <a href="http://www.anyurl.com?mypar=17&color=red"> ...
>
> into my HTML file; that works fine.
>
> But if I specify a hex color like #CC0000 instead of "red",
>
> <a href="http://www.anyurl.com?mypar=17&color=#CC0000"> ...
>
> the color is ignored (probably because # starts a PHP comment).
> Is there any workaround for this problem ?
>
> Thanks and Regards
>
> Xaver
>
--- End Message ---
--- Begin Message ---
Can I use another class inside of a function in a class
this function process_queue below is inside of a class called class mailer
I want to use the phpMailer class inside of this function so I can send
email using smtp.
Can this be done and is there any information out there on how to do this
function process_queue($num=10){
if (isset($this->db_settings['demo']) and
($this->db_settings['demo'])){
return;
}
$q = $this->ams->db->query("SELECT * FROM
{$this->ams->pre}email_queue
WHERE queue_state = 0 ORDER BY
queue_time_added ASC LIMIT $num");
while ($row = $this->ams->db->nqfetch($q)){
$this->to = $row['queue_to'];
$this->headers = $row['queue_headers'];
$this->subject = $row['queue_subject'];
$this->message = $row['queue_text'];
$updateq = $this->ams->db->query("UPDATE
{$this->ams->pre}email_queue SET
queue_time_added = queue_time_added,
queue_time_sent = NOW(),
queue_state = -2 WHERE queue_id =
{$row['queue_id']}");
if (@mail($this->to, $this->subject, $this->message,
$this->headers)){
$result = 1;
}
else{
$result = -1;
}
if ($this->ams->settings['email_debug']){
@mail ($this->ams->settings['site_email'],
$this->subject, $this->message, $this->headers);
}
$updateq = $this->ams->db->query("UPDATE
{$this->ams->pre}email_queue SET
queue_time_added = queue_time_added,
queue_time_sent = NOW(),
queue_state = $result WHERE queue_id =
{$row['queue_id']}");
}
}
--- End Message ---
--- Begin Message ---
On Fri, 2008-12-12 at 13:21 -0800, Richard Kurth wrote:
> Can I use another class inside of a function in a class
>
>
> this function process_queue below is inside of a class called class mailer
> I want to use the phpMailer class inside of this function so I can send
> email using smtp.
> Can this be done and is there any information out there on how to do this
Should be simple enough. Make sure you've included the file that holds
the phpMailer class (and any dependencies it may have) then just
instantiate an instance of the class... or am I missing the oint of the
question?
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
Hey there, okay I ran into these and need some tips, pointers etc...
First I was getting the Resource ID#5 error with this query:
$query="SELECT * FROM importimages WHERE Category='Obits'";
$result = mysql_query($query);
so then I read how mysql_query returns a resource, so I tried this:
$query = "SELECT * FROM importimages WHERE Category='Obits' ";
$result = mysql_query ($query);
$arr = mysql_fetch_row($result);
$result2 = $arr[0];
echo ($result2);
when I echo the result2 I get: 8561 --no idea what the heck that is....
the next line is this and its giving me probs: while ($row =
mysql_fetch_object ($result)) <------that is what it was orginally but it is
not pulling anything out of the db, which led me to echo the query results
(see I am learning finally) so I could see if it really wasn't doing
anything and well its not...and if I try to make an array and then fetch it
as an object it tells me invalid,
I think I'm confused about how to make an object out of an array (if that is
what I want to do) this is pulling images from a db.
Thanks guys!
Terion
--- End Message ---
--- Begin Message ---
On Fri, Dec 12, 2008 at 16:54, Terion Miller <[email protected]> wrote:
>
> $query = "SELECT * FROM importimages WHERE Category='Obits' ";
> $result = mysql_query ($query);
>
> $arr = mysql_fetch_row($result);
> $result2 = $arr[0];
> echo ($result2);
Try this to get yourself started:
<?php
$sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
$result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
- ".mysql_error());
while($row = mysql_fetch_array($result)) {
foreach($row as $k => $v) {
echo stripslashes($k).": ".stripslashes($v)."<br />\n";
}
}
?>
NOTE: You shouldn't need stripslashes(), but it's put there just
for backwards-compatibility in case you're on an older (or
poorly-configured) installation.
--
</Daniel P. Brown>
http://www.parasane.net/
[email protected] || [email protected]
50% Off Hosting! http://www.pilotpig.net/specials.php
--- End Message ---
--- Begin Message ---
On Fri, Dec 12, 2008 at 4:02 PM, Daniel P. Brown
<[email protected]>wrote:
> On Fri, Dec 12, 2008 at 16:54, Terion Miller <[email protected]>
> wrote:
> >
> > $query = "SELECT * FROM importimages WHERE Category='Obits' ";
> > $result = mysql_query ($query);
> >
> > $arr = mysql_fetch_row($result);
> > $result2 = $arr[0];
> > echo ($result2);
>
> Try this to get yourself started:
>
> <?php
> $sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
> $result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
> - ".mysql_error());
> while($row = mysql_fetch_array($result)) {
> foreach($row as $k => $v) {
> echo stripslashes($k).": ".stripslashes($v)."<br />\n";
> }
> }
> ?>
>
> NOTE: You shouldn't need stripslashes(), but it's put there just
> for backwards-compatibility in case you're on an older (or
> poorly-configured) installation.
>
> --
> </Daniel P. Brown>
> http://www.parasane.net/
> [email protected] || [email protected]
> 50% Off Hosting! http://www.pilotpig.net/specials.php
>
Thanks Daniel that did get me further, am I now to build an object from the
array, or take off one of the array to make an object, your snippet did grab
the names of the images and print them to the page but then I get stuck
where the page is trying to "get the property of a non-object" ..so I guess
i"m asking is a possible to turn an array into an object? or in this case
separate objects?
--- End Message ---
--- Begin Message ---
On Fri, Dec 12, 2008 at 4:52 PM, Terion Miller <[email protected]>wrote:
>
>
> On Fri, Dec 12, 2008 at 4:02 PM, Daniel P. Brown <
> [email protected]> wrote:
>
>> On Fri, Dec 12, 2008 at 16:54, Terion Miller <[email protected]>
>> wrote:
>> >
>> > $query = "SELECT * FROM importimages WHERE Category='Obits' ";
>> > $result = mysql_query ($query);
>> >
>> > $arr = mysql_fetch_row($result);
>> > $result2 = $arr[0];
>> > echo ($result2);
>>
>> Try this to get yourself started:
>>
>> <?php
>> $sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
>> $result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."well
>> I changed it to
>> - ".mysql_error());
>> while($row = mysql_fetch_array($result)) {
>> foreach($row as $k => $v) {
>> echo stripslashes($k).": ".stripslashes($v)."<br />\n";
>> }
>> }
>> ?>
>>
>> NOTE: You shouldn't need stripslashes(), but it's put there just
>> for backwards-compatibility in case you're on an older (or
>> poorly-configured) installation.
>>
>> --
>> </Daniel P. Brown>
>> http://www.parasane.net/
>> [email protected] || [email protected]
>> 50% Off Hosting! http://www.pilotpig.net/specials.php
>>
>
> Thanks Daniel that did get me further, am I now to build an object from the
> array, or take off one of the array to make an object, your snippet did grab
> the names of the images and print them to the page but then I get stuck
> where the page is trying to "get the property of a non-object" ..so I guess
> i"m asking is a possible to turn an array into an object? or in this case
> separate objects?
>
Well I did some changes and I must be learning because although I have the
same error I don't have new ones...
so now the code is like this:
$sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
$result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
- ".mysql_error());
while($object = mysql_fetch_object($result)) {
foreach($object as $k => $v) {
echo stripslashes($k).": ".stripslashes($v)."<br />\n";
}
}
$FileName = $object->Image; <-------This is the line that is telling
me it is "trying to get the properties of a non-object....
--- End Message ---
--- Begin Message ---
On Fri, Dec 12, 2008 at 18:03, Terion Miller <[email protected]> wrote:
>
> Well I did some changes and I must be learning because although I have the
> same error I don't have new ones...
> so now the code is like this:
> $sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
> $result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
> - ".mysql_error());
> while($object = mysql_fetch_object($result)) {
> foreach($object as $k => $v) {
> echo stripslashes($k).": ".stripslashes($v)."<br />\n";
> }
> }
>
>
> $FileName = $object->Image; <-------This is the line that is telling
> me it is "trying to get the properties of a non-object....
That's because you're calling that as an object using OOP
standards, where I gave you procedural code. To interface with my
code, just call it as:
<?php
// .... other code here....
while($row = mysql_fetch_array($result)) {
echo $row['Image']."<br />\n"; // If `Image` is the column name.
}
// .... code continues....
?>
--
</Daniel P. Brown>
http://www.parasane.net/
[email protected] || [email protected]
50% Off Hosting! http://www.pilotpig.net/specials.php
--- End Message ---
--- Begin Message ---
On Fri, Dec 12, 2008 at 5:08 PM, Daniel P. Brown
<[email protected]>wrote:
> On Fri, Dec 12, 2008 at 18:03, Terion Miller <[email protected]>
> wrote:
> >
> > Well I did some changes and I must be learning because although I have
> the
> > same error I don't have new ones...
> > so now the code is like this:
> > $sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
> > $result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
> > - ".mysql_error());
> > while($object = mysql_fetch_object($result)) {
> > foreach($object as $k => $v) {
> > echo stripslashes($k).": ".stripslashes($v)."<br />\n";
> > }
> > }
> >
> >
> > $FileName = $object->Image; <-------This is the line that is
> telling
> > me it is "trying to get the properties of a non-object....
>
> That's because you're calling that as an object using OOP
> standards, where I gave you procedural code. To interface with my
> code, just call it as:
>
> <?php
> // .... other code here....
> while($row = mysql_fetch_array($result)) {
> echo $row['Image']."<br />\n"; // If `Image` is the column name.
> }
> // .... code continues....
> ?>
>
> --
> </Daniel P. Brown>
> http://www.parasane.net/
> [email protected] || [email protected]
> 50% Off Hosting! http://www.pilotpig.net/specials.php
>
Here is the full chunk:
$sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
$result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
- ".mysql_error());
while($object = mysql_fetch_object($result)) {
foreach($object as $k => $v) {
echo stripslashes($k).": ".stripslashes($v)."<br />\n";
}
}
$FilePath = "output/WebImagesHiRes/";
$BackupPath = "output/WebImagesHiRes/backup/";
$FileName = $object->Image; //<----because it is going to process an
image doesnt that make it oop?
$FileName = str_replace("/", "", $FileName);
$FileName = str_replace(".jpg", "", $FileName);
Well its late friday afternoon here, I'm ready to break away from my
desk...maybe on monday I will be able to get it working (right now our obit
pics in the online paper are not getting posted...oops)
Thanks folks
yawn LEts call it a weekend woooot
terion
--- End Message ---
--- Begin Message ---
Terion Miller wrote:
> On Fri, Dec 12, 2008 at 5:08 PM, Daniel P. Brown
> <[email protected]>wrote:
>
>> On Fri, Dec 12, 2008 at 18:03, Terion Miller <[email protected]>
>> wrote:
>>> Well I did some changes and I must be learning because although I have
>> the
>>> same error I don't have new ones...
>>> so now the code is like this:
>>> $sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
>>> $result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
>>> - ".mysql_error());
>>> while($object = mysql_fetch_object($result)) {
>>> foreach($object as $k => $v) {
>>> echo stripslashes($k).": ".stripslashes($v)."<br />\n";
>>> }
>>> }
>>>
>>>
>>> $FileName = $object->Image; <-------This is the line that is
>> telling
>>> me it is "trying to get the properties of a non-object....
>> That's because you're calling that as an object using OOP
>> standards, where I gave you procedural code. To interface with my
>> code, just call it as:
>>
>> <?php
>> // .... other code here....
>> while($row = mysql_fetch_array($result)) {
>> echo $row['Image']."<br />\n"; // If `Image` is the column name.
>> }
>> // .... code continues....
>> ?>
>>
>> --
>> </Daniel P. Brown>
>> http://www.parasane.net/
>> [email protected] || [email protected]
>> 50% Off Hosting! http://www.pilotpig.net/specials.php
>>
>
> Here is the full chunk:
> $sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
> $result = mysql_query($sql) or die("Error in ".__FILE__.":".__LINE__."
> - ".mysql_error());
> while($object = mysql_fetch_object($result)) {
> foreach($object as $k => $v) {
> echo stripslashes($k).": ".stripslashes($v)."<br />\n";
> }
> }
> $FilePath = "output/WebImagesHiRes/";
> $BackupPath = "output/WebImagesHiRes/backup/";
>
> $FileName = $object->Image; //<----because it is going to process an
> image doesnt that make it oop?
> $FileName = str_replace("/", "", $FileName);
> $FileName = str_replace(".jpg", "", $FileName);
>
> Well its late friday afternoon here, I'm ready to break away from my
> desk...maybe on monday I will be able to get it working (right now our obit
> pics in the online paper are not getting posted...oops)
> Thanks folks
> yawn LEts call it a weekend woooot
> terion
>
Try this
<?php
$FilePath = "output/WebImagesHiRes/";
$BackupPath = "output/WebImagesHiRes/backup/";
#setup query
$sql = "SELECT * FROM `importimages` WHERE `Category` = 'Obits'";
#excute query and return results, if any
$result = mysql_query($sql) or
die("Error in ".__FILE__.":".__LINE__." - ".mysql_error());
# Loop through results, pulling each resulting row as an object
while($object = mysql_fetch_object($result)) {
# Grab the Image contents and work with it.
$FileName = $object->Image; // Watch it, this is case-sensitive!!!
$FileName = str_replace("/", "", $FileName);
$FileName = str_replace(".jpg", "", $FileName);
echo $FileName;
... Do the rest of what you place to do with each row ...
}
?>
--
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
--- End Message ---
--- Begin Message ---
Since Marc Liyange hasn't updated his binary since 5.2.4, I've been
looking for some instructions on building my own, specifically the
latest 5.2.8 source for 10.4 Server. Google doesn't turn up anything
for me. Anyone have a good link?
...Rene
--- End Message ---