মাইএসকিউএল ডাটাবেজে ডাটা ইনসার্ট করা
মাইএসকিউএল ডাটাবেজে ডাটা ইনসার্ট করার নিয়ম নিচে দেয়া হল- এজন্য কিছু কোয়েরী শিখলে ভাল হয়। তৈরী করা টেবিলে নিচের ভ্যালু সংযুক্ত করার জন্য এই কোড লিখু্ন।
insert.php ফাইল এ
প্রথমে পি.এইচ.পি. কোড শুরু করি এভাবে, <php
তার পরের লাইনে লিখি, ডাটাবেজ কানেকশন এর জন্য
$con = mysql_connect(“localhost”,”hedaetul_bd”,”password”);
তার পরের লাইনে লিখি, ডটাবেজ সিলেক্ট করার জন্য,
mysql_select_db(“hedaetul_bd”, $con);
তার পরের লাইনে লিখি, hedaetul_bd ডাটাবেজের Persons টেবিলে ভ্যালু ইনসার্ট করার জন্য, যা মাইএসকিউএল কোয়েরী ব্যবহার করা হয়
$sql = mysql_query(“INSERT INTO Persons (FirstName, LastName, Age)
VALUES (‘Masum’, ‘Ali’, ’26′)”);
তার পরের লাইনের শুরুতে // দিয়ে লিখি,
Execute query
তার পরের লাইনে লিখি,
mysql_query($sql,$con);
তার পরের লাইনে লিখি-
echo “Data Inserted successfully”;
তার পরের লাইনে লিখি,
mysql_close($con);
?>
======-
Inserting data in MySQL database
MySQL database to insert the data given below are: It is best to learn some of the query. The following table is designed to add value likhuna this code.
insert.php file
First pieicapi So let's start code, <php
Write the next line, for a database connection
$ Con = mysql_connect ( "localhost", "hedaetul_bd", "password");
Write the next line, to select databeja,
mysql_select_db ( "hedaetul_bd", $ con);
Write the next line, hedaetul_bd Persons database table to insert a value, which is used in MySQL query
$ Sql = mysql_query ( "INSERT INTO Persons (FirstName, LastName, Age)
VALUES ( 'Masum', 'Ali', '26') ");
// Write the beginning of the next line,
Execute query
Write the next line,
mysql_query ($ sql, $ con);
The next line likhi
echo "Data Inserted successfully";
Write the next line,
mysql_close ($ con);
?>
|