Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7926317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:44:14+00:00 2026-06-03T18:44:14+00:00

I am using Dreamweaver and MAMP to create a site. I have a table

  • 0

I am using Dreamweaver and MAMP to create a site. I have a table called posts inside I have two columns, postid, and userid. I’m putting all the posts on a page and I want to show which user posted which post, and write that on each post respectively. For example the first post that should show up has a postid of 2 and a userid of 1.
Currently it is displaying the userid of the user who is logged in on all the posts, I am using:

mysql_select_db($database_akaearthdb, $akaearthdb);
$query_PostsUserid = "SELECT userid FROM posts WHERE posts.userid ORDER BY posts.postid";
$row_PostsUserid = mysql_fetch_assoc($PostsUserid);

and

echo $row_PostsUserid['userid']

To display it. I want $row_PostsUserid[‘userid’] to be the userid of the person who posted it.

Let me know if you need any more information, I’m new to the language so sorry if I’m doing everything wrong, TIA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:44:15+00:00Added an answer on June 3, 2026 at 6:44 pm

    Before executing a query from any language,

    Test the query on your local database command line.

    Your query,

    "SELECT userid FROM posts WHERE posts.userid ORDER BY posts.postid"
    

    will result in a syntax error.

    EDIT:

    Do the following,

    CREATE TABLE users (
             id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
             user_name VARCHAR(255),
             age INT,
             any_detail VARCHAR(255)
           );
    
    CREATE TABLE posts (
             id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
             post TEXT,
             created_at TIMESTAMP(8),
             user_id INT,
             FOREIGN KEY (user_id) REFERENCES users(id)
           );
    

    Now,

    To display the posts,

    Array =  SELECT * FROM posts ORDER BY created_at DESC;
    

    Store the result from the above query into your languages array/variable. Im a rails developer, Im not sure about PHP’s syntax.(Google it and find out!)

    After storing the results into an array,

    Display the following for each element in the array as follows,

    Post content:
    << Array.post >>
    Written about:
    << Array.created_at >> ago
    Written by:
    << SELECT user_name FROM users WHERE user_id = Array.user_id >>

    That should help or take you somewhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using Dreamweaver for my web development and would like to try
I'm using Dreamweaver to publish my website to the web server. I have a
I am having a problem putting a java applet on a website using Dreamweaver
I am using Dreamweaver to make a HTML page. I have a textbox for
I'm trying to make a website using Dreamweaver. I'd like to have a page
I am building a Wordpress website in Dreamweaver CS5 and am also using MAMP
setup Using Dreamweaver CS 5.5 / Windows 7 I have turned off 'Preview [in
I have been using Dreamweaver to build several sites. In particular, I utilize its
I am using Dreamweaver CS6 and I have attached the code below. I updated
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.