Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Noob help - Could not select database

Locked
barrydocks
Posts: 18
Joined: Wed Dec 18, 2013 4:44 pm

Noob help - Could not select database

Unread post by barrydocks »

Please help, this is my first attempt at using nuBuilder and I have fallen at the first hurdle.

I have installed LAMP stack on ubuntu 12.04 along with phpmyadmin
I have imported the sample.sql and created a user with full permisions
I have followed these instructions http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs to create a new site under /var/www/nubuilder/db/testsite

but when I log in with the user credentials I get

Code: Select all

Could not select database
I have also tried using the mysql root log in with the same result.

Any suggestions would be warmly welcome
danpadro
Posts: 8
Joined: Fri Feb 01, 2013 10:56 am

Re: Noob help - Could not select database

Unread post by danpadro »

try to put nuBuilder content from nuBuilder directory , directly in www or, if you want to use from nuBuilder directory, change the correct path in index.php
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Noob help - Could not select database

Unread post by massiws »

barrydocks,
you should have something like this in var/www/nubuilder/index.php:

Code: Select all

<?php header( 'Location: db/testsite/index.php' ); ?>
and in var/www/nubuilder/testsite/index.php:

Code: Select all

<?php
$dbfolder = "testsite";
$build = "production281";
?>
...
<form name='index' method='POST' action='../../<?php echo $build;?>/formlogin.php?x=1&d=db/<?php echo $dbfolder;?>'>
...
Also, be sure to set correct values in var/www/nubuilder/testsite/config.php

Max
barrydocks
Posts: 18
Joined: Wed Dec 18, 2013 4:44 pm

Re: Noob help - Could not select database

Unread post by barrydocks »

So I have had another go with the same result. I have copied the contents of /var/www/nubuilder/sample to /var/www/nubuilder/mypms and changed the owner to www-data. I have copied the sample database to a mypms database and created a user "mypms" with a password "orange".

Here is the contents of /var/www/nubuilder/index.php

Code: Select all

<html>
<head>
        <title>Choose a nuBuilder Site</title>
</head>
<body>
Login to <a href="db/sample">Sample</a><br>
Login to <a href="db/samplenufinancial">Sample nuFinancial</a><br>
</body>
</html>
Here is the contents of /var/www/nubuilder/db/mypms/index.php

Code: Select all

<?php
$dbfolder = "mypms";
$nameText = "mypms";
$build    = "productionnu2";
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<style type='text/css'>


* {
	margin: 0px;
	padding: 0px;
}

html {
	width: 100%;
	height: 100%;
}

body {
	background-image: url('nuBuilder-Logo.png');
	background-repeat: no-repeat;
	background-attachment: scroll;
	background-position: center 60px; 
	margin: 0px;
	padding: 0px;
	border: 0px;
	min-width: 100%;
	min-height: 100%;
	width: 100%;
	height: 100%;
	font-family: tahoma, verdana, helvetica
}

#main {


	width: 800px;
	height: 100%;
	left: 50%;
	margin: 0px;
	margin-left: -400px;
	position: absolute;
	padding: 0px;

}


#sitename {
        margin: 0px;
        padding: 0px;
        position: absolute;
        top: 275px;
        left: 180px;
        text-align: left;
}
#credentials {
	margin: 0px;
	padding: 0px;
	position: absolute;
	top: 305px;
	left: 180px;
	text-align: right;
}
#credentials input {
	margin-bottom: 5px;
	vertical-align: top;
}
.button {
	background-color: orange;
}

</style>


<body onload='document.forms[0]["u"].focus()'>
<div id="main">
<form name='index' method='POST' action='../../<?php echo $build;?>/formlogin.php?x=1&d=db/<?php echo $dbfolder;?>'>
<div id="sitename">
	<p>Site Name: <?php echo $nameText;?></p>
</div>
<div id="credentials">
	<p>Username <input type='text' name='u'><br />
	Password <input type='password' name='p'><br />
	<input type='submit' class="button" value="Login" />
</div>
</form>
</div>


</body>
</html>
Here is the contents of /var/www/nubuilder/db/mypms/config.php:

Code: Select all

<?php

