Hi, Everyone
I hope you are enjoying the weekend and staying cool - we hit 124°F yesterday in the Coachella Valley. While I have found several sources of ideas for a simple, automated MySQL upload whenever my app is used (showing location data), none of them fit perfectly. Such is life.
My primary question here is that all of the references showed the creation of a simple php script that, ostensibly, tells MySQL how to behave and is to be "uploaded to my server" but this concept/action is not explained. Is this something that gets uploaded to the MySQL app on GoDaddy? There is an IMPORT button on the top of the page but importing a sample php script on the Internet gave me nothing but errors.
I know I am sounding like a whiney "B" but I cannot find information that is written at the level of my understanding, which is basically severely limited. Would someone please tell me where I should locate to following script and how I get it where it belongs? I have included a link, as well because I could not format the code.
Thank you for your patience and support
<?php
DEFINE ('DBUSER', 'YourDatabaseUserName');
DEFINE ('DBPW', 'YourPassword');
DEFINE ('DBHOST', 'YourDatabaseHost');
DEFINE ('DBNAME', 'YourDatabaseName');
$dbc = mysqli_connect(DBHOST,DBUSER,DBPW);
if (!$dbc) {
die("Database connection failed: " . mysqli_error($dbc));
exit();
}
$dbs = mysqli_select_db($dbc, DBNAME);
if (!$dbs) {
die("Database selection failed: " . mysqli_error($dbc));
exit();
}
$result = mysqli_query($dbc, "SHOW COLUMNS FROM customer");
$numberOfRows = mysqli_num_rows($result);
if ($numberOfRows > 0) {
/* By changing Fred below to another specific persons name you can limit access to just the part of the database for that individual. You could eliminate WHERE recorder_id='Fred' all together if you want to give full access to everyone. */
$values = mysqli_query($dbc, "SELECT * FROM customer WHERE recorder_id='Fred'");
while ($rowr = mysqli_fetch_row($values)) {
for ($j=0;$j<$numberOfRows;$j++) {
$csv_output .= $rowr[$j].", ";
}
$csv_output .= "\n";
}
}
print $csv_output;
exit;
?>
php_setup.txt (1.1 KB)