Results 1 to 2 of 2

Thread: Import PHP in JAVASCRIPT and SQL

  1. #1
    Join Date
    Jan 2014

    Question Import PHP in JAVASCRIPT and SQL

    Hey guys its my first post ...
    So i have a suggestion box for countries and i need to get the countries from SQL database..
    It only shows the last one ...
    PHP Code:
    ("""root""---") or die(mysql_error()); 
    mysql_select_db("xxx") or die(mysql_error()); 
    $data mysql_query("SELECT * FROM countries"
     or die(
    $info mysql_fetch_array$dataMYSQL_ASSOC)) 


           $(document).ready(function() {
                var jsonData = [];
                var cities = '<?php echo $info['country'].","; }   ?>'.split(',');
                for(var i=0;i<cities.length;i++) jsonData.push({id:i,name:cities[i],status:i%2?'':'Planned for visit',coolness:Math.floor(Math.random() * 10) + 1});
                var ms1 = $('#ms1').magicSuggest({
                    data: jsonData,
                    sortOrder: 'name',
                    value: [0,1,2,3,4,5,6],
                    groupBy: 'status',
                    maxDropHeight: 2000,
                    name: 'ms1'

    If you could help i would be greatful, THanks.
    Last edited by NogDog; 02-07-2014 at 08:08 PM. Reason: replaced <code> tags with [php] tags

  2. #2
    Join Date
    Mar 2007
    You have posted a JQuery issue, please ask in the JQuery forums (frameworks)

    ...Or maybe a combination of PHP and JQuery...
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center