I have a php Mysql interaction and i wish to trigger the Mysql Search through an ONCLICK event.
iv thought about using a JS function or JQ and parsing the ID of selected through JS function but then im unsure as how i would re-execute the php to re-search the database with the new JS Veriable...
The code below is accurate and is what im working with...
How would i re execute the php with the new ID.. Much appreciated..
<div class="contentheader">
    <header> Welcome Please Choose a Catagory</strong></header>
</div>
<div id='smallpagination' class='smallpagination'>
    <?php
    //search according to chosen search critera NOT LIMITED//
    include("conect.php");
    $startit = 0;
    $startfrom = rand(0, 20);
    $displayto = $startfrom + 10;
    $search = "";
    $startedfrom = $startfrom;
    $sql = "SELECT * FROM testdata 
      WHERE title LIKE '%%$search%%'
      LIMIT $startfrom , $displayto";
    // check how many results //
    $result = $conn->query($sql);
    $row_cnt = $result->num_rows;
    while ($row = mysqli_fetch_assoc($result)) {
        $videos = $row['videos'];
        $v_id = $row['id']; //<!---important is Video ID and needed for video click selection---->
        $id = $row['id'];
        $Name = $row['Name'];
        if (empty($Name)) {
            $Name = 'Annonymous';
        }
        $image = $row['image'];
        $info = $row['info'];
        if (empty($info)) {
            $info = 'Contact Listee (if Provided) , No Item Information Given';
        }
        $phone = $row['phone'];
        if (empty($phone)) {
            $phone = 'See Listing';
        }
        $title = $row['title'];
        $locate = $row['locate'];
        if (empty($locate)) {
            $locate = 'Not Provided';
        }
        $postcoded = $row['postcode'];
        if (empty($postcoded)) {
            $postcoded = '???';
        }
        $price = $row['price'];
        if (empty($price)) {
            $price = '?';
        }
        if ($price == '0') {
            $price = '?';
        }
        $date = $row['stamp'];
        if (empty($date)) {
            $date = '';
        }
        if ($startit < 1) {
            $gotid = $row['id'];
            $startit = $startit + 1;
        };
        $vidd = $row['id'] - 0.01;
        $pidd = $row['id'] - 0.02;
        $type = $row['type'];
        $showinglocate = $row['id'] - 0.03;
        $showingphone = $row['id'] - 0.04;
        $displaytype = "minlist";
        //Thumbnails sized listings
        if ($displaytype == "minlist") {
            echo "
            <div class='floaterminhomepage'>
            <div class='innerfloaterminhomepage' >";
            if (!empty($videos)) {
                echo "
                    <video id='$v_id' style='position:absolute;  top:0%; left:0%; width:100%; height:100%; background-size: cover; object-fit:fill;' preload='metadata' onclick='showdata({$v_id});'>
                    <source src='vid/{$row['videos']}.mp4' type='video/mp4'>
                    <source src='vid/{$row['videos']}.mp4' type='video/ogg'>
                    <source src='vid/{$row['videos']}.mp4' type='video/webm'>
                    </video >";
            }
            if (empty($videos)) {
                echo "<img id='$vidd' src='pageimages/blank.png' style='position:absolute; top:0%; left:0%;  width:100%; height:100%;'>";
            }
            echo "
            </div> 
            </div> 
            ";
        }
    };
    ?>
</div> <!---smallpagination--->
<script>
  ------ > SHOWDATA
  RETRIEVE
  ID
  SCRIPT
  HERE < -----
</script>
Then re-execute the folling php
----HOW WOULD I GO ABOUT THIS RE_EXECUTION.
<?php
$displayto = $startfrom;
$sql = "SELECT * FROM testdata
WHERE id={$gotid};
";
// check how many results //
$result = $conn->query($sql);
$row_cnt = $result->num_rows;
while ($row = mysqli_fetch_assoc($result)) {
    $videos = $row['videos'];
    $v_id = $row['id']; //<!---important is Video ID and needed for video click selection---->
    $Name = $row['Name'];
    if (empty($Name)) {
        $Name = 'Annonymous';
    }
    $image = $row['image'];
    $info = $row['info'];
    if (empty($info)) {
        $info = 'Contact Listee (if Provided) , No Item Information Given';
    }
    $phone = $row['phone'];
    if (empty($phone)) {
        $phone = 'See Listing';
    }
    $title = $row['title'];
    $locate = $row['locate'];
    if (empty($locate)) {
        $locate = 'Not Provided';
    }
    $postcoded = $row['postcode'];
    if (empty($postcoded)) {
        $postcoded = '???';
    }
    $price = $row['price'];
    if (empty($price)) {
        $price = '?';
    }
    if ($price == '0') {
        $price = '?';
    }
    $date = $row['stamp'];
    if (empty($date)) {
        $date = '';
    }
    $type = $row['type'];
};
echo "<div id='smallpagdata' class='smallpagdata'>
ID={$v_id}<br>
NAME={$Name}<br>
TITLE={$title}<br>
INFO={$info}<br>
PHONE={$phone}<br>
LOCATION={$locate}<br>
PRICE={$price}<br>
Listed={$date}<br> 
</div>";
?>
 
     
    