Retrieval issue

16 posts by 2 authors in: Forums > CMS Builder
Last Post: May 12, 2010   (RSS)

By Jason - May 11, 2010

Hi,

The problem here is that you only define a variable $description if $counter >1. So the first time it goes through the loop, $description is undefined. Try changing the code that create $prod to this:

foreach ($prodArray as $p)
{
if($counter>1)
{
$element = explode("::",$p);
$description = $element[3];
$prod[$counter]=$description;
}
$counter++;

}


Give this a try.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Retrieval issue

Ok, I'm really confused. I made the changes you suggested and get a blank page, however, when I do a "view source", I get the following:

Notice: Undefined index: Products in /var/www/vhosts/ipac.ca/httpdocs/casestudies/includes/success.php on line 10

Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ipac.ca/httpdocs/casestudies/includes/success.php on line 28
MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))
ORDER BY dragSortOrder DESC' at line 3
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke
Attachments:

success_003.php 1K

By Jason - May 11, 2010

Hi,

I would try going through the checkout process again. There are no syntax errors in the code we're currently using. The script also isn't outputting anything, so a blank page would be normal.

The error your seeing is because the $_POST['Products'] variable wasn't being set. If you just went directly to success.php without going through the checkout process, then there is no variable, so we get an error. I just went through the checkout process again and didn't get an error, so I think that's our problem.

The good news is that the script should be working.

Give it a try and let me know. :)
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Retrieval issue

Jason: Ok, so I went through the complete checkout, and get the blank page.

Now, now how do I compare the title and extract the correct filename from the db?

I basically want to provide the client a link that he can click to download the file.
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

By Jason - May 12, 2010

Hi,

In the script so far, we've made a list of all of the titles returned from the checkout script and have retrieved all of the records from the table "ipac_articles" that has a title in that list. So all of the matching has been done.

What fields are stored in "ipac_articles"? If you store the filename or filepath there, you will have access to it with the $ipac_articlesRecords variable.

if you use this code:
<?php showme($ipac_articlesRecords); ?>

It will display everything stored in that variable.

You should be able to use a foreach loop to go through each record and create your link.

Let me know.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/