MySQL Forums
Forum List  »  PHP

Re: continue with link to other page
Posted by: Jonathan Stephens
Date: October 24, 2014 04:42AM

PHP thinks you're using the string 'id' whereas you need it to be a variable. You need something like

$sql = "SELECT ID,NAAM,CONTACT FROM table WHERE ID = " . $_GET['id'];

Note there is no comma following the name of last column listed in the SELECT. In addition, you don't need to use backticks with table or column names in SQL statements unless they contain special characters.

Also, you should make sure that you always use the same lettercase for your table columns as you did in the CREATE TABLE statement that created the table. If your table column is named id, then trying to reference the column as ID or Id is not going to work. The usual convention is to use lowercase for table and column names, but it doesn't really matter as long as you're consistent about it and you use exactly the same lettercase for these in your queries.

Good luck!

Jon Stephens
MySQL Documentation Team @ Oracle

MySQL Dev Zone
MySQL Server Documentation
Oracle

Options: ReplyQuote


Subject
Written By
Posted
Re: continue with link to other page
October 24, 2014 04:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.