$DBHost                 = "127.0.0.1";
$DBName                 = "mypms";
$DBUser                 = "mypms";
$DBPassword             = "orange";
$DBGlobeadminPassword   = "globeadmin";
//$DBSiteGlobeadminPasswordOnly = true;

$_SESSION['nu_search_title']       = '';
$_SESSION['nu_sfo_add_title']      = '';
$_SESSION['nu_sfo_print_title']    = '';
$_SESSION['nu_sfo_save_title']     = '';
$_SESSION['nu_sfo_clone_title']    = '';
$_SESSION['nu_sfo_close_title']    = '';
$_SESSION['nu_sfo_delete_title']   = '';
$_SESSION['nu_delete_yes_title']   = '';
$_SESSION['nu_delete_no_title']    = '';

?>
Still can't connect :(
barrydocks
Posts: 18
Joined: Wed Dec 18, 2013 4:44 pm

Re: Noob help - Could not select database

Unread post by barrydocks »

Some progress, I have changed the mysql user from mypms@% to mypms@localhost and I am now able to login with globeadmin as a username and globeadmin as the password.

Problem is now that I am faced with this error:

Code: Select all

Error
An error has occurred while running this query. Please contact technical support and quote error reference: cb3beb9.

The following information is only provided for users logged on as globeadmin.
SQL

SELECT ``.* FROM `` WHERE = '-1'
Transaction

No Transaction.
Error

0:
URL

http://
Session variables

    Post Variables
    Get variables
    Cookies
    Globals
    Stack Trace

Post variables
Top

Array
(
)

Get variables
Top

Array
(
    [x] => 1
    [f] => index
    [r] => -1
    [dir] => db/mypms
    [ses] => 152bef2ca1d246
    [fly] => 
)

Cookies
Top

Array
(
    [PHPSESSID] => vkk7ea266qo77ko4rk2fj7atn5
    [security_checkdbsample] => 152bef0ed041e9
    [security_checkdbmypms] => 152bef2ca1d246
    [nuCdbmypms] => 1
)

Globals
Top

