Jump to content

Getting Data from MySQL Row in the database, and displaying on web page


echoindia756

Recommended Posts

Hi there,

 

I'm having a bit of trouble getting something to work. Basically, I have several fields in a table:

 

"Item Name" and "Item Price"

 

These values are dynamic to each user (so different items will appear depending on your username),

I want to retrieve this information from the database row and put it into a HTML table on the users homepage on my website

 

So for example the data would appear like this:

 

Item Name              Item Price 

Digital Camera            €40.00

Underwater Camera      €50.00

 

So I think the mysql query would be something like:

 

mysql_query("SELECT * FROM table_name WHERE user_id = $_SESSION['user_id']");

 

But i'm not sure how to get all the users items to display on the table, could someone help me with the PHP code please?

I'd really appreciate it!

 

Thanks in advance!

Link to comment
Share on other sites

Hi thanks for that!

I think I almost got it working, the problem I am having now is that if there is more than one row in the table, it only displays one of the rows on the html table, is there anyway to display all of the rows that are in the table?

 

Many thanks for your help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.