Home >Backend Development >PHP Tutorial >What is the Correct First Parameter for mysqli_query in W3Schools MySQL Tutorial?
Error in W3Schools Tutorial: mysqli_query First Parameter
When attempting to use the W3Schools tutorial for MySQL insert operations, you may encounter an error on line 13 related to the mysqli_query function.
The Issue
The error stems from an incorrect first parameter being passed to mysqli_query. According to the official mysqli_query documentation, the first parameter should be a connection string, not the database name.
The Solution
To resolve the issue, modify line 13 to include the connection string as the first parameter:
<code class="php">mysqli_query($link, 'INSERT INTO web_formitem (`ID`, `formID`, `caption`, `key`, `sortorder`, `type`, `enabled`, `mandatory`, `data`) VALUES (105, 7, 'Tip izdelka (6)', 'producttype_6', 42, 5, 1, 0, 0)');</code>
Additional Note
It's important to note that the tutorial content on w3schools should be approached with caution as it often contains inaccuracies and inconsistencies. Consider referring to the official PHP and MySQL documentation for more reliable information.
The above is the detailed content of What is the Correct First Parameter for mysqli_query in W3Schools MySQL Tutorial?. For more information, please follow other related articles on the PHP Chinese website!