logo   Home Download Documentation Support

 

DashingDB Documentation

Learn to use DashingDB Within Minutes

 

Insert Unique Row in MySQL Table Example

This example shows you to insert unqiue row in mysql table, if you do not insert unique row, it would return you string "NOT UNIQUE".

Examples

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Insert Unique Row Example</title>


<style type="text/css">
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 36px;
font-weight: normal;
color: #FFFFFF;
}
.nText {
font-family: Tahoma, Geneva, sans-serif;
font-size: 14px;
font-weight: normal;
color: #000;
}
.eText {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #666;
}
.oText {
font-family: Tahoma, Geneva, sans-serif;
font-size: 16px;
font-weight: normal;
color: #03C;
}
</style>


</head>

 

<body>


<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50" align="center" bgcolor="#FD3E27"><h1>Insert Unique Row Example</h1></td>
</tr>
</table>


<p class="nText">This example shows you to insert unique data into table, try refresh and see the error NOT UNIQUE.</p>
<p class="eText">Following is the output of current example:</p>


<p><span class="oText">


<?php
include("class.php");

$row["field_1"] = "Item3";
$row["field_2"] = "Item2";

$unique[0] = "field_1";

echo mysql_insert_row("table_name_1", $row, $unique);
?>

 

</span></p>
</body>
</html>


 

 

© 2017 DashingDB.