• Tidak ada hasil yang ditemukan

E-Commerce - UNIKOM Kuliah Online

N/A
N/A
Protected

Academic year: 2023

Membagikan "E-Commerce - UNIKOM Kuliah Online"

Copied!
5
0
0

Teks penuh

(1)

E-Commerce

2 SKS | Semester 7 | UNIKOM

Nizar Rabbi Radliya

[email protected]

Lesson 8

PHP & MySQL

(Part 2)

(2)

Universitas Komputer Indonesia | 18191

PHP Insert Data Into MySQL

After a database and a table have been created, we can start adding data in them.

Here are some syntax rules to follow:

The SQL query must be quoted in PHP

String values inside the SQL query must be quoted Numeric values must not be quoted

The word NULL must not be quoted

(3)

[email protected] | E-Commerce | 2 SKS | UNIKOM | 18191

PHP Insert Data Into MySQL

The INSERT INTO statement is used to add new records to a MySQL table:

INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)

(4)

Universitas Komputer Indonesia | 18191

PHP Insert Data Into MySQL

<?php

$sql = "INSERT INTO MyGuests (firstname, lastname, email) VALUES ('John', 'Doe', '[email protected]')";

if (mysqli_query($conn, $sql)) {

echo "New record created successfully";

} else {

echo "Error: " . $sql . "<br>" . mysqli_error($conn);

}

?>

(5)

[email protected] | E-Commerce | 2 SKS | UNIKOM | 18191

NEXT:

PHP & MySQL (Part 3)

Referensi

Dokumen terkait

pada ajll sangka noe lain lain Lamoen aja sala saoerang noe Bet dina minggoe atawa poe loeak leok, soemawonna moen harita keneh, geus ger deui bae aja tiloe opatna, geus tangtoc