create a file sql.php and add following:

<?php
    $DB_HOST = 'localhost';//Host of the mysql
    $DB_USERNAME = 'root';//Username for mysql database
    $DB_PASSWORD = '';//Password for mysql database
    $DB_DATABASE = 'test';//Name of the database

    $DB_LINK = mysqli_connect($DB_HOST, $DB_USERNAME, $DB_PASSWORD); 
//Create a link to the database
    if (!$DB_LINK) { //if unable to connect to the database
        die('Unable to connect to the database...'); //stop all scripts and 
kill the page
    }

    //After connection, put a database into the scope
    mysqli_select_db($DB_LINK, $DB_DATABASE) or die(trigger_error("Unable 
to select the database: " . mysqli_error($DB_LINK)));

    //Transfer global data from DB_LINK to SQL
    $GLOBALS['SQL'] = $GLOBALS['DB_LINK'];
?>

edit username, password and database then back to the script from previous 
post:

 mysqli_query($GLOBALS['SQL'], $sql1);

that function executes the query. "$GLOBALS['SQL']" is the DB link and 
$sql1 is the query saved.


Am Montag, 9. April 2018 23:19:58 UTC+2 schrieb kenhes:
>
> Did you get this working Andrew? Gabriel, I'm not sure what you mean by: 
> adjust global SQL to your DB info.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/afd79d01-3b8c-43d4-af74-4bd764f21420%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to