hello,

i have a dropdown list of several values, now i am successfully created a script in which data is display from database by selecting a value from drop down i.e a post value thrown by select a value from drop down. My question is how to display data for mutiple values on same page i.e for id-1 data is display in first <div>, for id-2 data is display in another <div>. All Data retrieve from single table.

You need to write javascript function, which will be called when item is selected in dropdown.
That function will add value/text to DIVs

This is my code to get value from another table:

foreach ($all as $value) {
    echo $value . '<br />';
    $install = mysqli_query($conp, "SELECT COUNT(*) from `install` where `package_name` = '{$value}';");
    $row = mysqli_fetch_assoc($install);
    var_dump($row);
}

on echoing $value it shows specific value, but in query condition it doesnt gave any value and output 0 in var_dump. Also, if i have 10 values in $value it shows when echo but doesnt shows in query!! any help

post code of both pages here

<?php

    if(isset($_POST['submit']) & !empty($_POST['appid'])) {

    $app = mysql_real_escape_string($_POST['appid']);

    //establish a connection
    include('/var/config.php');

    //database parameters

    $conp = mysqli_connect($hostname, $user, $password, $database) or die('error in connection' . mysqli_error());



    //actual data for appid's

    $appsi = mysqli_query($conp, "SELECT distinct package_name FROM `user_app` where `app_id` = '$app'");

    $all = array();

    while($row = mysqli_fetch_assoc($appsi)) {

    $all[] =  '<br />' . $row["package_name"] . ' :' . $data;

}


foreach ($all as $value) {


    $query = "SELECT COUNT(*) AS 'installs' from `install` where package_name like '%" . $value ."%' ";
    $install = mysqli_query($conp, $query);
    $row = mysqli_fetch_assoc($install);
    //var_dump($row);
    $data =  '<br>' . $row['installs'];
var_dump($data);
}


//total pn

    $total = mysqli_query($conp, "SELECT COUNT(distinct package_name) FROM `user_app` where `app_id` = '$app'");

    $row = mysqli_fetch_assoc($total);

    $name =  '<br />'. 'Total Packages in ' . '<b>' ."$app". '</b>'. ' : '. $row["COUNT(distinct package_name)"];

mysqli_close($conp);

}


?>


<form name="query" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">




<p>Enter Application-Specific Id: <select name="appid">


            <option value="-">-</option>
            <option value="10000">10000</option>
            <option value="31100">31100</option>
            <option value="31101">31101</option>
            <option value="31102">31102</option>
            <option value="31103">31103</option>
            <option value="31104">31104</option>
            <option value="31105">31105</option>
            <option value="31106">31106</option>
            <option value="31107">31107</option>
            <option value="31108">31108</option>
            <option value="31109">31109</option>
            <option value="31111">31111</option>
            <option value="31112">31112</option>
            <option value="31113">31113</option>
            <option value="31114">31114</option>
            <option value="31115">31115</option>
            <option value="31116">31116</option>
            <option value="31117">31117</option>
            <option value="31118">31118</option>
        </select>
    </p> 

    <p><input type="submit" name="submit" value="Go" /></p>

    </form>

    <div>

        <p><?php echo '<br />' .'<b>'. 'Application Id : '. $app . '</b>'; ?> </p>
        <p><?php echo implode("<br>", $all); ?></p>
        <p><?php echo "$name"; ?></p>

    </div>

i have defferent method where i used $key to upload multiable images into one folder but whats happening is my sql not accepting with not Null, because i need those images name inside these one PackageGraphic field

and that's the code:

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO packages (idd, packageTitle, packageDescription, packageGraphic) VALUES (%s, %s, %s, %s)",
                       GetSQLValueString($_SESSION['MM_adminId'], "text"),
                       GetSQLValueString($_POST['packageTitle'], "text"),
                       GetSQLValueString($_POST['packageDescription'], "text"),
                       GetSQLValueString($_FILES['packageGraphic']['name'], "text"));

please help in how to upload multiable images inside this one value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.