Anmelden | Registrieren | FAQ

Link Problem - Retrieve data from a database

+ Antwort erstellen

3 Beiträge Seite 1 von 1

Link Problem - Retrieve data from a database

von sjwbe » So Jan 17, 2016 5:32 pm

Dear Sir
As I got many help from you thanx for all that.
Sir here is a problem with me on this topic. As you described I created two pages named list.php and person.php and just copied your code and just connected it with my database, everything was ok and my post list came each row as a new link but when I clicked on one of them I just got the error "Notice: Undefined index: id in person.php on line 12"

(my database name is sjweb and table name is dictionary)

my line 12 is "$strSQL = "SELECT * FROM dictionary WHERE id =" . $_GET['id'];" .
if i change the id like "id=1" the error hides but on clicking on each link it shows only the first post only cause of the id=1.

because I am new to php mysql so I am not being able to solve this problem, If you can solve this I'll be very thankful to you sir.

thank you


  • Beiträge: 1
  • Registriert: So Jan 17, 2016 5:15 pm

Re: Link Problem - Retrieve data from a database

von RikTheGuy » Fr Apr 08, 2016 3:09 am

Well, nothing can accurately be said about your problem unless you provide all the code. Anyway, the problem that has occured seems to be pretty common. Your script can't set the get variable 'id'. Make sure that when your user visits this page, his URL is of the form :


  • Beiträge: 1
  • Registriert: Do Apr 07, 2016 3:34 am

Re: Link Problem - Retrieve data from a database

von abidemi_jones » Fr Sep 08, 2017 11:13 pm

Hello Sir,
Thank you for this tutorial of you, it's really been so helpful as you really broke it down into pieces.

However, I am having a little challenge too, in the sense that, in the exercise 20 of the php tutorial of retrieving a single row data from the database, of the Phone Book example, in the person.php file, prompting to this line that says: "$strSQL = "SELECT * FROM people WHERE id=" . $_GET["id"];", at running the script on my server after putting in my own database connection credentials, what the server prompt me in the stead of the result of the single person is: "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\sesame-php-online-tutorial\person.php on line 15" with this IP: "http://localhost/sesame-php-online-tutorial/person.php?id%20=%203".

This "id%20=%203" that serves as the id tells me that there is a space that is passing along the script which I have tried to fix but its not just working.

I will like you to help me base on this sir.

Nice Regards.



  • Beiträge: 1
  • Registriert: Fr Sep 08, 2017 10:36 pm

+ Antwort erstellen

Seite 1 von 1