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'm new to web development, and for the college thesis I'm going to create an online system that uses a database. My question is: how should one create a database?
a) Using PHP such as:
<?php
$servername = "host_name";
$username = "user_name";
$password = "password";
$dbname = "dbname";
$link = connectToMySql($servername, $username, $password) or die( " Unable to connect to server ");
$query = "CREATE DATABASE IF NOT EXISTS $dbname";
if (executeSQLQuery($query))
{
echo "Database <b>$dbname</b> created successfully <br />";
}
else
{
echo "Error in creating database: <br/><br/>". launchError();
}
?>
b) Or using phpMyAdmin (creating manually database and tables)?
Which approach is the best? Which one should be used and why (Advantages, disadvantages)?
For a thesis, it hardly matters.
For normal development, if you are the only user of your software, then it is probably easiest to maintain it in a maintenance tool like PHPMyAdmin, because you can create and update it in a very visual way.
Creating it in software is especially useful as an installation feature. Some common software, like Wordpress and MediaWiki create their own database and even have smart scripts that update the database structure when a new version has additional requirements. But building something like that is also tricky and time-consuming, so unless you want to have such an installer feature, it is probably not worth the effort.
Also note, that for proper database management, you'll want to have different users with different rights. You may want to make your software connect using database credentials that only have rights to edit data (not structure), and only connect using a more powerful user if you have to update the database structure. But that probably also doesn't apply for a thesis, unless it is specifically about access control management.
Related
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 6 years ago.
Improve this question
I have a website. I'm using MySQL Workbench 6.3. I have MySQL installed.
How hard can it be to send and receive data from this database, from the website? I don't know php yet, but I can learn it if that's necessary.
What I want is simply to, for example, have a form on a website which sends it's information to the database. I understand about the columns in the database, and I've created a database table thing on the MySQL workbench, but I don't know how to host this database, or how to access it from my website.
Even just some good links would be helpful, as I haven't found any.
You actually can Google but you can go try to learn at the links below:
w3schools.com
php.net
And you need to learn sql too. For sql, this links can help you:
w3schools.com
tutorialspoint.com
Hope this links will make your job easier.
And a quick tutorial by me:
mysql_* commands are no longer available. Use mysqli or PDO.
Connecting To Your Database:
Using mysqli
<?php
$conn = new mysqli($servername, $username, $password);
?>
Using PDO:
<?php
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
?>
Hope everything will work fine, happy coding!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is it possible for someone to hack a MySQL database by knowing (only) the username and the password for my database.
There is no phpMyAdmin to login from it and there is no way to do any SQL injection in the website (because I'm using Laravel).
Your question is quite similar to "Is it possible to break into my house with my door key?"
It depends on few things:
Which IP is your MySQL listening to? In your MySQL Config File bind-address, find the value.
For that specific username, did you enabled remote access for that user in MySQL?
Any Firewall rules to restrict remote MySQL connections?
By the way, using Laravel or any other frameworks does NOT guarantee anything on protecting from SQL injection. People can easily write a SQL injection vulnerable web page under any framework if they want.
You should:
Implement your database related code properly and follow the instruction in the documentation.
Set your MySQL users and their privilege in the right way.
Do not expose your database to the public is recommended.
Last thing for your update, if you want to share your database with others. Not a big problem if you set the privilege correctly.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have created PHP application for company. and company also have ERP. I want to connect my application with ERP. so that employee can login by company's website which is in PHP and can access functionality of ERP. How do I proceed ? Please guide. and also provide some links for development
since you have very broad question and just considering that you need to get information from ERP system on your PHP portal. and i also considering you are the administrator of ERP as well.
ERP (Enterprise Resource Planning) is being provided by different vendors and Major includes Epicor,Infor,Oracle and SAP. All vendors are using Different databases. So for integration you must need to know what database is being used. For Such applications mostly used databases are SQL and Oracle .
After you get the type of database , next step is to know the schema or specific table to get the information. Now Suppose you are getting information from oracle. you can use below connection string.
$dbc = new PDO('oci:dbname=Serveraddress/orcl;charset=CL8MSWIN1251', 'username', 'password');
you can also use the web services like SOAP or REST which ever supported by your ERP to fetch information.
For Specially SAP below link can help you
Intgration of PHP & SAP
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 have a website that I've created using PHP, Mysql, and other (HTML, CSS, etc) and I'm looking into converting the website into a native Iphone App for the app store. I know quite a bit of Objective-C and have used X-code for a couple years but I'm confused about one aspect of it. I've never worked with databases from an app. The database that we have set up is just a good old fashion PHP and Mysql that we connect to. It holds all of the site's users and other information.
Therefore, what should I do about accessing this database on the phone? Is there a way to use Mysql or is there something else that I can use that would interact with the database separately? I know there is SQLite but does that work with Mysql or not?
Any tutorials or guides you could point me to also would be great. Thanks.
The simple answer is: don't connect an iOS app directly to the database. Think about it: you'd be embedding a username and password somewhere in the app's code, which some nefarious user will find a way to extract and exploit.
Much better way to do it: create a simple API on your website, then pass requests from mobile users through the API. Then your server handles all database connections, authentication of users, and so on, and you haven't put your database credentials in the hands of lots of unknown individuals.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I've pinged to make sure I am connected to the server and I can obviously read it for reasons I don't need to go into. All of my DB calls look something like this:
$sql="insert into shoeboxvideos set vidid='$vidid', email='$email' ";
$result = mysql_query($sql);
And worst of all, before I moved to this new server everything worked just fine. I don't understand what could be blocking us from editing the Database. Is it possible that there are DB settings somewhere in the admin?
are you sure you're on the moved db? and not still connected to the old db?
have you confirmed that connecting to db and executing query goes ok? mysql_connect(...) or die('failed connect'); and mysql_query(...) or die(mysql_error()); (change syntax if you are using PDO or mysqli.)
have you checked mysql user permissions of the mysql user that is logging in? It can be that the user doesn't exist on the new location. Or even exists twice, with less rights granted on the one with the host that you are connecting with