Skip to content

Incorrect query #49

@AlaaTaima

Description

@AlaaTaima

const addPosts = (data) => connection.query('INSERT INTO posts (post_title,user_id,post_content,post_img) values ($1, $2, $3, $4) returning *', [data.post_title, '1', data.post_content, data.post_img]); // Till we complete our website the user_is should be 1

You used this query in a wrong way to add a new post and I see you didn't add a condition that connect two tables (users and posts) correctly and instead you add some data as a hard code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions