Accessing database from the Desktop

Hi

I need to make some changes to the main file in my Search facilty, and as I will no doubt mess it all up, I decided to download the appropriate files to the Desktop.

But how do I access the server?..

And how do I see how the .php file is getting on as I make changes?..

I have problems!

EDIT

I discovered that I had Xampp installed but cannot see how I can either display a php file that’s on the Desktop, or access the tables in the database.

If you are using XAMPP and want to work with anything containing php files, the application needs to be in the htdocs folder (C:\xampp\htdocs) not the desktop.

2 Likes

Thanks, I’ll try that.

What about the database, do I need to download it to the computer, or Xampp can access it directly in the server?

This is all new to me…

XAMPP includes phpMyAdmin which allows you to access your databases, qim

I managed to get that far but the content of phpmy admin had extensive tables but nothing to do with mine

I assume then that they have to be called also from htdocs’

Thanks

If you’re referring to the information_schema database you want to not mess with that.
MySQL needs that to keep information in that is needed to keep things running.

TBH I don’t know where my databases are stored in phpMyAdmin as it’s handled automatically.

I take it you have a database on your live system? But if you’ve not used phpMyAdmin before perhaps you don’t have a copy of the database on your localhost?

Yes I have copes as I back up regularly.

I just wondered if I could rearrange/rewrite my php file locally without messing about with the currently live one, but it is becoming rather complicated, if at all possible…

W ell,… I’ve transferred my php file and everything else to the htdocs folder, Opened Xampp ControlPanel on the Desktop, but when I press to open the php file from the htdocs folder it simply asks me if I want to open or save and if I choose open it gives me the same box with the same options.

I’ve now moved the Xampp ControlPanel to the htdocs folder but it doesn’rt make any difference.

What do I have to do to see my beautiful php page as if it were live online?

Thanks

EDIT - Incidentally, I read that there may be problems with Windows 10, and the fact that I have the 64-bit version.

Besides I have an old version: v3.2.2

As long as you can FTP download the live sites files and get an export of the database, you should be able to hav both.

For the database, all you should need to do is create the database - not the tables - then import the export file from the live site.

You don’t “press to open” it like you would a file system file.

Go to it in your browser eg.
http://127.0.0.1/myfile.php

Ahhhh… but…

Notice: Undefined index: keyword in C:\xampp\htdocs\Search1.php on line 17

Warning: mysqli::mysqli(): (HY000/1045): Access denied for user ‘pintotou_barros’@‘localhost’ (using password: YES) in C:\xampp\htdocs\Search1.php on line 49
Unable to connect to the mysql server

According to Notepad++ this is line 17

if(strlen(trim($_POST['keyword'])) <= 2)

and this is line 49 with login details hidden

$mysqli = new mysqli('localhost', 'pintotou_*****', ******', '********'); // Connect to the database using MySQLi_* OOP and constants

EDIT

A couple of lines from the log that may be relevant

2016-04-24 10:49:03 2c94 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB’s internal memory allocator.

2016-04-24 10:49:04 11412 [Note] Plugin ‘FEEDBACK’ is disabled.
2016-04-24 10:49:04 11412 [Note] Recovering after a crash using tc.log

You’re able to access the database from the CLI and / or phpMyAdmin ?

Hi

I don’t know what is CLI, but yes I access phpMyAdmin without ant trouble from the live webpages

Try using “root” as the user and “” (that’s an empty string) as the password

Well, now (even before I made the changes you suggested, even if both were there already as an alternative) I don’t get any errors; I simply get “Page cannot be displayed” and I tried various browsers.

back to basics: do I have to make any alteration regarding the folders for css? I transferred the css to the
htdocs also and changed the php to look there rather than in the original folder in the server.

EDIT

One basic question:

If a file is in the server in mysite.com/Folder1/file2.php

Do I enter the url as localhost/file2.php only if I transferred that file to htdocs?

Try keeping it extremely simple for starters just to make sure the server is set up OK.

No PHP code in it at all, but name it something like “test.php” any way.
Put it in the htdocs folder.
Then use your browser to go to
http://127.0.0.1/test.php
and
http://localhost/test.php

<html>
<head>
<title>test page</title>
</head>
<body>
<h1>Test Page</h1>
</body>
</html>

You’ll hopefully see a big “Test Page” meaning the server is set up correctly.

That seems to be the problem. “Page cannot be displayed” whether it has an html or a php extension.

Yesterday, I did this and I got the welcome message. So, I must have changed something along the way…

So, now what?

Thanks

UPDATE

Please, forgive me and ignore what I wrote above. I had not started Xampp… Yes, your file as a php displays TEST PAGE

I tried to open my php file giving it the original server location: localhost/mysite.net/Folder/file.php and then reducing the url to just localhost/file.php and nothing works!

AND MORE

Things are starting to work but when I try the .php file in question i get these errors (which I do not get in the identical file in the live version):

Notice: Undefined index: keyword in C:\xampp\htdocs\Search1.php on line 17

Warning: define() expects at least 2 parameters, 1 given in C:\xampp\htdocs\Search1.php on line 46

Warning: define() expects at least 2 parameters, 1 given in C:\xampp\htdocs\Search1.php on line 47

Warning: mysqli::mysqli(): (HY000/1045): Access denied for user ‘pintotou_barros’@‘localhost’ (using password: YES) in C:\xampp\htdocs\Search1.php on line 49
Unable to connect to the mysql server

ANOTHER UPDATE…

I downloaded a fresh copy of the php, without making any changes and I am back with the fewer earlier errors that stop the page from opening.

Notice: Undefined index: keyword in C:\xampp\htdocs\Search1.php on line 17

Warning: mysqli::mysqli(): (HY000/1045): Access denied for user ‘pintotou_barros’@‘localhost’ (using password: YES) in C:\xampp\htdocs\Search1.php on line 49
Unable to connect to the mysql server

YET AGAIN

mysqli is something recent, I understand; My version of Xampp is a bit old v3.2.2

Could that be an issue?

1 Like

July 2004.

So long before your current version of XAMPP.

I have version 1.7.7 of XAMPP and have had everything using mysqli on it for about eight years (or more).

I did recently upgrade the php and mysql versions within xampp but all the mysqli commands were working with the versions that came with the original XAMPP.

Check that the MySQL user that you’re using to have mysqli connect to the database actually exists and has the correct permissions

Just to expand on that - for a localhost xampp install you either need to create the same user and password as on the live site or use ‘root’ and ‘’ instead.

1 Like