<script type="text/javascript">
$(function() {
$('#jo').flexbox({
"results": [
{ "id": "1", "name": "002155" },
{ "id": "2", "name": "002155" },
{ "id": "3", "name": "asdasdasd" }
]},
{
showArrow: false
});
});
</script>
This code at top is the records that will suggest by the flexbox, for example ill type 00 it has two suggestion the 002155 and 002155, but the problem is the result of the word suggested is static, i read some code coming from this site that they link a php page to be use as the database. here is the sample...
$("#suggest").flexbox('back/search.php', {
this code above is from:jquery flexbox ? i try to make some alternative to be able to use mysql as the result of the word suggestion;
<script type="text/javascript">
$(function() {
$('#jo').flexbox({
"results": [
<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("accom");
$query = mysql_query("select * from myproject");
while($i = mysql_fetch_array($query))
{
$ii++;
print"{ id : ".$ii.", name: ".$i[per_name]." },";
}
?>
]},
{
showArrow: false
});
});
</script>
but it doesnt work ;-(, help me please, to make the source of the word suggestion is coming from a sql query, thank you guys..
by the way here is my table
myproject
per_id(int 100)auto_increment
per_name(varchar 100)