Re: Resource ID# 5 and Resource id #5 8561 errors....help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 12, 2008 at 4:52 PM, Terion Miller <webdev.terion@xxxxxxxxx>wrote:

>
>
> On Fri, Dec 12, 2008 at 4:02 PM, Daniel P. Brown <
> daniel.brown@xxxxxxxxxxxx> wrote:
>
>> On Fri, Dec 12, 2008 at 16:54, Terion Miller <webdev.terion@xxxxxxxxx>
>> 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/
>> daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
>> 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....

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux