PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Nov 17, 2017 7:39 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue May 09, 2017 5:04 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4355
Location: United Kingdom
Syntax: [ Download ] [ Hide ]
   
$primaryromancode = isset($_POST['primaryromancode']) ? $_POST['primaryromancode'] : null;
  $romancode1 = isset($_POST['romancode1']) ? $_POST['romancode1'] : null;
  $romancode2 = isset($_POST['romancode2']) ? $_POST['romancode2'] : null;
  $romancode3 = isset($_POST['romancode3']) ? $_POST['romancode3'] : null;
  $romancode4 = isset($_POST['romancode4']) ? $_POST['romancode4'] : null;
  $romancode5 = isset($_POST['romancode5']) ? $_POST['romancode5'] : null;
  $romancode6 = isset($_POST['romancode6']) ? $_POST['romancode6'] : null;
  $romancode7 = isset($_POST['romancode7']) ? $_POST['romancode7'] : null;
  $romancode8 = isset($_POST['romancode8']) ? $_POST['romancode8'] : null;
  $romancode9 = isset($_POST['romancode9']) ? $_POST['romancode9'] : null;
  $romancode10 = isset($_POST['romancode10']) ? $_POST['romancode10'] : null;
  $romancode11 = isset($_POST['romancode11']) ? $_POST['romancode11'] : null;
  $romancode12 = isset($_POST['romancode12']) ? $_POST['romancode12'] : null;

$count = 0;
    $countcodes = 0;
    while ($count <= 11)
      {
      $count ++;
      echo "<font color='#ff0000'>$count</font>";
      $romancodefind = ${'romancode' . $count};
      $query = "SELECT title, photoprimary, price, romancode FROM products WHERE romancode =:romancodefind";
      $result = $pdo->prepare($query);
      $result->execute(array(':romancodefind' => $romancodefind));
      while ($row = $result->fetch(PDO::FETCH_OBJ))
        {
        echo "<div style='width: 20%; float: left'><img src='/images/productphotos/$row->photoprimary' style='width: 100%' />$row->title<br/>$row->price<Br/>($romancodefind)</div>";
      $countcodes ++;
        }
        echo "<font color='#ff0000'>$count</font>";
      }

This is giving me most strange results.
We are creating bundles of products, so we are posting up to 12 store codes, and a primary code. Hitting save.
Then it turns over, and shows you each product that has been saved.

But this is producing loads of them, and I cannot see why.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue May 09, 2017 5:12 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4355
Location: United Kingdom
Got the answer. The fields were posting blanks, and there are some blank fields in our database. So it was just pulling up the products (Test ones), that had blanks in them.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group