Jump to content

[SOLVED] Syntax Help


Vanders

Recommended Posts

Hi,

I don't know very much PHP, but I'm trying to update a page that generates a CSV from a database. The part that I need to update doesn't pull from the database at all. Here's what I've been able to come up with and it works fine, but it only inserts info for one image. I need to be able to insert info for 8 images. I've tried several things that didn't work. I know this is a simple syntax thing and I'd really appreciate any help.

 

The code I have now:

$field[] = 'http://www.websiteaddress.com/Images/' . $carInfo['stock_num'] . '_01.jpg';

 

Thanks!

Vanders

Link to comment
https://forums.phpfreaks.com/topic/147627-solved-syntax-help/
Share on other sites

I need more items in the same field. I can add additional fields, but I can't figure out how to add additional info in this one. I tried this, but it only returns one image link. I just have no clue how to format it so that it puts all the info in one field.

Thanks!!!

 

$field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_01.jpg'; 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_02.jpg'; 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_03.jpg';

 

I don't have easy access to the SQL. I can get it but it's a pain. Can we figure something out without it? I didn't create the SQL or the PHP pages. We had a company do that for us, but they aren't around any more. I figured out how to get the one image included by looking through what was there. I've read a little about PHP, but I really only know a tiny amount. Thanks again!

Link to comment
https://forums.phpfreaks.com/topic/147627-solved-syntax-help/#findComment-774996
Share on other sites

<?php $field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_01.jpg'; 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_02.jpg'; 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_03.jpg'; ?>

 

should probably be:

<?php
$field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_01.jpg'; 
$field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_02.jpg';
$field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_03.jpg';
?>

Link to comment
https://forums.phpfreaks.com/topic/147627-solved-syntax-help/#findComment-775000
Share on other sites

Thanks Phantom, but that would create a seperate field for each image. The result that I'm looking for would include all three in one field. The text generated would look like this, "http://www.websitename.com/Images/V123_01.jpg, http://www.websitename.com/Images/V123_02.jpg, http://www.websitename.com/Images/V123_01.jpg"

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/147627-solved-syntax-help/#findComment-775006
Share on other sites

After reading the link, I tried this and it didn't work either. argh.

 

$field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_01.jpg' . ',' 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_02.jpg'. ',' 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_03.jpg';

 

 

Link to comment
https://forums.phpfreaks.com/topic/147627-solved-syntax-help/#findComment-775016
Share on other sites

You've got a bit of a mess with quotes

$field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_01.jpg' . ',' 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_02.jpg'. ',' 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_03.jpg';

 

should be

 

$field[] = 'http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_01.jpg, http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_02.jpg, http://www.websitename.com/Images/' . $carInfo['stock_num'] . '_03.jpg';

Link to comment
https://forums.phpfreaks.com/topic/147627-solved-syntax-help/#findComment-775019
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.