⊗ppPmDBSQ 361 of 447 menu

Sending Requests to the Database

After connecting to the database, you can send queries to it. This is done using the mysqli_query function. The first parameter of this function takes the variable in which we stored the result of mysqli_connect, and the second - a string with the SQL query.

For example, let's execute a query that will fetch all records from the users table:

<?php $res = mysqli_query($link, 'SELECT * FROM users'); ?>

The query text does not have to be written directly in the function parameter mysqli_query. Let's put it into a variable:

<?php $query = 'SELECT * FROM users'; $res = mysqli_query($link, $query); ?>
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline