Solved

php mysql look for re sult that = y

Posted on 2013-01-06
1
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

630 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