Jump to content

Search the Community

Showing results for tags 'whileloop'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 4 results

  1. I have below script. it does the while loop 100%. it updates the mysql database one at a time as it should. the problem I have now is that the while loop does not end and go to the next statement as it should. it keeps pollong the database. so when in back end you change to 0 it automatically updates again. Please see if you can help me to see where I can stop this while loop when there are no more loops // Here I select the amount of rows $sql_query = "SELECT ae FROM `debitorderrejectionimport` WHERE ae = '0'"; $rowCount = mysqli_query($conn,$sql_query); $rowCountUpdate = mysqli_num_rows($rowCount); echo $rowCountUpdate; while($rowCountUpdate > 0) { $sql = "UPDATE `ttee`.`au1` INNER JOIN `ttee`.`au` ON (`au1`.`id` = `au`.`id`) INNER JOIN `ttee`.`ae1` ON (`ae1`.`idd` = `au1`.`idd`) INNER JOIN `ttee`.`debitorderrejectionimport` ON (`debitorderrejectionimport`.`nr` = `ae1`.`id`) SET `au`.`amount` = `ae1`.`amount` + `au1`.`amount`, `debitorderrejectionimport`.`ae` = au.id ;"; $result = mysqli_query($conn, $sql); $updated = mysqli_affected_rows($conn); $rowCountUpdate - ($updated);} // if it finished updating and there is no more rows it must continue with below query mysqli_query($conn, " INSERT INTO `sataxicrm754`.`debitorderrejectionimport_back` ( `Outbound`, `Allocation`, `AccountName`, `QueryComplaintType`, `QueryStatus`, `Querytypeoption`, `Description`, `DealID`, `Deals`, `Assignedusername`, `Teams`, `CampaignName`, `CampaignID`, `inserted`, `idnumber`, `nr`, `datew`, `premium`, `policynumber`, `ContactNumber`, `CollectionType`, `OpportunityAmount`, `Broker`, `impref`, `id` ) SELECT `Outbound`, `Allocation`, `AccountName`, `QueryComplaintType`, `QueryStatus`, `Querytypeoption`, `Description`, `DealID`, `Deals`, `Assignedusername`, `Teams`, `CampaignName`, `CampaignID`, `inserted`, `idnumber`, `nr`, `datew`, `premium`, `policynumber`, `ContactNumber`, `CollectionType`, `OpportunityAmount`, `Broker`, `impref`, `id` FROM `sataxicrm754`.`debitorderrejectionimport` WHERE QueryComplaintType <> 'QueryComplaintType' ");
  2. I have 2 pages...1 one that has something like 500 checkboxes that list all of the active users in a database. When any number of checkboxes are selected it passes the variables from the checkboxes to the next page, asking for confirmation. Right now I have the 2nd page displaying numbers for the people, but doesn't display the correct entries. The code is below, hopefully it helps: if(isset($_POST['Update'])) //if the update button was pressed { if (isset($_POST['Player_number'])) //checks to see if any checkboxes are selected { //$Player_number = IMPLODE(',',$_POST['Player_number']); //putting the comma in between the array items echo $Player_number; ?> <input type="hidden" name="<?PHP $Player_number; ?>" value="<?PHP $Player_number; ?>"> $Player_number = IMPLODE(',',$_POST['Player_number']); //putting the comma in between the array items $result = mysql_query("SELECT * FROM `players` WHERE `Player_number` = '$Player_number' ORDER BY Player_Last_Name") or die(mysql_error()); while ($row = mysql_fetch_array($result)) //while ($row = mysql_fetch_assoc($result)) { // here is your data echo "FName: ".$row['Player_First_Name']; echo "lName: ".$row['Player_Last_Name']; echo "email: ".$row['player_email']; } foreach($_POST['Player_number'] as $row) { $result = mysql_query("SELECT `Player_First_Name`,`Player_Last_Name`,`player_email`, `Player_number` FROM `players` WHERE `Player_number` = '$Player_number' ORDER BY Player_Last_Name") or die(mysql_error()); $Player_number = IMPLODE(',',$_POST['Player_number']); //putting the comma in between the array items while($rows=mysql_fetch_array($result)) { echo "Player Number: ".$Player_number; //echo "pNumber: ".$row; //echo $rows['Player_First_Name']; ?> <tr bgcolor='<?PHP echo $bkcolor; ?>'> <td width = '20%' height="20"><div align="center"><input type="hidden" name="Player_number[]" value="<?php echo $row; ?>"></div></td> <td width= '20%' headers="20"><div align="center"><?php echo $rows['Player_First_Name']; ?></div></td> <td width= '20%' headers="20"><div align="center"><?php echo $rows['Player_Last_Name']; ?></div></td> <td width= '20%' headers="20"><div align="center"><?php echo $rows['player_email']; ?></div></td> <?PHP }//close of the while loop }//close of the foreach loop }//close of if (isset($_POST['Player_number'])) } //close of (isset($_POST['Update'] My issue that it goes through the For loop that is listed above, but list the player first name X amount of times.
  3. I'm trying to insert an image and this is my code: echo "<tr>"; echo '<td><input type="submit" name="btnPost" value="'.$rec['SKU'] . '"</td>' ; echo "<td>".$rec['NAME']."</td>"; echo "<td>".$rec['DESCR']."</td>"; echo "<td>".$rec['PRICE']."</td>"; echo "<td>"<img src=".$rec['IMAGE']">."</td>"; echo "</tr>"; $row++ ; I tried just echoing the .$rec['IMAGE'] without the img tag, but all it does is echo the name of the file instead of presenting the image itself. This is the code I'm using on another page in my HTML and it works fine, but I was curious how to insert the image inside my while loop. <img src="<?php echo $rec['IMAGE']; ?>">
  4. Hello I need to find a way to close loop outside if condition like below example if(escape($_POST['jobCategory']) != "all-categories" && escape($_POST['countryId']) == "all-countries"): $query = mysqli_query($dbConnection,"SELECT jobs.id, jobs.job_title, jobs.salary, jobs.employer_id, employers.employer_name, employers.employer_logo FROM jobs LEFT JOIN employers ON jobs.employer_id = employers.employer_id WHERE job_status = '".mysqli_real_escape_string($dbConnection,'Active')."' AND id IN (".mysqli_real_escape_string($dbConnection,$job_id_imploded).") "); while($row = mysqli_fetch_assoc($query)){ // Start Loop $job_id = $row['id']; $job_title = $row['job_title']; endif; <div class="job-title"> <a href="job_post.php?job_id=<?php echo htmlspecialchars($job_id) ?>" class="job-title-link"><?php echo htmlspecialchars($job_title); ?></a> </div> } // End Of Loop Gives me error HTTP ERROR 500
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.