Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Posts posted by HuggieBear

  1. I think I'd break it down even further.

     

    Take a look at the osCommerce structure attached. It's a bit daunting the first time you look at it, but you're interested in the following tables:

     

    product_options

    product_options_values

    product_options_values_to_product_options

    product_attributes

     

    They're just right of center above the brown languages table.

     

    If you want an example as to what data would go in each table I can probably provide it.

     

    Regards

    Rich

     

     

    [attachment deleted by admin]

  2. This looks like homework, or an assignment.  What do you think each one means?

     

    Check out the link that WolfRage posted and don't just re-post your question because the answer you got wasn't what you wanted!

     

    Also, check the manual for info on language variables

  3. It's not in PHP in the html code in the first code box.  That is strictly HTML.  Unless they just meant to leave out the opening and closing php tags???

     

    You're wrong, when each of those HTML form fields called form[] are passed into PHP, it will see them as items in an array.

     

    Create the following file form_test.php

    <?php
    
    echo '<pre>';
    print_r($_GET['form']);
    echo '</pre>';
    
    ?>

     

    Now call it with a string like this: form_test.php?form[]=string1&form[]=string2&form[]=string3

     

    This is exactly what the string would like like if you were using the GET method in an HTML form.  Something tells me you'll be surprised by the output.

     

    Regards

    Rich

  4. I have about 150 rows that I'm inserting into my database.

     

    Is it better to loop through the data doing a mysql_query() for each insert, or loop through the data creating a sql statement with a single insert.  See below for example:

     

    <?php
    // Multiple inserts in a loop
    foreach ($row as $k => $v){
       $sql = "INSERT INTO table_name VALUES ($row[$k], $row[$k])";
       mysql_query($sql, $db);
    }
    ?>

     

    or

     

    <?php
    // Single insert after creating a string in the loop
    foreach ($row as $k => $v){
       $sql .= "($row[$k], $row[$k]),";
    }
    
    // Remove final comma
    rtrim($sql, ",");
    
    $final_sql = "INSERT INTO table_name VALUES " . $sql;
    mysql_query($sql, $db);
    ?>

     

    Regards

    Rich

  5. 1. I think it's an OK way of doing it, I don't create pages like this using includes for the content but I know lots of people do, so it's got to be fairly popular.

     

    2. If you have mod_rewrite then you can use it to make SEO friendly URL's.

     

    3. You haven't included any pagination code so it's difficult to say why the links for next and previous don't work, but my guess would be that you'll need to use $_SERVER['QUERY_STRING'] or $_SERVER['REQUEST_URI'].

     

    When you request index.php?page=home the value of $_SERVER['QUERY_STRING'] should be set to page=home.

     

    Pagination links should then look at little like this:

     

    $next = 'index.php?' . $SERVER_['QUERY_STRING'] . 'currentpage=' . $page;

     

    Click here to find out more about the $_SERVER global.

     

    Regards

    Rich

  6. OK, lets start off by saying I'm going to call the classified ads 'articles' for the sake of differentiating them from 'ads' that are provided by advertisers (similar to google ads).

     

    If you want to 'crawl' the articles then I'd do it before inserting it into the classified table. Here's what I'd do...

     

    Create a keyword column in classified table to store crawled keywords

     

    [submission of article]

    When article is submitted, crawl for keywords

    Insert article and keywords into classified table

     

    [Retrieval of article]

    User searches for articles

    Recordset returned into php

    Query links table where category IN (comma seperated keywords list from all above articles)

    Loop through recordset to display ads

     

    Regards

    Rich

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