Find any tutorial you need, from website design to Advanced coding, we will find the best tutorials for you.

Mysql and Php basics

This list is a collection of useful php and mysql functions, which I always find myself looking for when building a website or working on a php and mysql project.

Connect to Mysql Database

$con = mysql_connect("localhost","name","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con);

Insert Information

mysql_query("INSERT INTO example (name, uid, example) VALUES ('Joe', 'abc123', 'test')");

Update Information

mysql_query("UPDATE example SET id = '36' WHERE name = 'Joe' AND uid = 'abc123'");

Get Information

$result = mysql_query("SELECT * FROM example WHERE name='Joe'"); while($row = mysql_fetch_array($result)) { echo $row['name'] . " " . $row['uid']; }

Delete Information

mysql_query("DELETE FROM Persons WHERE LastName='Griffin'");

This is more of a collection of code rather than a tutorial, but if you are using php you can now access a mysql database and modify the information.

Related

No comments yet

Add a comment
  • Add your own comment below!

Please login to comment

Click here to login