logo
down
shadow

Passing a value retrieved from a database to another page using php and mysql


Passing a value retrieved from a database to another page using php and mysql

By : Terra_Byte
Date : November 21 2020, 07:31 AM
wish help you to fix your issue I am trying to pass a value that I have received from my database to another php page to use within another SQL statement. I have tried using sessions and also passing using the $_POST method on the other page but have had no luck.
code :
while($row = mysqli_fetch_array($sql)){
    echo '<td>
              <img src="'.$row['image'].'"><br/>
              <form method="post" action="edit-record.php">
                  <input type="text" name="imgID" value="'.$row['id'].'">
                  <input type="submit" value="Edit" id="edit_btn" class="admin_btn">
              </form>
          </td>';
}
<?php
    echo $_POST['imgID'];
?>
while($row = mysqli_fetch_array($sql)){
    echo '<td>
              <img src="'.$row['image'].'"><br/>
              <a href="edit-record.php?id='.$row['id'].'">edit</a>
          </td>';
}
<?php
    echo $_GET['id'];
?>


Share : facebook icon twitter icon
how to display a table retrieved from database to a jsp page via a controller page in Struts framework

how to display a table retrieved from database to a jsp page via a controller page in Struts framework


By : user2069077
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further In Model class you can convert your ResultSet into List which subsequently returned to view.The only code you need to write is converting ResultSet into List of Object
mysql LAST_INSERT_ID() is causing some SQL problems when passing back value retrieved

mysql LAST_INSERT_ID() is causing some SQL problems when passing back value retrieved


By : user2251433
Date : March 29 2020, 07:55 AM
hope this fix your issue Had to scrap this code...couldn't get it all to work with the feature for the app so we dropped it. for your help.
Passing retrieved database records to a php file

Passing retrieved database records to a php file


By : user3613753
Date : March 29 2020, 07:55 AM
Hope that helps You may do that via GET, Session or Post; But why don't you simply and efficiently define a function and pass those variables to it, just for example:
code :
function displayArticle($title, $summary, $content) {
    displayHeader(); // maybe some concepts you've used in template/common/header.php
    echo "<h1>$title</h1><p>$summary</p><div>$content</div>";
    displayFooter(); // again, what you've provided in footer.php
}
Passing retrieved value from database into another page

Passing retrieved value from database into another page


By : Jason Doggart
Date : March 29 2020, 07:55 AM
will be helpful for those in need You can add the id into a query string, like http://blah.com/product.php?id=123
code :
<a href="../homescreen/product/product.php?id=<?= $product_array[$key]["id"]; ?>" class="btn btn-default add-to-cart">
    <i class="fa fa-shopping-cart"></i>Add to cart
</a>
$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
Database retrieved values are selected from checkbox and viewed in another page, But when page is reloaded results does

Database retrieved values are selected from checkbox and viewed in another page, But when page is reloaded results does


By : Prince Arora
Date : March 29 2020, 07:55 AM
Any of those help Store the $_POST["check"] in one session variable and use that session variable to check using array_key_exists
code :
    <?php 
    session_start();

    include 'config.php';

    if(!isset($_SESSION['checked'])){
        $_SESSION['checked']=$_POST['check'];
    }

    $checked = $_SESSION['checked'];


    if(!empty($checked))
    {

        $sql="select * from company_details";
        $result = $con->query($sql);
        if ($result->num_rows > 0) 
        {

            while($row = $result->fetch_assoc()) 
            {

            $ID=$row['id'];
            /* Get the Book ID and now we have to fetch from $_POST the value from the form */
            if (array_key_exists($ID, $checked)) {
                $ischecked=$checked[$ID];
                /* See if this has a value of 1.  If it does, it means it has been checked */
                if ($ischecked==1) 
                {
                    ?>

                    <div class="col-lg-6" style="padding-top: 20px;">
                    <section>
                        <div class="well">
                            <div class="card" >
                                <div class="row ">
                                    <div class="col-md-4">
                                        <?php echo '<img src="' . $row['image_path4']. '" width="100" height="100">'; ?>
                                    </div>
                                    <div class="col-md-8 px-3">
                                        <div class="card-block px-3">
                                        <h4 class="card-title"><?php echo $row ['company_name']; ?></h4>
                                        <div >
                                            <label>Service Type</label>
                                            <?php echo $row ['service']; ?>
                                        </div>
                                        <div >
                                            <label>email</label>
                                            <?php echo $row ['email']; ?>
                                        </div>
                                        <div >
                                            <label>About</label>
                                             <?php echo substr($row['details'], 0, 300); ?>
                                        </div>

                                            <a href="#" class="btn btn-success">Read More</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>

            <?php


                }
            }
        }
    }

   }
?>
Related Posts Related Posts :
  • how to run wordpress php snippet mysql update command from ssh and/ultimately cron
  • how to get xml tag by name
  • ModSecurity maximum post limits (PCRE limit errors)
  • Call controller/action in event listener
  • How to improve performance of contacting WebService?
  • PHP nest variable in echoed string that contains a HTML tag in the end
  • Multiple Ajax request for PHP framework
  • Debug Info from Moodle Plugin
  • passing variables through page
  • Passing PHP $result data to Javascript
  • cakePHP File Download was not found or not readable
  • batch waiting until script finishes
  • PHP variables and anchors in URL
  • php eTag generation using php
  • How to check whether the array is an Integer or Not?
  • Is it possible to install Doctrine without PEAR or Composer? If so, how?
  • Call view script of (parent) Abstract controller Zend
  • Curl PHP cannot display amazon
  • Symfony, getters and setters vs magic methods
  • Using 'continue' PHP instruction outside the loop
  • AJAX POST return data not appearing
  • Can I query relations using an INNER JOIN instead of two queries in Eloquent?
  • Looping through dynamic form fields and inserting into database
  • My php code can't select mysql auto_increment value
  • Store Angularjs form data in database using php
  • I want to run my sh file continuously even if I close my Putty connection
  • file_get_contents equivalent for gzipped files
  • Include PHP file with jQuery
  • php curl headers do not return from website?
  • How to find out, if facebook ID is a user, group or page
  • Connect webhost database to android database
  • preg_match get div content with class
  • Upload multiple files in Laravel 4
  • Count array numbers in multidimensional array
  • PHP Date diff with a difference
  • Search Customer by custom field in Netsuite
  • Is it possible to hide/encode/encrypt php source code and let others have the system?
  • list items to be displayed using php code and array
  • check if row exists mysqli
  • PHP errors loading MySQL
  • setup PostgreSQL with Laravel in MAMP
  • PHP - CodeIgniter Notifications
  • Encrypting a password column in a SQL database
  • New to PHP, trying to extract information from another website
  • JavaScript AmChart to Image for Email
  • Is javascript validation enough to keep my forms secure?
  • Regex extract variables from [shortcode]
  • Download a .mp3 link and save it to computer with PHP
  • Error with the ereg_replace
  • Getting the fields attached to a bundle of an entity in Drupal
  • Php how to check multiple times (within `foreach`) if values from array exists in mysql?
  • MySQL and PHP parsing strange string
  • Pull specific data from multidimensional associative array
  • How to get the original URI extension using PHP Tonic?
  • Upload videos and images from Android to PHP server?
  • Unset a multidimensional array with another multidimensional array with values than key
  • Calling a user e-mail to add to a mailto link PHP
  • Why is override_function coming back as an undefined function
  • PHP mySQLi_fetch_all: iterate through each row
  • Using pow in php
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org