小编Csa*_*aaa的帖子

违反完整性约束:如何连接两个表

我正在为 laravel 的一个学校项目制作一个程序,所以我尝试加入两个表:产品和目的地

表 Product 有以下列:id、name

Destinations 表包含以下列:Destinations:id,product_id,destination,quantity,target_person

我需要加入product_idid

products = DB::table('products')
    ->leftJoin('destinations','id','=','destinations.product_id ')
    ->get();
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用时LEFT JOIN,出现以下错误:

SQLSTATE[23000]:违反完整性约束:1052 on 子句中的列 'id' 不明确(SQL:select * from productsinner join destinationson id= destinations. product_id

php mysql join

5
推荐指数
1
解决办法
757
查看次数

我想我拼错了一个道具,但我不确定

所以基本上,我尝试在我的项目中实现 React Hooks,但它给了我这个错误。也许我是盲人,看不到问题所在,我想我拼错了一些东西。但也许我传递了错误的道具,我现在有点困惑。

这是我的标志是组件:

   const SignIn = ({ emailSignInStart, googleSignInStart }) => {
  const [userCredentials, setCredentials] = useState({
    email: '',
    passowrd: ''
  });
  const { email, password } = userCredentials;

  const handleSubmit = async e => {
    e.preventDefault();

    emailSignInStart(email, password);
  };

  const handleChange = e => {
    const { value, name } = e.target;
    setCredentials({ ...userCredentials, [name]: value });
  };

  return (
    <div className='sign-in'>
      <h2>I already have an account</h2>
      <span>Sign in with your email and passowrd</span>

      <form onSubmit={handleSubmit}>
        <FormInput
          name='email' …
Run Code Online (Sandbox Code Playgroud)

reactjs react-hooks

-1
推荐指数
1
解决办法
39
查看次数

标签 统计

join ×1

mysql ×1

php ×1

react-hooks ×1

reactjs ×1