Creating a setup script like Magento [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have been working on creating a script that can let a program setup itself the way Magento does.
I mean I want to let the user enter his hostname, username, password, database name in the input boxes and then store it somewhere with my files.
I'm exactly getting no idea on I should directly write a code that will create a connect.php file for itself or I should store the values in text or any soe file with some xyz format and then access it each time to make connection to database.
In either case, pls help me out.

You need to do some Store Configuration via your modules system.xml file.
Then you can save the config via Magento Administration and read the configuration in your custom code via Mage:getStoreConfig().
Alan Storm has an excellent tutorial on this, so no need to explain a second time:
http://alanstorm.com/custom_magento_system_configuration

Related

Changing database without changing the whole PHP code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 hours ago.
This post was edited and submitted for review 9 hours ago.
Improve this question
I am exporting my system into a desktop app using PHP Desktop and MySQL. But in order to access it, I still have to start XAMPP.
So I am thinking of converting the database to SQLite.
My question is... Do I need to change my whole code like starting from the scratch or I just need to change the database connection?
Because I already build a GUI. And the only changes I want to make is the database.. I have seen some questions but it's not what I'm looking for.
Please guide me. I am new to this so Im sorry as I don't have enough knowledge in programming..
I haven't tried anything yet.
I am expecting to convert my database without changing the codes of my GUI and function buttons...

Is setting picture names to dates of their creation in the database the best way to name pictures so that they'll be unique? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 11 days ago.
Improve this question
My goal is to add pictures inserted by user into a database. So I'm trying to set their names to the date of their creation. The format is "day.month.year hour.minute.second". But I'm facing the problem that the only one picture is added to the catalog. I'm thinking that the reason why it happens is because the script runs too fast for a second to pass.
And that made me think if this is a good idea to name pictures this way.
I started to assume that maybe I need to use some kind of library to manually add a second to every next picture's name.
But before doing that I decided to go ask somebody more profecient than me in order to undesrtand whether I need to do it this way or maybe there's a better one

How to post a picture from iPhone app (in Swift) to MySQL database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am trying to have users upload on imagine on the app I am developing for a class with Swift and posting it to my MySQL database with PHP but have no idea how to do this. I cannot find any sort of source code online for this and am at a loss for trying this myself.
Does anybody know how to do this?
Though you can technically store images in a MySQL database, it's really bad practice.
Instead, you'll want to store the file in a disk directory. Since this is a broad question with an almost limitless amount of ways you could achieve your goal, here's one suggestion:
Send the file as POST data to your server.
Store the file using PHP.

Application Editable Settings (Best Practices) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am looking for the best way to store the application editable settings (ex: Site Name, Is the site closed? .. etc).
It seems like Database is not the best way because I don't want to use a database just for 2 or 3 settings!
So I went to PHP Array but how can I edit it?!
I have reviewed all questions related to this, but I can not find a useful answer for me.
Note: I don't want to edit the settings manually. I want to edit it by php.
You can store the settings in a config file in form of serialized array or JSON.
Say, reading settings:
$settings = json_decode( file_get_contents('settings.cfg') );
Saving settings back:
file_put_contents('settings.cfg', json_encode($settings) );
Of course the file should be writeable permission wise.
You can store anything you want in this array, even simple objects and complex arrays. And as it is JSON you can edit the file manually, too. If a need arises.

database on php only server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am trying to create a site with a tiny CMS, the problem is that there is only php installed on the server.
The site will mainly consit of two pages the user page and admin page. On the user page there is to be a bunch of checkboxes which when checked will do some math(not the problem I need solved). On the admin page you need to be able to add the checkboxes and assing them their values.
My approach was to read and write to a XML file that contains the data instead of a database. I have run into a lot of problems trying to accomplish this, and I am looking for some good ideas for how it can be done, or alternatives.
Thanks in advance.
You can use sqlite as database engine. This way you also create a portable version of your application and by using PDO you could always switch to another database engine later on.

Categories