Array
(
    [GLOBALS] => Array
 *RECURSION*
    [_POST] => Array
        (
        )

    [_GET] => Array
        (
            [x] => 1
            [f] => index
            [r] => -1
            [dir] => db/mypms
            [ses] => 152bef2ca1d246
            [fly] => 
        )

    [_COOKIE] => Array
        (
            [PHPSESSID] => vkk7ea266qo77ko4rk2fj7atn5
            [security_checkdbsample] => 152bef0ed041e9
            [security_checkdbmypms] => 152bef2ca1d246
            [nuCdbmypms] => 1
        )

    [_FILES] => Array
        (
        )

    [_SESSION] => Array
        (
            [nu_search_title] => 
            [nu_sfo_add_title] => 
            [nu_sfo_print_title] => 
            [nu_sfo_save_title] => 
            [nu_sfo_clone_title] => 
            [nu_sfo_close_title] => 
            [nu_sfo_delete_title] => 
            [nu_delete_yes_title] => 
            [nu_delete_no_title] => 
            [security_checkdbsample] => 152bef0ed041e9
            [ses] => 152bef2ca1d246
            [nu_session] => 152bef2ca1d246
            [nu_access_level] => globeadmin
            [nu_user_id] => globeadmin
            [nu_user_group] => globeadmin
            [nu_last_login] => 1388245706
            [nuHistory152bef0ee75ada] => Array
                (
                    [0] => 
                )

            [nuHistory152bef13ee1516] => Array
                (
                    [0] => 
                )

            [nuHistory152bef14032976] => Array
                (
                    [0] => 
                )

            [security_checkdbmypms] => 152bef2ca1d246
        )

    [QueryList] => Array
        (
        )

    [nuRunQuery] => 20
    [formValues] => Array
        (
            [0] => xxx
        )

    [deleteTT] => Array
        (
        )

    [insertSV] => Array
        (
        )

    [dir] => db/mypms
    [ses] => 152bef2ca1d246
    [f] => index
    [r] => -1
    [c] => 
    [delete] => 
    [DBHost] => 127.0.0.1
    [DBName] => mypms
    [DBUser] => mypms
    [DBPassword] => orange
    [DBGlobeadminPassword] => globeadmin
    [DBSiteGlobeadminPasswordOnly] => 1
    [_SERVER] => Array
        (
            [HTTP_HOST] => 127.0.0.1
            [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0
            [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            [HTTP_ACCEPT_LANGUAGE] => en-gb,en;q=0.5
            [HTTP_ACCEPT_ENCODING] => gzip, deflate
            [HTTP_COOKIE] => PHPSESSID=vkk7ea266qo77ko4rk2fj7atn5; security_checkdbsample=152bef0ed041e9; security_checkdbmypms=152bef2ca1d246; nuCdbmypms=1
            [HTTP_CONNECTION] => keep-alive
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [SERVER_SIGNATURE] => <address>Apache/2.2.22 (Ubuntu) Server at 127.0.0.1 Port 80</address>

            [SERVER_SOFTWARE] => Apache/2.2.22 (Ubuntu)
            [SERVER_NAME] => 127.0.0.1
            [SERVER_ADDR] => 127.0.0.1
            [SERVER_PORT] => 80
            [REMOTE_ADDR] => 127.0.0.1
            [DOCUMENT_ROOT] => /var/www
            [SERVER_ADMIN] => webmaster@localhost
            [SCRIPT_FILENAME] => /var/www/nubuilder/productionnu2/form.php
            [REMOTE_PORT] => 33031
            [GATEWAY_INTERFACE] => CGI/1.1
            [SERVER_PROTOCOL] => HTTP/1.1
            [REQUEST_METHOD] => GET
            [QUERY_STRING] => x=1&f=index&r=-1&dir=db/mypms&ses=152bef2ca1d246
            [REQUEST_URI] => /nubuilder/productionnu2/form.php?x=1&f=index&r=-1&dir=db/mypms&ses=152bef2ca1d246
            [SCRIPT_NAME] => /nubuilder/productionnu2/form.php
            [PHP_SELF] => /nubuilder/productionnu2/form.php
            [REQUEST_TIME] => 1388245706
        )

    [nuEvent] => 
    [NUGlobeadminPassword] => secret
    [NUPHPExecutable] => /usr/bin/php
    [NUMailMethod] => smtp
    [NUSMTPHost] => 127.0.0.1
    [NUSMTPUsername] => username
    [NUSMTPPassword] => password
    [nuQueriesRun] => 20
    [NUExtraHTTPHeaders] => 
    [nuSetup] => 
    [setup] => 
    [sVariables] => Array
        (
            [#zzsys_session_id#] => 152bef2ca1d246
            [#access_level#] => globeadmin
            [#zzsys_user_id#] => globeadmin
            [#zzsys_user_group_name#] => globeadmin
            [#session_id#] => 
            [#ses#] => 
            [#session_parameter#] => 
        )

    [actualFormID] => index
    [runActivity] => 
    [tempObjectTable] => ___nu152bef2ca3b497___
    [nuForm] => Form Object
        (
            [form] => 
            [setup] => 
            [formTabs] => Array
                (
                )

            [formTabNames] => Array
                (
                )

            [recordValues] => Array
                (
                )

            [arrayOfHashVariables] => Array
                (
                )

            [formObjects:Form:private] => Array
                (
                )

            [textObjects] => Array
                (
                )

            [subformNames] => Array
                (
                )

            [subformTabs] => Array
                (
                )

            [jsFunctions:Form:private] => Array
                (
                )

            [inarrayFunctions] => Array
                (
                )

            [globalValue] => Array
                (
                )

            [customDirectory] => db/mypms
            [session] => 152bef2ca1d246
            [pageHeader] => 
            [actionButtonsHTML] => 
            [CRLF] => 

            [TAB] =>     
            [formID] => index
            [recordID] => -1
            [subformID:Form:private] => 
            [formsessionID] => 152bef2cb3ad41
            [styleSheet:Form:private] => 
            [startTime:Form:private] => 1388245707.2409
            [tabHTML:Form:private] => 
            [logon:Form:private] => 
            [delete:Form:private] => 
            [cloning] => 
            [access_level] => globeadmin
            [zzsys_user_id] => globeadmin
            [zzsys_user_login_id] => 
            [inString] => 
            [objectTableName] => ___nu152bef2ca3b497___
            [runActivity] => 
            [session_id] => 152bef2ca1d246
            [zzsys_user_group_name] => globeadmin
        )

    [hasFailed] => 1
)

Stack Trace
Top

Array
(
    [0] => Array
        (
            [file] => /var/www/nubuilder/productionnu2/dbfunctions.php
            [line] => 78
            [function] => handleQueryError
            [args] => Array
                (
                    [0] => SELECT ``.* FROM `` WHERE  = '-1'
                    [1] => 0
                    [2] => 
                    [3] => 
                )

        )

    [1] => Array
        (
            [file] => /var/www/nubuilder/db/mypms/database.php
            [line] => 26
            [function] => dbQuery
            [args] => Array
                (
                    [0] => 127.0.0.1
                    [1] => mypms
                    [2] => mypms
                    [3] => orange
                    [4] => SELECT ``.* FROM `` WHERE  = '-1'
                    [5] => 1
                )

        )

    [2] => Array
        (
            [file] => /var/www/nubuilder/productionnu2/form.php
            [line] => 190
            [function] => nuRunQuery
            [args] => Array
                (
                    [0] => SELECT ``.* FROM `` WHERE  = '-1'
                )

        )

    [3] => Array
        (
            [file] => /var/www/nubuilder/productionnu2/form.php
            [line] => 91
            [function] => loadAfterConstruct
            [class] => Form
            [object] => Form Object
                (
                    [form] => 
                    [setup] => 
                    [formTabs] => Array
                        (
                        )

                    [formTabNames] => Array
                        (
                        )

                    [recordValues] => Array
                        (
                        )

                    [arrayOfHashVariables] => Array
                        (
                        )

                    [formObjects:Form:private] => Array
                        (
                        )

                    [textObjects] => Array
                        (
                        )

                    [subformNames] => Array
                        (
                        )

                    [subformTabs] => Array
                        (
                        )

                    [jsFunctions:Form:private] => Array
                        (
                        )

                    [inarrayFunctions] => Array
                        (
                        )

                    [globalValue] => Array
                        (
                        )

                    [customDirectory] => db/mypms
                    [session] => 152bef2ca1d246
                    [pageHeader] => 
                    [actionButtonsHTML] => 
                    [CRLF] => 

                    [TAB] =>     
                    [formID] => index
                    [recordID] => -1
                    [subformID:Form:private] => 
                    [formsessionID] => 152bef2cb3ad41
                    [styleSheet:Form:private] => 
                    [startTime:Form:private] => 1388245707.2409
                    [tabHTML:Form:private] => 
                    [logon:Form:private] => 
                    [delete:Form:private] => 
                    [cloning] => 
                    [access_level] => globeadmin
                    [zzsys_user_id] => globeadmin
                    [zzsys_user_login_id] => 
                    [inString] => 
                    [objectTableName] => ___nu152bef2ca3b497___
                    [runActivity] => 
                    [session_id] => 152bef2ca1d246
                    [zzsys_user_group_name] => globeadmin
                )

            [type] => ->
            [args] => Array
                (
                    [0] => index
                    [1] => -1
                    [2] => 
                    [3] => 
                    [4] => 
                    [5] => db/mypms
                    [6] => 152bef2ca1d246
                    [7] => ___nu152bef2ca3b497___
                    [8] => 
                )

        )

)

Top 
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Noob help - Could not select database

Unread post by massiws »

barrydocks wrote:Problem is now that I am faced with this error...
When you get this error?
Are you sure you imported sample DB? In Linux, open sample.sql file with gedit, comment the first 3 lines and save; open a terminal and:

Code: Select all

# mysql -uroot -pMYSQL ROOT PASSWORD < YOUR WEB ROOT/sample.sql
Can you access your DB in phpmyadmin? Are there all zzsys_* tables?

Here you can find some video tutorial.
barrydocks
Posts: 18
Joined: Wed Dec 18, 2013 4:44 pm

Re: Noob help - Could not select database

Unread post by barrydocks »

Thanks massiws, in the end I just altered all the entries for "sample" to the name of my prject database and everything works :-)
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Noob help - Could not select database

Unread post by massiws »

.
Locked