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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php