PHP Snippets

Name:MySQL Match
Description: This will check your MySQL database for possible match, useful if you dont want two or more of same value on your database like an email address.

Code below...
> <?php
//Value you want to check
$something "item";
//Connect to your database
$db mysql_connect("localhost","username","pass"); 
//Select Database
mysql_select_db("database") or die("Cannot connect to database");
//Select table
$check mysql_query("SELECT field FROM table WHERE field='$something'");
//Check for any rows
$check mysql_num_rows($check);

  if (
$check 0) {
"This item already exist";



« Back to PHP Snippets

Home | Site Map | Privacy Policy | Advertising | Contact Us
Copyright © 2006-2014 - All Rights Reserved.
eXTReMe Tracker