Open wvmikep opened 10 years ago
Yes. You will need to edit the class.db-api.php file in the include folder. This is the manual process. /* * Register a new dataset * @param string $name the dataset name * @param array $args the dataset properties / function register_db( $name = null, $args = array() ) {
$defaults = array(
'name' => null,
'username' => 'root',
'password' => 'root',
'server' => 'localhost',
'port' => 3306,
'type' => 'mysql',
'table_blacklist' => array(),
'column_blacklist' => array(),
'ttl' => $this->ttl,
);
$args = shortcode_atts( $defaults, $args );
$name = $this->slugify( $name );
$this->dbs[$name] = (object) $args;
}
It doesn't help at all. Same result. I know the info I give it is good because I have a separate test page that returns data.
Trying to reverse engineer this, starting with shortcode_atts.
When you received the error message "Select a database", this means your config.php and class.db-api.php files have not been configured correctly. what do you have in the config.php and class.db-api files?
They're below.
With that said, it's failing in parse_query because there's no query string. If I put db and table in the query string (not intended per the instructions ... and doing so makes no sense anyway), I then get invalid database.
Doesn't make sense given how my little test page returns data from the db with the same credentials.
$args = array( 'name' => 'dbname', 'username' => 'dbuser', 'password' => 'dbpw', 'server' => 'localhost', 'port' => 3306, 'type' => 'mysql', 'table_blacklist' => array(), 'column_blacklist' => array(), );
register_db_api( 'berkeleywv-fe-inspections', $args );
function register_db( $name = null, $args = array() ) {
$defaults = array(
'name' => 'dbname',
'username' => 'dbuser',
'password' => 'dbpw',
'server' => 'localhost',
'port' => 3306,
'type' => 'mysql',
'table_blacklist' => array(),
'column_blacklist' => array(),
'ttl' => $this->ttl,
);
$args = shortcode_atts( $defaults, $args );
$name = $this->slugify( $name );
$this->dbs[$name] = (object) $args;
}
This appears to be a database and server access issue. Test your sample db_user , db_pass, db_host and db_name in a separate SQL Admin tool to see if you can access the database server.
That "test page" is separate from db-to-API. Phpmyadmin has no issues either.
Sent from my iPhone
On Mar 1, 2014, at 10:00 PM, "Patrick K. Johnson Jr." notifications@github.com wrote:
This appears to be a database and server access issue. Test your sample db_user , db_pass, db_host and db_name in a separate SQL Admin tool to see if you can access the database server.
— Reply to this email directly or view it on GitHub.
okay, try accessing one of your tables in the database. e.g.: http://localhost/berkeleywv-fe-inspections/table.json e.g.: http://localhost/berkeleywv-fe-inspections/table.xml e.g.: http://localhost/berkeleywv-fe-inspections/table.html
Must select a database
Sent from my iPhone
On Mar 1, 2014, at 10:42 PM, "Patrick K. Johnson Jr." notifications@github.com wrote:
okay, try accessing one of your tables in the database. e.g.: http://localhost/berkeleywv-fe-inspections/table.json e.g.: http://localhost/berkeleywv-fe-inspections/table.xml e.g.: http://localhost/berkeleywv-fe-inspections/table.html
— Reply to this email directly or view it on GitHub.
Absolutely a database connection to web server issue. This is usually resolved by changing your database binding in the my.cnf configuration. e.g.: #bind-address = 127.0.0.1
Not so fast: http://data.mike-pulsifer.org/test.php
Sent from my iPhone
On Mar 1, 2014, at 11:17 PM, "Patrick K. Johnson Jr." notifications@github.com wrote:
Absolutely a database connection to web server issue. This is usually resolved by changing your database binding in the my.cnf configuration. e.g.: #bind-address = 127.0.0.1
— Reply to this email directly or view it on GitHub.
Problem with code. Does not work that way. test.php cannot be converted to REST http://avizium.no-ip.org/apiv2/avizium-bloggers/av_comments.xml
I know. It just proves I can get to the db.
Sent from my iPhone
On Mar 2, 2014, at 7:17 AM, "Patrick K. Johnson Jr." notifications@github.com wrote:
Problem with code. Does not work that way. test.php cannot be converted to REST http://avizium.no-ip.org/apiv2/avizium-bloggers/av_comments.xml
— Reply to this email directly or view it on GitHub.
Have you solved that? I meet the same problem.
FWIW, I've been unable to replicate the problem.
@alpheustechnologies You're saying we have to edit the config.php and class.db-api.php. Why have a config file then?
@I faced the same problem.
I've followed all the comments in this post, and still see
Must select a database
I've used the same settings in MySQL Workbench and I can connect to my db fine.
What should I put for dataset-name ?
same problem!
You do not need to edit class.db-api.php. You need to edit config.php and .htaccess to fit your configuration:
config.php: change $defaults = array to your db info register_db_api( 'whateveryouwanttonameyourdataset', $args );
.htaccess:
.htaccess RewriteBase was wrong for me :) Changed it to my project path, ty man.
I set up the config.php as instructed and I'm getting "Must select a database." Is there nothing else I need to edit?