What is the Correct First Parameter for mysqli_query in W3Schools MySQL Tutorial?

Barbara Streisand
Release: 2024-10-21 07:50:03
Original
669 people have browsed it

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>
Copy after login

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!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!