[HELP] Data from MySQL Database

INTRO

So I’m trying to design a website in which people can store their Fitness Progress in a database and then request the results in a table.

I’m able to login the user, send the results to my database but I can’t seem to get them out of it.

I’m trying to show the results in a table with the use of buttons. There are 2 options: 1. Search by date & 2. Search by muscleGroup (because it’s about fitness). For now I just want the data to show before I start using these options

The table is called: user_data and my database itself is called registration.

The problem I’m having is the following:
When trying to access my data it doesn’t seem to find it . It finds the data of how many rows I get in my database table etc… (I used View Source Code on chrome). but it doesn’t display it in my table.

My page clearly shows all rows and has placed the td’s for the data.

In view source it only shows my actual php code. But I want as result for example instead of $gym[‘nameExercise’], Squat (or whatever other value I have in my database).

This is my code, database, view-source & webpage
(I’m sorry I had to show it like this. But new users can only upload 1 image…)

I’m still kinda new to PHP. So if someone knows how to fix it and is willing to explain to me how it works that would be very helpful.

Thanks in advance :blush:

Either php isn’t installed on your web server or localhost development system or the address you used in your browser was a file system path, instead of a URL. A URL for a localhost system would be like - http://localhost/your_file.php

If your PHP code gets to the database and tells you how many rows are there, it should get the data, too.

Perhaps you should post your display code here. Just the query parts. You need to do this in the following steps. Each should have error handling put into them. Show us some code and we will help you…

Connect to your database using database name, user name and password.
Execute the query for the user so they can have access the their data only.
Execute a FETCH command to fetch the data.
Process the data into the table you want to display.
Display finished product onto the browser.

He is missing the equals in the Php output tag. <? $somvar ?> should be <?= $somvar ?>

Nice catch… Blurred right over that one…

This was one of my problems and I also was stupid enough to forget to ‘echo’ my data lol but thanks for the help everybody problem is solved!

Sponsor our Newsletter | Privacy Policy | Terms of Service