Initial commit

This commit is contained in:
melzubeir
2017-05-26 15:17:48 +04:00
commit 1f43248510
254 changed files with 72319 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
<?php
$connection = mysql_connect('localhost','root','root') or die(mysql_error());
$database = mysql_select_db('test_csv') or die(mysql_error());
?>
+97
View File
@@ -0,0 +1,97 @@
<!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>Autocomplete search </title>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(function(){
$(".search").keyup(function()
{
var searchid = $(this).val();
var dataString = 'search='+ searchid;
if(searchid!='')
{
$.ajax({
type: "POST",
url: "search.php",
data: dataString,
cache: false,
success: function(html)
{
$("#result").html(html).show();
}
});
}else{return false;}return false;
});
jQuery("#result").live("click",function(e){
var $clicked = $(e.target);
var $name = $clicked.find('.name').html();
var decoded = $("<div/>").html($name).text();
$('#searchid').val(decoded);
});
jQuery(document).live("click", function(e) {
var $clicked = $(e.target);
if (! $clicked.hasClass("search")){
jQuery("#result").fadeOut();
}
});
$('#searchid').click(function(){
jQuery("#result").fadeIn();
});
});
</script>
<style type="text/css">
body{
font-family:Tahoma, Geneva, sans-serif;
font-size:16px;
}
.content{
width:900px;
margin:0 auto;
}
#searchid
{
width:300px;
border:solid 1px #000;
padding:10px;
font-size:14px;
}
#result
{
position:absolute;
width:300px;
padding:10px;
display:none;
margin-top:-1px;
border-top:0px;
overflow:hidden;
border:1px #CCC solid;
background-color: white;
}
.show
{
padding:10px;
border-bottom:1px #999 dashed;
font-size:15px;
height:50px;
}
.show:hover
{
background:#4c66a4;
color:#FFF;
cursor:pointer;
}
</style>
</head>
<body>
<div class="content">
<input type="text" class="search" id="searchid" />&nbsp; &nbsp; <br />
<div id="result">
</div>
</div>
</body>
</html>
File diff suppressed because one or more lines are too long
+21
View File
@@ -0,0 +1,21 @@
<?php
include('db.php');
if($_POST)
{
$q=$_POST['search'];
$sql_res=mysql_query("select id,name from autocomplete where name like '%$q%' order by id LIMIT 5");
while($row=mysql_fetch_array($sql_res))
{
$username=$row['name'];
$b_username=$q;
$final_username = str_ireplace($q, $b_username, $username);
?>
<span class="name"><?php echo $final_username; ?></span>&nbsp;<br/><br/>
</div>
<?php
}
}
?>
+64
View File
@@ -0,0 +1,64 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Autocomplete</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<?php
mysql_connect("Localhost","root","root");
mysql_select_db("test_csv");
$sql="select name from user_info";
$result=mysql_query($sql);
?>
<script>
$(function() {
var availableTags = [
<?php
while($row=mysql_fetch_assoc($result))
{
echo'"';
echo $row['name'];
echo'",';
}
?>
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
$(function() {
var available = [
<?php
$sql="select email from user_info";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
echo'"';
echo $row['email'];
echo'",';
}
?>
];
$( "#mytag" ).autocomplete({
source: available
});
});
</script>
</head>
<body>
<div class="ui-widget">
<label for="tags">User Names: </label>
<input id="tags">
</div>
<br>
<br>
<br>
&nbsp;&nbsp;<div class="ui-widget">
<label for="mytag">E-Mail: </label>
<input id="mytag">
</div>
</body>
</html>