MySQL Forums
Forum List  »  PHP

Re: cross join check syntax please
Posted by: Peter Brawley
Date: April 26, 2022 06:31AM

> if mygallery.custid != subscribe.custid record should not be added

There is no INSERT...JOIN syntax.

To avoid adding rows for which there is no matching key value in another table, before doing the insert check that the relevant column value of each row to be inserted has a matching subscribe row.

> no error messages

For error reporting (which is missing from your code), you need something like ...

$sql = "insert into ...";
$res = mysqli_query( $conn, $sql );
if( !$res ) echo mysqli_error( $conn );

... and to ensure that such errors are reported, you need to define mygallery.custid as a foreign key which references subscribe.custid.

Options: ReplyQuote


Subject
Written By
Posted
Re: cross join check syntax please
April 26, 2022 06:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.