Forum Moderators: coopster

Message Too Old, No Replies

problem pulling data from a DB

and then doing anything with it

         

Sarah Atkinson

8:31 pm on Apr 15, 2008 (gmt 0)

10+ Year Member



I have a DB and one of the fields contains a list of URLS separated by a coma and maybe on different lines.

this is my code and it doesn't work:


$imgsting=$row['ImageURLS'];
$imgarray=split(',', $imgsting,3);
$img=$imgarray[0];
echo '<p>IMAGE:' .$img . '</p>';

eelixduppy

8:38 pm on Apr 15, 2008 (gmt 0)



The code that you have looks like it should be working. Try outputting the following to see if you are getting everything correctly:

echo '<pre>';
print_r($imgarray);
echo '</pre>';

Also, what do you mean by "it doesn't work"? Are you getting errors? Blank screen? No data where it should be? etc

Sarah Atkinson

9:22 pm on Apr 15, 2008 (gmt 0)

10+ Year Member



no data where I should be getting some. I've tried using echo but that didn't work. I'll try your suggestion tomorrow... I'm going Home... I'm not staying another late night to do this programing crap

Sarah Atkinson

1:34 pm on Apr 16, 2008 (gmt 0)

10+ Year Member



I tried that on the first one.. I didn't get anything on the second one I got:
Array
(
[0] =>
)

This whole thing is in a while statement.

Should I do something different when pulling from the DB?

Pico_Train

2:04 pm on Apr 16, 2008 (gmt 0)

10+ Year Member



put the db query in here so we can see that...

Sarah Atkinson

2:22 pm on Apr 16, 2008 (gmt 0)

10+ Year Member



um that would be a good idea Pico... I haven't yet gotten through my first cup of coffee.....

$sql = "SELECT specials.*, Vin_inventroy.Year, Vin_inventroy.Make, Vin_inventroy.Model, Vin_inventroy.StockNumber, Vin_inventroy.ImageURLs FROM specials LEFT JOIN Vin_inventroy USING (StockNumber) WHERE specials.Type='indexpage'";

Pico_Train

3:45 pm on Apr 16, 2008 (gmt 0)

10+ Year Member



isn't it inventory and not inventroy...check the db table names...

Sarah Atkinson

8:09 pm on Apr 16, 2008 (gmt 0)

10+ Year Member



oops... I misspelled my table name... But that's not the problem ... as long as I keep it consistent...However I did seem to get it fixed... have no clue how I did it though...maybe it had something to do with me yelling profanities at the computer while clicking the upload button 100 times/sec.... we'll never no.