Jump to content

maxves1

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Posts posted by maxves1

  1. hello,

    I have made a drop down menu that fetches results from database, you can see it here:

    http://faculty.poly.edu/~yjeanpie/searchcat.php

     

    and I have attached the products database print screen with this  topic

    The problem I am facing is, I dont kust want to display the selected results but alongwith the selected stuff, say( software : photoshop ) I want it to display the other stuff in the database that is related to the selected stuff, like if i select category software and product as phooshop, i want to display tutorials associated with photoshop, with images associated and other data, i have written the queries for that in mysql, but i dk why it still doesnt retrieve other things, i even tried print_r option, but it displays only the selected stuff and not other queries from database, i have given the drop down form name f1, and even tried $_REQUEST['f1'] and $_GET, $_POST, and even tried foreach loop, but nothing ever works, so I was wondering if its the database fault, or is there some way out of this issue?

    Any help would be appreciated, i cant advance with my project without fixing this problem

    thx

     

     

    [attachment deleted by admin]

  2. hello, I have my php dynamic drop down menu at :

    http://faculty.poly.edu/~yjeanpie/searchcat.php

     

    As you can see, when you select a category and product, it displays the selected stuff on the other page, but that is not exactly what i wanna do, I want it to retrieve all other attributes related to the selection, from the database,

    suppose I have selected software and photoshop ( from my PRODUCTS table in database) I want it to display those plus all other attributes related to photoshop say  tutorial links, id ,description ,etc, see the following for a brief idea:

    http://faculty.poly.edu/~yjeanpie/generalinfo.php

     

    so i need all those attributes to be pulled from database as soon as i select these 2 things from drop down,

    i used the following print_r command on the results page, but its not working, can anyone help me fix it or rewrite it?>

     

     

     

    <?php

     

     

    print_r($_POST);

     

    ?>

     

    <?php

    require("db_connect.php");

     

    /*$query = mysql_query("SELECT * FROM products NATURAL JOIN category WHERE prod_name='".$_POST['subcat']."'");

    echo '<pre>';

    print_r($row = mysql_fetch_assoc($query));

    //echo .$row['prod_info'].;

    echo '</pre>';

    */

    print_r($_SESSION);

    //while ($row = mysql_fetch_assoc($query)) {

    foreach ($row as $col=>$val) {

    if (!empty($val)) {

    echo 'col: '.$col.' val: '.$val.'<br />';

    }

    }

    echo '<br />';

    //}

     

    ?>

     

     

    </body>

    </html>

     

     

     

  3. this is the code so far :

    <?php

    session_start();  // SESSION STARTED

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

     

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

     

    <head>

     

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

     

    <style type="text/css">

    <!--

    .style1 {

    font-family: Arial, Helvetica, sans-serif;

    font-weight: bold;

    }

    .style3 {font-family: Arial, Helvetica, sans-serif}

    -->

    </style>

    <SCRIPT TYPE="text/javascript">

    <!--

    function popup(mylink, windowname)

    {

    if (! window.focus)return true;

    var href;

    if (typeof(mylink) == 'string')

      href=mylink;

    else

      href=mylink.href;

    window.open(href, windowname, 'width=400,height=200,scrollbars=yes');

    return false;

    }

    //-->

    </SCRIPT>

     

    <script type="text/javascript">

    <!--//

    function changePage(number){

    var firstNumber = 001;

    var lastNumber = 999;

    var content = document.getElementById('content');

    var oldNumber = content.src.match(/(\d+)(?=\.)/);

    var newNumber = RegExp.$1*1+number;

     

    if(newNumber < firstNumber){ newNumber = lastNumber };

    if(newNumber > lastNumber) { newNumber = firstNumber }; 

    content.src = content.src.replace(/(\d+)(?=\.)/,newNumber);

    document.getElementById('test').innerHTML = content.src;

     

    }

    //-->

    </script>

     

    <title>FITL Search Page</title></head>

    <BODY>

    <!-- wrap starts here -->

     

     

     

    <br>

    <center>

    <br>

    <hr align="center" size="1" width="550" color=#"99CCFF">

    <hr align="center" size="1" width="550" color=#"99CCFF">

    <?php

    $ids=$_SESSION['id'];  // USER ID

     

    echo "<font size = 4 <b>All Products   </b></font>".$ids."<br>";

    ?>

    <hr align="center" size="1" width="550" color=#"99CCFF">

    <br>

    <table align='center' height="251">

    <tr align='center'><td height="27">

     

     

    </td></tr>

     

    <tr><td height="121">

    <table width="688" border=0 style="border-collapse: collapse" cellpadding="20" cellspacing="20">

    <tr><td width="509">

    <h3>Search Results</h3>

    <table valign="top" scope="row">

    <tr><td>

      <table width="549" height="239" border="0">

    <tbody>

              <tr>

                <td width="121"><table width="118" border="1" cellpadding="0" cellspacing="0" align="left" valign="top">

                  <tr>

                    <td align="center"><a href="" STYLE="text-decoration:none"><font color="#99CCFF"> Show All </font></a>

                    <br /><br />

                    <a href="" STYLE="text-decoration:none"><font color="#99CCFF">Category</font></a>

                    <br /><br />

                    <a href="" STYLE="text-decoration:none"><font color="#99CCFF">Sub-Category</font></a></td>

                  </tr>

               

                </table> 

    </td><td>

    <?php

     

    include ('db_connect.php');  // DATABASE CONNECTION

     

    {             

    $keyword=$_REQUEST['T1'];

                    if($keyword=="")

                      {

     

                     

                        header( 'location:http://faculty.poly.edu/~yjeanpie/search.html');

                  exit();

                       

                      }

     

    $sql="select * from PRODUCTS NATURAL JOIN category NATURAL JOIN SUB_CATEGORIES where PRODUCTS.prod_name like '$keyword%'";

    $result=mysql_query($sql);

    $rowcount=mysql_num_rows($result);

    if($rowcount<1)

    {

    echo "Search Results not Found";

    exit();

    }

    else

    {

    ?>

    <BR><BR>

    <form enctype="multipart/form-data" action="allproducts.php" method="POST">

     

    <table border = 2  cellspacing="0" cellpadding="0" align="right" valign="top">

    <tr><th>Image</th><th>Category</th><th>Sub-Category</th><th>Product Name</th><th>Version</th></tr>

    <?php

    while($mem=mysql_fetch_array($result)) 

    {

    $number1=$mem['category'];

    $number=$mem['prod_name'];

    $number3=$mem['sub_category_name'];

    $number5=$mem['prod_model_version'];

    $number2=$mem['img'];

     

    ?>

    <tr>

                                    <td> <?php

    $sql3="select img from PRODUCTS where img='$number2'";

     

    $result3=mysql_query($sql3);

    $rowcount3=mysql_num_rows($result3);

    if($rowcount3<1)

    {

    $rate='Not found';

    }

    else

    {

                        while($row3=mysql_fetch_array($result3))

    {

    $rate=$row3[0];

    if (!empty($row3[0]))

      {

        // Output the MIME header

        header("Content-Type:image/jpeg");

        // Output the image

        echo $row3[0];

      }

     

    }

    }

    ?>

            <?php

    if($rate!=null)

    //header("Content-type: image/jpeg");

        echo '<a href="generalinfo.php"><img src="'.$rate.'"></a>';

    else

    echo " ";

    ?>

    </td> <td>

    <?php

    $sql3="select category from category NATURAL JOIN PRODUCTS where category='$number1' and PRODUCTS.cat_id=category.cat_id";

    $result3=mysql_query($sql3);

    $rowcount3=mysql_num_rows($result3);

    if($rowcount3<1)

    {

    $rate="Not found";

    }

    else

    {

                        while($row3=mysql_fetch_array($result3))

    {

    $rate=$row3[0];

    }

    }

    ?>

            <?php

    if($rate!=null)

    echo '<center>'.$rate.'</center>';

    else

    echo "Available";

    ?></td><td>

    <?php

    $sql3="select sub_category_name from SUB_CATEGORIES NATURAL JOIN PRODUCTS where sub_category_name='$number3' and PRODUCTS.sub_category_id=SUB_CATEGORIES.sub_category_id";

    $result3=mysql_query($sql3);

    $rowcount3=mysql_num_rows($result3);

    if($rowcount3<1)

    {

    $rate="Not found";

    }

    else

    {

                        while($row3=mysql_fetch_array($result3))

    {

    $rate=$row3[0];

    }

    }

    ?>

            <?php

    if($rate!=null)

    echo '<center>'.$rate.'</center>';

    else

    echo " ";

    ?></td><td>

            <?php

    $sql3="select  prod_name from PRODUCTS where prod_name='$number'";

    $result3=mysql_query($sql3);

    $rowcount3=mysql_num_rows($result3);

    if($rowcount3<1)

    {

    $rate="Not found";

    }

    else

    {

                        while($row3=mysql_fetch_array($result3))

    {

    $rate=$row3[0];

    }

    }

    ?>

            <?php

    if($rate!=null)

    echo '<center><a href="generalinfo.php">'.$rate.'</a></center>';

    else

    echo " ";

    ?></td>

     

                                      <td>

                                          <?php

    $sql3="select  prod_model_version from PRODUCTS where prod_model_version='$number5'";

    $result3=mysql_query($sql3);

    $rowcount3=mysql_num_rows($result3);

    if($rowcount3<1)

    {

    $rate="Not found";

    }

    else

    {

                        while($row3=mysql_fetch_array($result3))

    {

    $rate=$row3[0];

    }

    }

    ?>

    <?php

    if($rate!=null)

    echo "<center>".$rate."</center>";

    else

    echo " ";

    ?>

    </td></tr>

    <?php

    }

    ?>

    </table>

    </form>

    <?php

    }

     

    }

    ?></td><td>

    </td>

    </td>

    <td width="169" style='margin-bottom:90px;>

     

     

    </td>

    </tr>

    </table>

    </td></tr>

    </table>

    </td>

    </table>

    </center>

     

     

    </body>

     

    </html>

    the first loop is for the images , i have used "img" for that, but still it is not working, I dont know what to do to get it working,

    you can see the demo at:

    http://faculty.poly.edu/~yjeanpie/search.html

    put in "a" in the searchbox and you will see the output, (same code) , but without images , i wonder how to fix this, any help would be appreciated

  4. Hello ,

    Can anyone help me with displaying results of my php onto another page?

    Heres the code I wrote for search category and it works fine :

    <?php

     

    include ('db_connect.php');  // DATABASE CONNECTION

    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>

    <head>

    <META http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta http-equiv="refresh" content="180; url=http://faculty.poly.edu/~yjeanpie/searchcat.php">

     

    <SCRIPT language=JavaScript>

    function reload(form)

    {

    var val=form.cat.options[form.cat.options.selectedIndex].value;

    self.location='searchcat.php?cat=' + val ;

     

    }

     

    </script>

    <script Language="JavaScript">

    <!--

    function confirm_dropdown()

    {

     

    if (f1.cat.options.selectedIndex == 0)

    {

     

    alert("Please select the Category.");

     

    f1.cat.focus();

    return (false);

    }

     

    if (f1.subcat.options.selectedIndex == 0)

    {

     

    alert("Please select the Products.");

     

    f1.subcat.focus();

    return (false);

    }

    return (true);

    }

    //--></script>

    <script language=" JavaScript" ><!--

    function MyReload()

    {

    window.location.reload();

    }

    //--></script>

     

    </head>

    <body onLoad=" MyReload()">

     

    <center>

      <p> </p>

        <p> </p>

            <p> </p>

    <div><center>

     

     

    <hr align="center" size="1" width="550" color="#99CCFF">

      <hr align="center" size="1" width="550" color="#99CCFF">

      <p><img src="fitl reslogo.jpg" width="223" height="67"></p>

      <p><font face="Arial, Helvetica, sans-serif" size="2" align="Left">Search by Category</font></p>

     

     

    <div align="center">

    <?

     

     

    @$cat=$_GET['cat'];

    if(strlen($cat) > 0 and !is_numeric($cat)){

    echo "Data Error";

    exit;

    }

     

    $quer2=mysql_query("SELECT DISTINCT category,cat_id FROM category order by category");

     

    if(isset($cat) and strlen($cat) > 0){

    $quer=mysql_query("SELECT DISTINCT prod_name FROM PRODUCTS where cat_id=$cat order by prod_name");

    }

     

    echo '<form method=post name=f1 action="dd-check1.php" onsubmit="return confirm_dropdown()">';

     

    echo "<select name='cat' onchange=\"reload(this.form)\"><option value='' style= width:13em;>Select category</option>";

    while($noticia2 = mysql_fetch_array($quer2)) {

    if($noticia2['cat_id']==@$cat){echo "<option selected value='$noticia2[cat_id]'>$noticia2[category]</option>"."<BR>";}

    else{echo  "<option value='$noticia2[cat_id]'>$noticia2[category]</option>";}

    }

    echo "</select>";

    echo "<br>";

    echo "<br>";

    echo "<select name='subcat' style= width:15em;><option value=''>Select products</option>";

    while($noticia = mysql_fetch_array($quer)) {

    echo  "<option value='$noticia[prod_name]'>$noticia[prod_name]</option>";

     

    }

    echo "</select>";

    echo "<br>";

    echo "<br>";

     

    echo '<input type=image src="back.jpg" srcname=btnback id=btnback  onclick="history.go(-1);return false;"/>';

    echo '<span style="padding-left:10px">';

    echo '<input type=image src="button.JPG" >';

     

    echo '</span>';

     

    echo "</form>";

    ?>

     

     

    </div></center>

      <br>

      <hr align="center" size="1" width="550" color="#99CCFF">

      <hr align="center" size="1" width="550" color="#99CCFF">

    </div></center>

     

    </div> </center>

    </body></html>

     

    Now I saved this file onto my database as searchcat.php

    you can check the link at:

    http://faculty.poly.edu/~yjeanpie/searchcat.php

     

    only problem is upon submission ,I want it to display results onto a new page "dd-check1" in this case, in such a way, that it displays the category and product selected and along with it, it displays relevant information related with the specific product for the category selected,

    like say for example

    "if i select software and photoshop "

    I want it to show that on the other page along with the tutorial links i have in database and other relevant info "

    My databse PRODUCTS looks like the file attached ( from where i want to retrieve other relevant results"

    PLEASE HELP ME ASAP , i need to get this done within 2 weeks :(

    any help will be honestly appreciated

     

    [attachment deleted by admin]

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