I have a payment company that I use for my website, and on one of their variables passed back to my script, $merchant_product_id, if having more than one item, it should be separated by commas, like product1, product2, product3, and if having only one item on the order, just product1.
However, every time I echo the variable, it returns only one of the products, even on multiple order items. I've e-mailed them about it and they say it works, but I didn't know if there's anything PHP skips over because of commas?
Thanks,
Brady
comma use?
Moderator: General Moderators
perhaps they are being stored in separate database rows, and you need to loop through the results.
That's assuming you're using a mysql database.
Edit: It also assumes you're using a database.
Code: Select all
$result = mysql_query("SELECT merchant_product_id FROM table WHERE value = '$value'");
while($array = mysql_fetch_assoc($result))
{
echo $array['merchange_product_id'];
}Edit: It also assumes you're using a database.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- Skittlewidth
- Forum Contributor
- Posts: 389
- Joined: Wed Nov 06, 2002 9:18 am
- Location: Kent, UK
Just a thought, but I've had a problem with variables being cut off before and it was to do with echoing them into a form field. I'd forgotten to enclose the php statement in quotes:
so the contents of the variable were being cut off at the first space, which in your case would probably occur after the first comma.
You didn't say how you were echoing the variable out so this might be entirely irrelevant though.
Code: Select all
<input name='blah' type='text' value= '<?php echo $var; ?>'/>You didn't say how you were echoing the variable out so this might be entirely irrelevant though.