Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php mysql look for re sult that = y

Posted on 2013-01-06
1
Medium Priority
?
190 Views
Last Modified: 2013-01-11
the code below is work but i want to change not limit 1   in case  presell.stockcut is y such as they have 10 row but they have 1 row that
presell.stockcut = y

then go to    


 if($checkstockcut == "y") {
      echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS1.php/\" />\n";
      }




  $query20 = "SELECT presell.stockcut  FROM presell WHERE refid = '$invoicenocheck' limit 1 ";
      $query20result  = mysql_query ($query20) or die( mysql_error());
      $row_slelectPresell = mysql_fetch_assoc($query20result );
      $checkstockcut = $row_slelectPresell['stockcut'];
      echo $checkstockcut;
          if($checkstockcut == "y") {
      echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS1.php/\" />\n";
      }
      else {

0
Comment
Question by:teera
1 Comment
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 38748510
Something like this uses the while() iterator to get multiple rows.

$query20 = "SELECT presell.stockcut  FROM presell WHERE refid = '$invoicenocheck' limit 10 ";
$query20result  = mysql_query ($query20) or die( mysql_error());
while ($row_slelectPresell = mysql_fetch_assoc($query20result ))
{
      $checkstockcut = $row_slelectPresell['stockcut'];
      echo $checkstockcut;
      if($checkstockcut == "y") 
      {
          echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS1.php/\" />\n";
      }
      else { ...
}

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question