cearlp Posted October 14, 2021 Share Posted October 14, 2021 Two identical php programs doing a mysqli_query, but on different databases. One succeeds and the other fails. The one that fails returns no errno. Could the cause be the databases? If so, what could be the problem? They are real similar in construction, one has more fields than the other, but almost the same data in both. $conn = use, passwd, database $sql = insert into members (name,addr,city,state) values('Joe','123 St','Somecity','CA') $result = mysqli_query($conn, $sql) or die (Can't run query because " . mysql_errno()); Quote Link to comment Share on other sites More sharing options...
Barand Posted October 14, 2021 Share Posted October 14, 2021 42 minutes ago, cearlp said: Could the cause be the databases? More likely the coder. mysql_errno() does not exist. It should be mysqli_errno($conn) Try turning error reporting on occasionally. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted October 14, 2021 Share Posted October 14, 2021 What am I not privy to? I see no user of errno nor mysql in this topic. And not much real code either. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 14, 2021 Share Posted October 14, 2021 4 minutes ago, ginerjm said: I see no user of errno nor mysql in this topic. Quote Link to comment Share on other sites More sharing options...
cearlp Posted October 14, 2021 Author Share Posted October 14, 2021 My BAD! The code is mysqli_error() not mysql_errno(). BUT, adding the $conn to the mysqli_error($conn) produces a valid and informative error message. Many thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.