Shareasale feed Product page problem

Discussion in 'MySQL' started by sebastya, Jan 19, 2009.

  1. #1
    Hey guys,

    I managed to make a product page for my feed.

    When people clicked a product it would go to


    And on the product.php page it would be mySQL programmed to show

    This worked perfectly. But when I downloaded the php files and database and reuploaded it onto another site, it didn't work! Even though everything else did..

    What could be the problem? I know this is a strange thing to happen but I have tried a lot of things and nothing seems to make it work again...
     
    sebastya, Jan 19, 2009 IP
  2. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I am not familiair with php but I remember that it has something like a MAGIC_QUOTES setting which assumes it can escape special characters in your input without knowing what special characters are used in your output but fucking up your data anyway hence no output from your query. Seems they also changed the default in newer versions sometime they get smarter.
    It could be that this setting changed from your first to your second server.
     
    chisara, Jan 20, 2009 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Can you post the code where the $id variable is set?

    It should look like:

    $id = $_GET['id'];

    or something similar.
     
    jestep, Jan 20, 2009 IP
  4. sebastya

    sebastya Well-Known Member

    Messages:
    2,449
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    138
    #4
    while ($row = mysql_fetch_array($result))
    {
    $field1= $row["Link"];
    $field2= $row["Price"];
    $field3= $row["Thumbnail"];
    $field4= $row["Category"];
    $field5= $row["Name"];
    $field6= $row["ProductID"];
    
    echo "<a href=product.php?id=$field6>$field5</a><br>";
    Code (markup):
    so when they click it would go to my product.php page which has this snippet of code in it:
    
    $query = "SELECT * FROM table WHERE ProductID='$id' $limit";
    $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
    Code (markup):
     
    sebastya, Jan 20, 2009 IP
  5. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What type of data is you ID column ?
     
    chisara, Jan 22, 2009 IP
  6. sebastya

    sebastya Well-Known Member

    Messages:
    2,449
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    138
    #6
    a string numbers e.g. 465739201
     
    sebastya, Jan 22, 2009 IP
  7. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    What happens when you hard code $limit to 1 and what is the response when you perform the query directly in the Mysql database server ?
     
    chisara, Jan 23, 2009 IP