I have a customer who has created a MySQL database in phpmyadmin. I don't know what cp he's using. But he is accessing phpmuadmin directly in his browser, not through something like cPanel.
So he created a database. But he still needs to create a username and password for it. Can anyone tell me what to enter in the textbox in phpmyadmin to create a user and password for the db?
Thanks.
Vito
OK, he just told me that the login/password he uses to login to phpmyadmin works as username/password for all the databases in his phpmyadmin. So I guess I don't need to know how to create one.
The problem is that when he tries to run a setup.php file in his browser (which sets up the tables in the db), he just gets a blank page. I recall this happening once before and I believe the customer solved it saying it was because of improper table prefixes. So how do I know what table prefix he should be using?
Vito
stephenM
09-04-2003, 07:52 AM
It would help if we knew what he was trying to do. What is setup.php actually meant to do?
Sorry, I wasn't sure how much info I needed to give you. I have a site where I sell real time traffic monitoring software. The customer creates a MySQL database, configures the config file to include the db info, uploads the files to his server, then runs setup.php. It basically creates the tables in the database. Here is the code for the setup.php:
<?php
require_once( 'include/init.php' );
require_once( 'include/setup_script.php' );
// BEGIN
$script = new SetupScript();
$script->run();
exit;
// END
?>
Here's the code for setup_script.php:
<?php
// class SetupScript.
class SetupScript extends MyPageScript
{
// Setup script.
function SetupScript()
{
// Constructor.
$this->MyPageScript( 'setup' );
$a = array( 'valid_users' => array( 'admin' ) );
$this->actions = array(
'pg_index' => $a,
'create_tables' => $a,
'delete_tables' => $a,
'update_tables' => $a,
'insert_test_data' => $a,
);
}
function get_user_access_level()
{
// Return user access level (string)
// for selecting allowed actions.
return 'admin';
}
function run()
{
// NB! Redefined to authorize admin.
$this->authorize_admin();
$this->page->parse_file( '_copyright.html', 'copyright' );
parent::run();
}
// Actions:
function pg_index()
{
$this->page->assign( array(
'title' => 'Setup area',
) );
$this->page->parse_file( 'index.html', 'body' );
}
function create_tables()
{
// Create all MySQL database tables.
foreach( $this->app->tables as $name => $class_name ) {
$obj = new $class_name; // !!!
$obj->create_table();
}
$this->page->assign( array(
'title' => 'Done!',
'ok' => "<p>All tables have been created!</p>\n"
) );
$this->page->parse_file( 'index.html', 'body' );
}
function delete_tables()
{
// Delete all MySQL database tables.
foreach( $this->app->tables as $name => $class_name ) {
$obj = new $class_name; // !!!
$obj->delete_table();
}
$this->page->assign( array(
'title' => 'Done!',
'ok' => "<p>All tables have been deleted!</p>\n"
) );
$this->page->parse_file( 'index.html', 'body' );
}
function update_tables()
{
// Create all MySQL database tables.
foreach( $this->app->tables as $name => $class_name ) {
$obj = new $class_name; // note: variable class
$obj->update_table();
}
$this->page->assign( array(
'title' => 'Done!',
'ok' => "<p>All tables have been updated!</p>\n"
) );
$this->page->parse_file( 'index.html', 'body' );
}
} // class SetupScript
?>
As mentioned, I recall something like this happening before, and the customer solved it saying it had to do with table prefixes.
Vito