Jump to content

ramjai

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Posts posted by ramjai

  1. hi everybody,

              I want to fetch the maximum value of a field called type from the table named type but i am not getting the result any one can help me.

    Coding

     $type1=pg_query("select max(type) from type where layerid=$lay AND categoryid='$cat3'");
                     $type2=pg_num_rows($type1);
                     $typ=pg_fetch_object($type1); 
                     echo $typ->type;
    

  2. Hai Everybody

    Thanks for ur reply, when i am fetching the values from combo box the related items must be selected in the next combo box then i am having one text field which will generate automatically the value from the comparision of the combo boxes.

    For Example, if i am selecting the value from combo box1 and the combo box2 then the type must be 001. if again i am selecting the value from combo box1 and combo box2 then the text field must have the automated value of 002.

    Can any one help me regarding this.

    Since i am new to PHP i am unable to do it

    With regards,Thanks once again
  3. Thanks for ur reply, when i am fetching the values from combo box the related items must be selected in the next combo box then i am having one text field which will generate automatically the value from the comparision of the combo boxes.

    For Example, if i am selecting the value from combo box1 and the combo box2 then the type must be 001. if again i am selecting the value from combo box1 and combo box2 then the text field must have the automated value of 002.

    Can any one help me regarding this.

    Since i am new to PHP i am unable to do it

    With regards

    Thanks once again
  4. Hi all,

     

    I have three combo boxes, when i select a value in the first combo box, the second combo box should populate automatically and depending upon the second combo box the third should populate automatically.

    But i am getting the following error:

     

    lay[0] = "rawmaterial"; cat[0] = [ "IC"scat[0] = [

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /opt/lampp/htdocs/combo.php on line 30

    ]; , "MOSFET"scat[0] = [

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /opt/lampp/htdocs/combo.php on line 30

    ]; ]; lay[1] = "Semi finished Product"; cat[1] = [];

     

    Choose a layer

     

    Choose a category

     

    Choose a subcategory:

     

    can u rectify my error in the following code..............

     

    <?php

    ?>

    <html>

    <head>

     

    <script language="JavaScript">

    var lay = new Array();

    var cat = new Array();

    var scat = new Array();</script>

    <?php

     

    $con = mysql_connect("localhost","root","jairam") or die('Could not connect');

    mysql_select_db("ERP");

    $makes = mysql_query("SELECT * FROM layer");

    $make_count = 0;

    while($make_row = mysql_fetch_array($makes, MYSQL_ASSOC))

    {

    echo "lay[".$make_count."] = \"".$make_row["layername"]."\";\n";

    $models = mysql_query("SELECT categoryname FROM category WHERE layerid=".$make_row["layerid"]);

    $model_count = 0;

    $num_models = mysql_num_rows($models);

     

    echo "cat[".$make_count."] = [";

    while($model_row = mysql_fetch_array($models, MYSQL_ASSOC))

    {

    echo " \"".$model_row["categoryname"]."\"";

    $bittis = mysql_query("SELECT subcategoryname FROM subcategory WHERE categoryid=".$model_row["categoryid"]);

    $bitti_count=0;

    echo "scat[".$bitti_count."] = [";

    while($bitti_row = mysql_fetch_array($bittis, MYSQL_ASSOC))

    {

    echo "\"".$bitti_row["subcategoryname"]."\"";

    $bitti_count++;

    }

    echo "];\n";

     

    $model_count++;

    if($model_count < $num_models)

    echo ", ";

    }

    echo "];\n";

     

    $make_count++;

    }

     

    mysql_close($con);

    ?>

    <script>

    function populateMakes() {

    var makeSel = document.getElementById("layername");

    makeSel.length = 0;

    for(var i=0; i<lay.length; i++) {

    makeSel.options = new Option(lay, lay);

    }

    }

     

    function doChangeOptions() {

    var modelSel = document.getElementById("categoryname");

    modelSel.length = 0;

    var sel = document.getElementById("layername").selectedIndex;

    alert(sel);

    var currArr = cat[sel];

    alert(currArr);

    for(var i=0; i<currArr.length; i++) {

    modelSel.options = new Option(currArr, currArr);

    }

     

    }

     

    function doChangeOptions1() {

    var bittiSel = document.getElementById("subcategoryname");

    bittiSel.length = 0;

    var sel = document.getElementById("categoryname").selectedIndex;

    alert(sel);

    var currArr = scat[sel];

    alert(currArr);

    for(var i=0; i<currArr.length; i++) {

    bittiSel.options = new Option(currArr, currArr);

    }

     

    }

     

    </script>

    </head>

    <body onload="populateMakes();doChangeOptions();doChangeOptions1();">

    <P>Choose a layer

    <select id="layername" onchange="doChangeOptions()">

     

    </select>

    </p>

    <p>Choose a category

    <select id="categoryname" onchange="doChangeOptions1()">

     

    </select>

    </p>

    <p>Choose a subcategory:

    <select id="subcategoryname">

     

    </select>

    </p>

    </body>

    </html>

     

  5. Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: could not translate host name "localhost,dbname=userlog,user=jeyanthi,password=jairam" to address: Name or service not known in /var/www/logins/abcd_bank/admin.php on line 12

    can't connect

×
×
  • 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.