Jump to content

vinpkl

Members
  • Posts

    448
  • Joined

  • Last visited

Posts posted by vinpkl

  1. Hmm i am not that good with MySql :/

     

    Adding a sorting of some kind would help here, but not sure what to sort them by.

     

    Can You tell me more info about the table structure please?

     

    hi Dathremar

     

    i know how to sort with product_id but i dont know how to sort with product name or keyword entered into search box.

     

    in my table structure i have

    product id

    product name

    price

    image

    description

    shiping

     

    vineet

     

     

  2. Not sure if this is the best way but You could try:

     

    $search_parts = explode(" ", $search_text);
    
    $qry="select * from product_table where ("; 
    $nb_parts = count($search_parts);
    
    for ($i = 0; $i < $nb_parts; $i++)
    {
        $qry .= " ( product_name LIKE '%". $search_parts[$i] ."%') ";
    
        if ($i == $nb_parts-1)
            $qry .= ")";
        else
           $qry .= " OR ";
    }
    

     

     

     

    hi Dathremar

     

    I tried your code. I entered "n97 nokia" in search box and it displayed the result of n97 and nokia both as we needed.

     

    Like if i enter "Nokia n97" or "n97 nokia" then "nokia n97 mobile phones is displayed in the end after all nokia phones.

     

    Is it possible to show the result with "nokia n97" or "n97 nokia" on top.

     

    I mean the product names which contain "n97" should be displayed on top and then other nokia phones should be displayed after "n97".

     

    vineet

  3. hi all

     

    i m working on search form. i have a product name "Nokia n97" in database. I m using the below query to search database and show result

    $qry="select * from product_table where product_name LIKE '%$model%' "; 
    

     

    In this query model is the name of the search box.

     

    The problem is when i type "Nokia n97" in seach box then the result is shown perfectly but when i type "n97 nokia" then no result is found.

     

    what should i write in the query so if both words or any of two words match the "product name" in database the result can be shown.

     

    vineet

  4. so can u tell me why is it not showing even the "MODIFY" button so that i can modify my thread.

     

    Because editing is disabled 10 minutes after post creation.

     

    hi Daniel0

     

    As an administration u have the control of the admin panel. so is it possible for you to delete my thread.

     

    vineet

     

    You're missing the point. Dan is not saying he can't.  He's saying he won't.

     

    hi crayon

     

    i agree with you. it may be against the forum rules to delete the thread.

     

    vineet

  5. You can't. Don't publish things on the internet you don't want to persist forever. That's a kind of golden rule for behavior on the internet.

     

    hi Daniel

     

    i have everytime kept in my mind not to publish my customer website address but i dont know at that time where my mind was.

    so can u tell me why is it not showing even the "MODIFY" button so that i can modify my thread.

    or its now showing modify button because the topic has been marked "solved".

     

    vineet

  6. hi

     

    i have asked a question in php section and that topic was solved. but at that time i didnt noticed that the customer website address writen in that question and now that question has been indexed by msn search engine.

     

    so can u help me delete my thread or question. or tell me where can i find the option to delete the thread.

     

    vineet

  7. hi gingerrobot

     

    i tried your code but got this error

    Parse error: syntax error, unexpected T_IF in E:\xampp\htdocs\gads\products.php on line 102
    

    this i have on 102

    <option value="high" <?php echo (if isset($_POST['choice']) && $_POST['choice']=='high') ? 'selected="selected"' : '';?>>Price high to low</option>
    

     

    vineet

    Edit: Beaten to it, but you should be checking to see if the values have actually been posted, otherwise you might be an undefined index notice.

     

    To have an option selected, you need to set the selected tag to "selected". So, you want something like this:

     

    <form action="" method="post"  name="form1" id="form1" style="margin-bottom:0px;">
    Sort by
    <select name="choice" id="choice">
    <option>select choice</option>
    <option value="high" <?php echo (if isset($_POST['choice']) && $_POST['choice']=='high') ? 'selected="selected"' : '';?>>Price high to low</option>
    <option value="low" <?php echo (if isset($_POST['choice']) && $_POST['choice']=='low') ? 'selected="selected"' : '';?>>Price low to high</option>
    </select>
    <input name="submit" id="submit" type="submit" value="click" />
    </form>
    

     

    If you have lots of options in your select box, it'd be easier to set up an array to loop through.

  8. hi Jibberish

     

    thanks for the reply. it works perfect

     

    vineet

     

    Try chaging it to this.

     

    <form action="" method="post"  name="form1" id="form1" style="margin-bottom:0px;">
    Sort by 
    <select name="choice" id="choice">
    <option>select choice</option>
    <option <?php if($_POST['choice'] == 'high') echo 'selected'; ?> value="high">Price high to low</option>
    <option  <?php if($_POST['choice'] == 'low') echo 'selected'; ?> value="low">Price low to high</option>
    </select>
    <input name="submit" id="submit" type="submit" value="click" />
    </form>	
    

  9. hi all

     

    i m using the form in which i m using <select> tag to display options

    <form action="" method="post"  name="form1" id="form1" style="margin-bottom:0px;">
    Sort by 
    <select name="choice" id="choice">
    <option>select choice</option>
    <option value="high">Price high to low</option>
    <option value="low">Price low to high</option>
    </select>
    <input name="submit" id="submit" type="submit" value="click" />
    </form>	
    

     

    after choosing the option and clicking the submit button i m able to display the results fine.

     

    but the problem is that on clicking the submit button the "selected option" doesnt remain "selected".

     

    how can i make it remain selected untill the user himself changes the option.

     

    vineet

  10. hi andy

     

    thanks. this solutions works perfect for me for my product table.

     

    i have another table in which all id's are messed up like

    23
    27
    28
    34
    35 
    

     

    is there any solution for these kind of situations. how can i make them start again from 1 and make them serial wise.

     

    vineet

  11. hi andy

     

    here is the code i m using

    $pid=$_REQUEST['pid'];
    if(isset($_REQUEST['pid']))
    {
    $qry="delete from product_table where product_id=$pid";
    mysql_query($qry);
    }
    

     

    so according to you i should decrement all higher product id's by 1.

     

    can u give me some syntex example or it wil be something like

    $pid - 1
    

     

     

    vineet

  12. hi all

     

    i have product id like

    1
    2
    3
    4
    5
    

     

    if i delete product no. 5, then the next product will be added at no. 6 not 5.

     

    if i delete product no. 3, then i want that product no.4 should become product no.3 automatically.

     

    how can i update the id so that everytime a product is deleted or added the product id series remain serial wise.

     

    vineet

     

     

  13. hi AP81

     

    Thanks a lot. This works perfect.

     

    vineet

     

    I think the way you're generating the table rows is incorrect.

     

    Try this:

     

    <?php
    $columns_counter=0; 
    $body .= "<table>";
    while($row_p = mysql_fetch_array($result_p))
    {
    if ($columns_counter == 0) {
       $body .= "<tr>"; 
    }
    $body .= "<td width=140 align=center height=137>" ."<img style='border:2px solid #a2a2a2' alt='mobile phones' src='http://domain/graphics/thumbs/" . $row_p['prod_thumb'] . "'/></td>
    <td width='235'>".$row_p['product_name'] ."</td>";
    
    $columns_counter++; 
    if($columns_counter==2){
    $body .= "</tr>"; 
    $columns_counter=0;
    } 
    }
    ?>
    

  14. hi all

     

    i have html emailer which displays perfect in yahoo, hotmail, rediff.

     

    but i dont know what is happening in gmail. after 4th product, the rows and columns get distort.

     

    i have attached screen shots of yahoo and gmail to make my problem more clear.

     

    vineet

     

    $body="
    <html>
    <head>
    <link rel='stylesheet' type='text/css' href='http://domain/includes/stylese.css' />
    </head>
    <body>
    <table width='700' border='0'  align='center' cellspacing='0' cellpadding='0' style='border:4px solid #A1B22D'>
    <tr>
    <td bgcolor='#FFFEBE'>";
         
    $columns_counter=0; 
    $body .= "<table>";
    $body .= "<tr>"; 
    while($row_p = mysql_fetch_array($result_p))
    {
    $body .= "<td width=140 align=center height=137>" ."<img style='border:2px solid #a2a2a2' alt='mobile phones' src='http://domain/graphics/thumbs/" . $row_p['prod_thumb'] . "'/></td>
    <td width='235'>".$row_p['product_name'] ."</td>";
    
    $columns_counter++; 
    if($columns_counter==2){
    $body .= "</tr>"; 
    $columns_counter=0;
    } 
    }
    $body .=  "</table>
    </td>
    </tr>
    </table>
    </body>
    </html>";
    

     

     

     

    [attachment deleted by admin]

  15. hi all

     

    i have 50 products and want to show 4 at a time and shuffle them on manual refresh.

     

    like serial 1 to 4 , then serial 4 to 8, then serial 8 to 12, then 12 to 16.

     

    i have used rand() function and it displays results by its own. not serial wise.

     

    how is it possible. this is my code

     

    <?php 
    echo "<table>";
    echo "<tr>";
    $qry1="select * from product_table where category_id=1 and status='Y' ORDER BY RAND() LIMIT 0,4";  
    $result1 = mysql_query($qry1);  
            
       if(mysql_num_rows($result1)>0)
       {
       while($row1=mysql_fetch_array($result1))
       {
         echo "<td width=148 valign=top>";
          echo "<table>";
          echo "<tr>";
          echo "<td valign=top  width=125>". $row1['product_name'] . "</td>";
          echo "</tr>";
          echo "<tr>";
          echo "<td valign=top>". $row1['description'] . "</td>";
          echo "</tr>";
          echo "<tr>";
          echo "<td valign=top class=cut>". "NZ$ " . $row1['cutout_price'] . "</td>";
          echo "</tr>";
          echo "<tr>";
          echo "<td valign=top class=price>". "NZ$ " .  $row1['price'] . "</td>";
          echo "</tr>";
      echo "</table>";
    echo "</td>";
       }
         }
    echo "</tr>";
    
    
    echo "</table>"; 
    ?>
    

     

    vineet

  16. Use gmdate() instead...

     

    
    <?php
    
    $product_date = gmdate ( 'Y/m/d' );
    
    ?>
    
    

     

    hi printf

     

    i used the gmdate() but still getting the one day old date.

     

    i would like to ask that my website is running in new zealand  but at present i m in india and if i insert any product from india then the date inserted in database will be according to india or newzealand.

     

    actually the website is to run only in newzealand so i need to have the date as of present date of newzealand.

     

    vineet

  17. hi all

     

    my website is running in new zealand and hosting is also in newzealand.

     

    To insert the date i m using

    <?php
    $product_date=date("Y/m/d");
    ?>
    

     

    So as result the date that gets inserted in database is of one day earlier.

     

    like at present its 11feb in newzealand and the date that gets inserted in the database is 10feb.

     

    how can i get the current date of newzealand in my database.

     

    vineet

  18. as u said it will not be noticeable then i can use full path.

     

    Consider this: Your name is Google. You serve millions of pages every day. Now imagine that you started to use the full URL instead of just the path on all links, images, etc. The size difference could easily amount of several terabytes per month.

     

    The unnoticeableness only applies to a single request taken out of context.

     

    hi daniel

     

    i keep this in mind.

     

    but will have to use the full path till i get any alternative.

     

    also my website will be for the limited one country. we cannot compete with google.

     

    vineet

  19. hi all

     

    i m using htaccess to rewrite my urls.

     

    so i have to use the full path in all my images & scripts like

    http://www.domain.com/images/logo.gif
    

     

    i would like to know that if in my page i write everytime the full path for all the images then will my page take much time to load

     

    vineet

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