unique job page

Discussion in 'PHP' started by ianhaney, Nov 25, 2013.

  1. #1
    Hi

    Sorry to post again

    I have solved all the other issues I think on my admin page but got this one that am stuck on

    What should happen is a user clicks on a job and displays on a page of its own, it is getting the jobs from the database

    What is happening is on the job.php page I get this error

    Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Designer ORDER BY id desc LIMIT 1' at line 1

    Not sure on how to fix it really, I did look round on Google etc

    In the address bar it comes up with job.php?id=Web%20Designer

    So I think it is sort of working

    I have added a pastebin link below with the coding from the job.php page if it helps

    http://pastebin.com/P7KaD0pG

    Thank you in advance

    Ian
     
    ianhaney, Nov 25, 2013 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    echo out the query, and see how it looks, and test it in PHPMyAdmin or similar. I'm not sure, since I don't know your DB-structure, but it seems it might be getting a wrong value in the id="whatever" bit.
     
    PoPSiCLe, Nov 25, 2013 IP
  3. MakZF

    MakZF Well-Known Member

    Messages:
    390
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    140
    #3
    What PoPSiCLe said. Also your input data is not sanitized properly; you should use prepared statements, and in this case cast the $_GET['id'] to an integer.
     
    MakZF, Nov 25, 2013 IP