PHP - Search Database Mutliple Times For Diffrent Things
Hello, im looking for some help if anyone can be of help... i want to read from a file each line of that file, for each line search the database for that line found in the file and return what comes back, but i want it todo this for the whole file which could be up to 500 diffrent lines. what i have so far doesnt work ive tried a number of things including foreach() some of this could i got some somewhere else they said it worked for them.
$lines = file("/var/www/htdocs/mp32/playlist.lst"); require('dbconfig1.php');//connect to db script while($n < count($lines)) { //get number of lines in file or array $recipeQuery = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE = '$lines[$n]'"); //query database for each one while($recipeQuery1 = mysqli_fetch_array($recipeQuery)) { print "{$recipeQuery1['artist']}"; } $n = $n + 1; } Similar TutorialsOkay I'm a newbie at PHP but was trying to write a counter for my website to count the amount of times a specific button is clicked. My desired outcome is as follows: If the form submit button "like" or "dislike" is clicked, get user's ip and check to see if it already exists in the database. If it exists, don't increment the count (of either button), otherwise log the ip and increment the count (of whichever button is clicked) by 1. Currently I've got the increment working (testing only the like button at the moment) and I've got the ip being stored into the database, but cannot get the comparison to work. Each time the button is clicked it adds the ip address into the database instead of disallowing it. Note: there are two different tables--one storing the ip (counter) and one storing the like clicks (Designs) (dunno if there's a better way?) Excuse my newbieness. The problem area: (like button only): if(isset($_POST['like'])) { $ip_address = $_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT ip FROM counter WHERE ip = '$ip_address'"); $num_rows = mysql_num_rows($query); if ($num_rows > 0) { die ("You've already clicked the button!"); } else { mysql_query("INSERT INTO counter VALUES ($ip_address)"); mysql_query("UPDATE Designs SET up = up + 1 WHERE ref = 'cataclysm'"); } } $select = mysql_query("SELECT up FROM Designs"); while($row = mysql_fetch_array($select)) { echo $row['up']; } Hello, I am trying to subtract the current time from a list of times in a mysql database. The first page inserts the time into mysql.
<?php $var_Time = date("h:i:s"); $mysqli = new mysqli('localhost','root','blah','test'); if ($mysqli->connect_error) { die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error); } $insert_row = $mysqli->query("REPLACE INTO test_table (id, time) Values(NULL, '$var_Time')"); if($insert_row){ while (false); }else{ die('Error : ('. $mysqli->errno .') '. $mysqli->error); } $mysqli->close(); ?>The second page is supposed to iterate through all of the times in the database and subtract the current time, but i cant figure out how to do it. <?php $mysqli = new mysqli('localhost','root','blah','test'); if ($mysqli->connect_error) { die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error); } $query = "SELECT * FROM `test_table`"; $result = $mysqli->query($query) or die($mysqli->error.__LINE__); $var_set_time = stripslashes($row['time']); $var_current_time = date("h:i:s"); $diff = strtotime( $var_current_time .' UTC' ) - strtotime( $var_set_time .' UTC'); echo $diff; ?> Edited by Ch0cu3r, 09 October 2014 - 01:40 PM. Added code tags Hello, I'm new! I am trying to populate a list of locations based on ratings. I can populate the list just fine but it's displaying every record in the table. Is there a way of only looping 4 times so as to just display the top 4 records? Here's the code: Code: [Select] $result = mysql_query("SELECT * FROM locations ORDER BY rating DESC"); while($row = mysql_fetch_array($result)) { echo $row['name']; echo "<br>; } Thankyou in advance for any help I am developing a intranet forum in Php and MySQL and I am using ajax to display searched results on the same page but right now I am using query LIKE text% to search in database which is slower. but I want to make it fast search engin which can parse *,+ and show result. Since I am using ajax i am not able to use free search engin,so if possible pls provide a complete solution I have code to search a database of members, I can search by lastname but having a little problem. I want to be able to search by lastname starting with the first letter. (ie: a or b or c or d and so on). As it is right now I can only search by first letter of last name if I add % to the search (ie: a% b% c%) will give me all members with the last names starting with the approiate letter designation. I'm not sure how to handle this, any help would be appreciated. Thanks. Code: [Select] <!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></title> </head> <body> <center><table cellspacing="10" cellpadding="10" width="750" border="0"> <h4>Search</h4> <form name="search" method="post" action="<?php $PHP_SELF?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="lname">Last Name</option> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <?php // check to see if anything is posted if (isset($_POST['find'])) {$find = $_POST['find'];} if (isset($_POST['searching'])) {$searching = $_POST['searching'];} if (isset($_POST['field'])) {$field = $_POST['field'];} //This is only displayed if they have submitted the form if (isset($searching) && $searching=="yes") { echo "<h4>Results</h4><p>"; // If they did not enter a search term we give them an error if (empty($find)) { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect("localhost", "root", "1910") or die(mysql_error()); mysql_select_db("cmc_member") or die(mysql_error()); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); // Now we search for our search term, in the field the user specified $results = mysql_query("SELECT * FROM members WHERE upper($field) LIKE'$find'"); // And we display the results if($results && mysql_num_rows($results) > 0) { $i = 0; $max_columns = 3; while($row = mysql_fetch_array($results)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product ALIGN='CENTER' if($fname != "" && $fname != null) echo "<td ALIGN='CENTER'><FONT COLOR='red'><b>$fname $lname</b></FONT><br> $address <br> $city $state $zip <br>$phone<br><a href=\"mailto: $email\">$email</a><br></td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches = mysql_num_rows($results); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> </tr> </table></center> </body> </html> The situation is that I have a large string with some identifiers to say "replace me" with something else. My goal is to replace the values, but if one replacement includes one of the other keys, I don't want to replace it.
For example:
<?php $str = 'some blob ~abc~ followed by ~def~'; $arr_orig = array( '~abc~', '~def~' ); $arr_new = array( 'value~def~', 'blah' ); echo str_replace( $arr_orig, $arr_new, $str ); ?>This will echo: some blob valueblah followed by blah But that's not what I'm trying to accomplish. Basically, I want ~abc~ to be replaced with the literal: value~def~ and for the ~def~ that happens to be part of that string to NOT be replaced. I hope what I'm asking is clear. Basically, preg_replace/str_replace with arrays seems no different than just doing a FOR loop and replacing ~abc~ and then ~def~. But that's not what I need. I'm hoping that if ~abc~ is replaced with text that happens to be another identifier -- ~def~, ~xyz~, whatever -- that this already replaced text is not again replaced. Is there a built-in function to do something like this? If not, should I just parse the whole string and count characters or something? Seems like a pain (and slow!) I just added a user log on for a site I am building using PHP. I used a simple session based system for this. I can log on just fine. What I am looking for is a way to pass on in ht session what rank a user is so some links/pages will only show for the admin or the super user but not the normal user. I rank the users as Admin 1, superuser 2, and user 3. This is what I have for the session in my header that allows you to be logged in. Code: [Select] <? session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } ?> Here is what I have that starts the session Code: [Select] //Connection stuff $query="SELECT * FROM user WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($query); $count=mysql_num_rows($result); if($count==1){ session_register("myusername"); session_register("mypassword"); header("location:index.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> Hello all, I'm collecting date/time information via a form and would like to convert the info into something that I can stick in my MySql database (a timestamp???). I'm collecting the current month (variable name: month-- of the form "mm"), day (variable name: day -- of the form "dd"), year (variable name: year -- of the form "yyyy"), time of day (variable name: time -- of the form "h:00"), and before or after noon (variable name: ampm -- of the form "am" or "pm"). Any suggestions as to how to change this into a quantity that I can store as a value and then use to compare to other date/times would be appreciated. Thanks! This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=350052.0 I need my select dropdown to show the relevant option. I am using a GET action to pass the id of an article to another page (edit article page) with this i am selecting that specific record and passing it's data into form object in order to be modified and updated. The only issue is my category list is a dropdown and i need it to display the relivent category for that specific record. hope that makes sence If my SQL statement returns a result I want to change the background color of a cell. If the user is logged in I want to then show one of two buttons. either book, or cancel, depending on whether the cell is available or not. So far I have this: $sql = "SELECT * FROM diary WHERE day = '$mon' AND studio_id ='mon11'"; $query = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($query) < 1) { $bgcolour= '#5DFC0A'; if(isSet($_SESSION['logged'])) { $book = '<form action="../book.php" method="POST"><input type="hidden" name="day" value='.$mon.' type="text"/><input type="hidden" name="month" value='.$month.' type="text"/><input type="hidden" name="year" value='.$year.' type="text"/><input type="hidden" name="book_id" value="mon11" type="text"/><input type="submit" name="submit" value="Book!"></form>'; }} else { $bgcolour= '#FF0000'; } if(isSet($_SESSION['logged'])) { $book = '<form action="../cancel.php" method="POST"><input type="hidden" name="day" value='.$mon.' type="text"/><input type="hidden" name="month" value='.$month.' type="text"/><input type="hidden" name="year" value='.$year.' type="text"/><input type="hidden" name="book_id" value="mon11" type="text"/><input type="submit" name="submit" value="Cancel!"></form>'; } echo "<td rowspan='3' bgcolor=".$bgcolour.">"; if (isset($book)) { echo $book; } I want to use the $session(logged) variable to show the appropriate button, but I can't get it to work in the other if statement, Any ideas? Hello. How can I have a single form which has a number of standard fields in it, say date and name.... but for that same date and name I want to add multiple additional entries for say phone calls recieved... (silly example I know) How can I enter the standard data once and an undefined amount of phone calls received ? without having to put a maximum number of possible entry fields on the page.... ? So, say my Form is : <form action="myform.php" method="post"> <p>Date: <input type="text" date="date" /><br /> Name: <input type="text" name="name" /></br> Call From: <input type="text" call_from="call_from" /></br> <p><input type="submit" value="Send it!"></p> </form> If I have 50 calls for that person I only want to enter their name and the date once and then add as many calls as needed... How can I do it? Thanks So im trying to make a sign up forum to where you have to put in your zip code.. and im wanting to make a page to where it shows all the individual zip codes that have register but i dont want mutliples.. for example say i have 5 people register from '90210' and if you go to look at the page where it shows the list of zip codes how could i make it only display '90210' once and not 5 times? im wanting to make this so someone can look at the zip code page and see if anyone near them has registerd on the site as well Thanks im doing smting basically wrong Code: [Select] <form action="" method="post"> <?php $x=1; $images = $_GET['images']; for( $i=0; $i<$images; $i++ ) { echo '<input name="ID" type="hidden" value="1234" /> <br> <input name="ImageURL['.$i.']" type="file" value=""/><br><br>'; } ?> <input name="submit" type="submit" /> <?php $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_query("SET NAMES 'utf8'"); mysql_select_db("international", $con); if (isset($_POST['submit'])) for( $i=0; $i<$images; $i++ ) { $query=mysql_query("INSERT INTO images (ID,ImageURL) VALUES ('$_POST[ID]','$_POST[ImageURL]')"); exit; mysql_close($con); } ?></form> I am trying to create a dynamic table that gets generated based upon users birthday, then selection of last name (via a select menu), then first name (via a select menu), Each selection would subsequently filter out items not chosen. i.e. if the last name of Griffin were selected, only those with the last name Griffin would be present when selecting the first name. I have been able to generate the birthday and then last name selection, but I am unclear of how to add the first name into the mix (and any other subsequent filters thereafter) Here is what I as so far. Any help would be appreciated. database sql code: Code: [Select] CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `firstname` varchar(20) NOT NULL, `lastname` enum('Griffin','Griffin6','Quagmire','Swanson') NOT NULL, `age` int(11) NOT NULL, `hometown` varchar(25) NOT NULL, `job` varchar(25) NOT NULL, `birthdate` date NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; /*Data for the table `user` */ insert into `user`(`id`,`firstname`,`lastname`,`age`,`hometown`,`job`,`birthdate`) values (1,'Peter','Griffin',41,'Quahog','Brewery','1960-01-01'), (2,'Lois','Griffin',40,'Newport','Piano Teacher','1961-08-11'), (3,'Joseph','Swanson',39,'Quahog','Police Officer','1962-07-23'), (4,'Glenn','Quagmire',41,'Quahog','Pilot','1960-02-28'), (5,'Megan','Griffin',16,'Quahog','Student','1984-04-24'), (6,'Stewie','Griffin',2,'Quahog','Dictator','2008-03-03'); index.php: <?php include('config.php'); //Include the database connections in it's own file, for easy integration in multiple pages. $lastname_result = mysql_query("SELECT lastname FROM user GROUP BY lastname"); $result = mysql_query("SELECT * FROM user"); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="start/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css"/></link> <link href="../themes/style.css" rel="stylesheet" type="text/css" media="print, projection, screen" /></link> <link href="../common.css" rel="stylesheet" type="text/css"></link> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" src="jquery.tablesorter.js"></script> <script type="text/javascript" src="jquery-ui-1.8.4.custom.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#myTable").tablesorter({widgets: ['zebra']}); $("#options").tablesorter({sortList: [[0,0]], headers: { 3:{sorter: false}, 4:{sorter: false}}}); } ); function reSort(par) { $("#tableBody").empty(); var vfrom = document.getElementById('from').value; var vto = document.getElementById('to').value; $.get('table.list.php?from='+vfrom+'&to='+vto+'&lastname='+par,function(html) { // append the "ajax'd" data to the table body $("#tableBody").append(html); // let the plugin know that we made a update $("#myTable").trigger("update"); // set sorting column and direction, this will sort on the first and third column var sorting = [[0,0]]; // sort on the first column $("#myTable").trigger("sorton",[sorting]); }); } </script> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td width="160" valign="top"></td> <td width="732" valign="top"> <table width="90%" border="0" align="center"> <form method="post"> <label for="from">From</label> <input type="text" id="from" name="from"/> <label for="to">to</label> <input type="text" id="to" name="to"/> <?php //added javascript function call to function located in "ajax.js" ?> <select id="selectbox" name="area" onchange="reSort(this.value);"> <?php //added javascript function call to function located in "ajax.js", and changed the id for content change via javascript. ?> <option value="">Select an lastname</option> <option value=""></option> <?php while(list($lastname)=mysql_fetch_array($lastname_result)) { echo "<option value='$lastname'>$lastname</option>"; } ?> </select> </form> </table> <table id="myTable" class="tablesorter" border="0" cellpadding="5" cellspacing="1"> <thead> <tr> <th>First Name</th> <th>Last Name</th> <th>Age</th> <th>Birthday</th> <th>Hometown</th> <th>Job</th> </tr> </thead> <tbody id="tableBody"> <?php //added id to the tbody so we could change the content via javascript ?> </tbody> </table> <p> </p> <p> </p> <p align="right"> </p> </td> <td width="196" valign="top"> </td> </tr> </table> </body> </html> table.list.php: <?php include('config.php'); //database connection. if(!isset($_GET['lastname'])) { //if the proper get parameter is not there, redirect to google. header('Location: http://google.com'); exit(); } $lastname = preg_replace('~[^A-Za-z]+~','',$_GET['lastname']); //strip out anything but alpha for the name. $lastname = trim($lastname); //trim the name from all whitespace. if($lastname != '') { //check against an empty string. could have just used "empty()". $where = ' WHERE lastname = \'' . $lastname . '\''; //write the where clause. } else { //if lastname is empty, the where clause will be to, and it will return all names. $where = NULL; unset($lastname); } $from = (isset($_GET['from'])) ? date('Y-m-d',strtotime($_GET['from'])) : NULL; $to = (isset($_GET['to'])) ? date('Y-m-d',strtotime($_GET['to'])) : NULL; if($from != NULL && $to != NULL) { $where .= (isset($lastname)) ? ' AND ' : ' WHERE '; $where .= " birthdate BETWEEN '$from' AND '$to'"; } elseif($from != NULL) { $where .= (isset($lastname)) ? ' AND ' : ' WHERE '; $where .= " birthdate >= '$from'"; } elseif($to != NULL) { $where .= (isset($lastname)) ? ' AND ' : ' WHERE '; $where .= " birthdate <= '$to'"; } $query = "SELECT * FROM user $where"; $result = mysql_query($query); //get the database result. while($row=mysql_fetch_assoc($result)){ //loop and display data. ?> <tr> <td><?php echo $row['firstname']; ?></td> <td><?php echo $row['lastname']; ?></td> <td><?php echo $row['age']; ?></td> <td><?php echo $row['birthdate']; ?></td> <td><?php echo $row['hometown']; ?></td> <td><?php echo $row['job']; ?></td> </tr> <?php } // End while loop. ?> Now, here's what I'm trying to do:
First, I have a file filled with data like such:
title
tag
1
2
Title
Description
Etc
Next, I upload that file to my site which then proceeds to make an array with said data and then inserts it into my database. But this is not the intended behavior. Right now, if I upload the same file again, it will re-insert everything and duplicate all entries.
What I want to do is check if the data in the file has already been added, do nothing. If it's been modified, I want to update the database where changes have been made and not duplicate anything.
Currently, my code does all that except one thing whre I'm really stuck: it won't update the changes from the file to the database. I've tried echoing everything and it's to be working except for the query so I take it the error is in there but I can't find it... I'm still learning PHP and MySQL so I thought maybe somebody could help indicate where or what I'm doing wrong in the query. Thanks in advance !
Here's my attempt at doing so:
$register_ep_data = array( 'show' => $name, 'season' => $srNum, 'ep' => $epNum, 'app_name' => $epName, 'tag' => $tag, 'app_about' => $desc, 'app_website' => $imdb, 'app_release' => $release, 'type' => $type, 'app_code' => $Frame ); array_walk($register_ep_data, 'array_fu'); $fields = '`' . implode('`, `', array_keys($register_ep_data)) . '`'; $data = '\'' . implode('\', \'', $register_ep_data) . '\''; $epFound = false; $id = 0; while ($ep_list_data = mysql_fetch_array($turtle)) { $id = $ep_list_data['app_id']; $currentNAME = $ep_list_data['app_name']; $SERIES = $ep_list_data['show']; if ($SERIES == $name) { if ($currentNAME == $epName) { $epFound = true; break; } } } if ($epFound) { mysql_query("UPDATE `games` SET ($fields) VALUES ($data) WHERE `app_id` = '$id'"); } else { mysql_query("INSERT INTO `games` ($fields) VALUES ($data)"); }A few explanations: $fields would equal to something like: `show`, `season`, `ep`, etc... and $data to 'example', '1', '2', 'etc' Hello all. First of all, if this isn't the right place for this topic, please excuse me and may the moderators/admins move it where it should belong. Second, I'm trying to make a mysql search - Everything works, but if say, a user searches for 34 it displays all numbers that have the number 34 in them. I want the results to be exact - if a user searches for 34, to display only 34, not 334, 5034 or 3401 (like it happens now). Here's the code: Code: [Select] <?php mysql_connect ("**************", "*******","*****") or die (mysql_error()); mysql_select_db ("********"); $term = $_POST['term']; $sql = mysql_query("select * FROM countries WHERE cocode LIKE '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo '<br/> Code: '.$row['cocode']; echo '<br/> Country: '.$row['coname']; echo '<br/><br/>'; } ?> If you have any questions, you're welcome to ask them in the thread. Thank you in advance Hi i am an absolute PHP/MYSQL Novice but i guess we all gotta start somewhere. I have a table in my database with names and addresses, f_name, s_name, street, zip_code, city etc etc etc What i want to do is display a drop down of all cities in my database then click on any city in the list to display all the details of people in that city, showing all fields. So i have got this far .. Code: [Select] $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'cities_wrdp1'; mysql_select_db($dbname); $sql = "SELECT DISTINCT City FROM PBM"; $result = mysql_query($sql); echo "<select name='City'>"; while ($row = mysql_fetch_array($result)) { echo "<option value='" . $row['City'] . "'>" . $row['City'] . "</option>"; } echo "</select>"; This produces the nice drop down list of cities from the database ... Now on click i would like to return results similar to this Code: [Select] $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'cities_wrdp1'; mysql_select_db($dbname); $query = sprintf("SELECT * FROM PBM"); $result = mysql_query($query); if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } echo "<br />"; echo "<table border='0'>"; while ($row = mysql_fetch_assoc($result)) { echo "<tr><td>"; echo "<a href=\"" .$row['profileURL'] . "\"> <img src=\"" . $row['faviconURL'] . "\" border=0 alt=\"" . $row["Thumbnail"] . "\"> </a>"; echo "</td><td align='center'>"; echo $row['f_name']; echo "</td><td align='center'>"; echo $row['s_name']; echo "</td><td align='center'>"; echo $row['number']; echo "</td><td align='center'>"; echo $row['street']; echo "</td><td align='center'>"; echo $row['zip']; echo "</td><td align='center'>"; echo $row['city']; echo "</td><td align='center'>"; echo $row['Country']; echo "</td><td align='center'>"; echo $row['email_address']; echo "</td><td align='center'>"; echo $row['fb']; echo "</td><td align='center'>"; echo $row['web_site']; echo "</td><td align='center'>"; echo $row['phone']; echo "</td><td align='center'>"; echo $row['land']; echo "</td><td align='center'>"; echo $row['age']; echo "</td></tr>"; } echo "</table>"; mysql_free_result($result); So my question is .. how do i make the first piece of code selectable to produce similar results to the second piece of code based on the city selected ? Thanks for any help .. and please excuse my ignorance .. Need some help I have 2 tables in a database and I need to search the first table and use the results from that search, to search another table, can this be done? and if it can how would you recommend that I go about it? Thanks For Your Help Guys! i have enters some data using form which submit data in sql table1 like this, Fields name in table -->> id First name Lastname Date data saved -->> 1 user 1 2011-05-10 2 user 2 2011-05-11 3 user 3 2011-05-12 now i dont want to duplicate date in database let say while inserting data using form, Firstname : ____________ Lasename : ____________ Date : ____________ (i dont want this date to b save if the date alredy exist in database, it should prompt user "Date already exist and to edit click here (this will be the link to that date which is already exist so that we can edit) " ) SAVE i user files , form.php , insert.php(so insert values in database) , so tell me what function should i use to solve my problem.... |