not able to update sqlite3 database from PHP page - php

I have installed PAW server in my android board. In PAW server I have added plug-in PHP. from there I am able to open my all php pages.
BUT the problem is I am not able to do INSERT and UPDATE query to my SQlite3 database.
Do not know what is wrong with that..
Anybody can please help me out.

I'm using phpLiteAdmin together with PAW on a daily basis.
So you can try to install phpLiteAdmin just to check if your setup is working.

Ensure that the folder where the SQLite3 database was placed as well as the file have write permissions. Your SELECT statement will work fine but INSERT and UPDATE cannot write to the database.
I also found a link of how you can install/verify the PAW PHP runtime: http://fun2code-blog.blogspot.com/2012/03/paw-runtime-php.html.
Also, have a look at this post I found explaining step by step how to run sqlite from your phone using the correct permissions: http://code.google.com/p/phpliteadmin/issues/detail?id=66

Related

Export database in phpmyadmin

I recently created an Ubuntu Virtual Machine in VirtualBox to create a new project.
So now I created my database in phpmyadmin and I wanted to export my database to keep the data.
The thing is that when I try to export it it throws an error that says that the database couldnt be exported because the origin file couldnt be read.
It may be a php configuration problem (php.ini)? or maybe I created the virtual machine on a wrong way?
Thank you in advance.
For security, if you want to save a database, do a dump on the server directly.
You can take a look to this link : https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb
phpmyadmin is good to have something more visual for an human and manage some little changes. But it's not enough secure to be publish on internet. Becareful about that.

Work in teams using MySql and xampp localhost - can't update the database

Me and some friends are working on a PHP page and we need a MySql database(we need to present the xampp localhost version). Since we will all make edits there we need a way to somehow update our local database with others work when they do it.
I tried to export the database from them and import in my phpmyadmin but for this I have to delete my old database. Isn't there a method to just update it? I mean what can they make to send me a file with an update and how can I import just an update?
I tried to search the answer for hours but couldn't find something specific.
I think the main problem is to synchronize database table changes, not data.
You must read about migrations and don't interact database directly from PHPMyAdmin.
Phinx is the most popular tool in PHP about migrations.
https://phinx.org/

From schema to SQL

I just started out with CakePHP and try to configure a plugin.
The plugin requires a table and contains a schema.php file that contains a class describing the table. From what I gather I have to run a command in my server CLI that will build a table according to this schema.
But my server doesn't seem to have CLI (it's cPanel, and my website is hosted by a good but cheap host). I tried to access the server using Putty, but the connection is aborted when I try.
However, I do have phpMyAdmin where I can run SQL commands. So if I can 'convert' my schema.php in the appropiate SQL commands, I can copy these manually and run them. Is there an easy way to do this?
(I know, the fasted solution is probably to just enter the table by hand. but that would be boring)
Thank you!!
Scipio

CakePHP Update button

I'm building a CakePHP-application that people can install on their hosting.
In the meantime I'm still working on the application, so I want people to be able to update it just by clicking on an update button.
From the moment I write new code in a Controller, make new Components,..., I push it up to the "Source-server" and they click on update then they have to have all this updated code on their server as well.
I was thinking to write an exec (command line) that executes a git pull/fetch but not every hosting has git installed, so that's not the best solution.
Can somebody help me out with that?
Thanks in advance,
AƤron
You need to implement a package system: Your php script will download a zip file that contains all the code from a source, unpack it in a temporary folder, read the meta data file that tells your script what version the plugin or application code is, compare it with the running version, maybe do some security checks like a checksum or if you like to implement that a signature check. When the checks were successful you'll have to replace the existing files with the files from the package.
You could even give the option to do a rollback if you keep the zip of the previous version. Don't forget that your update code needs a way to fire database migrations as well. I would develop a "Package" or "PluginManager" plugin that does all of that. The event system can be used to trigger events when things are installed / deinstalled.
Wordpress does it this way, you might want to look at what it does but I would not recommend to take any of the fugly wordpress code, just use the concept.
Like joomla , wordpress you can create installation package which can check the current version and check server version.
stept2
after compression it create database and file backup
step3 download pakedge from server under a temp directory
step4 replace new lib with older one
step5 if update successfully then delete pkg from temp directory and delete old file backup
step6 if fail replace the site sitebackup

import mysql database to wamp server

I am newbie using php and wamp. I am trying to use a mysql db with the wamp server. I am really confused on what the right steps are. Should I put the sql file in the/www folder or what is the way to go? Thanks a lot
left click wamp -> phpmyadmin
select database then click import (top right)
locate the database and click go.
Via command line: http://www.ibsteam.net/blog/web-development/how-import-sql-file-within-wamp-environment-using-command-line
If you just started I would recommend using phpmyadmin, which comes with wamp. Just run your main localhost www page, select phpmyadmin from there and use import. It's like uploading a file though www, you don't have to place it in any specific directory.

Categories