Vercel says to paste this code into my main page, BUT, I don’t have a Cart, its “Home”
Unanswered
Beveren posted this in #help-forum
BeverenOP
Where do i put it?
I don’t have a Cart, I have a “posts_table”
I don’t have a Cart, I have a “posts_table”
import { sql } from "@vercel/postgres";
export default async function Cart({
params
} : {
params: { user: string }
}): Promise<JSX.Element> {
const { rows } = await sql`SELECT * from CARTS where user_id=${params.user}`;
return (
<div>
{rows.map((row) => (
<div key={row.id}>
{row.id} - {row.quantity}
</div>
))}
</div>
);
}7 Replies
That is for your tutorial. you should see where it uses
personally I kinda hate this because this is not showing you to use validation or others but this is a simple showing of how to run a query.
sql`SELECT * from CARTS where user_id=${params.user}`;personally I kinda hate this because this is not showing you to use validation or others but this is a simple showing of how to run a query.
BeverenOP
Ok 👍, I don’t have a Cart, i have a”profiles” and “items” for tables
So you would just change SQL string to reflect that
BeverenOP
Ok, i did, and it still says table not found
Interesting, did you do the setup to the correct DB schema?
BeverenOP
Yes 👍
What tutorial would you recommend that could be better?