By koienrobin
I am trying to save some data from my website to my database. This works on both my local machine and thorugh my student host:
some php…
$connection = @mysqli_connect('localhost', 'username', 'pw')
or die (mysqli_error());
mysqli_select_db($connection, 'mydatabase')
or die (mysqli_error());
some php…
I have followed all the instruction from: https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu
and
https://www.digitalocean.com/community/articles/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04
So i have php and mysql installed and I can access my databases through phpmyadmin
I still can’t save data to the database through my website using the script listed above.
Any idea what might be the problem?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Your code doesnt show any form of INSERT query. The code you simply provided just connects and selects the db and if theres an error to “die” with the error message showing.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.