/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php //mysql connect //connect to db and insert $query = "INSERT INTO contacts VALUES ('','John','Smith','01234 567890','00112 334455','01234 567891','[email protected]','http://www.gowansnet.com')"; echo "Record added"; //mysql select query if(!$result) { } echo "Row data: " . $row['id'] . " - " . $row['name']; } //alternative select query $query="SELECT * FROM contacts"; echo "Data displayed"; //mysql update $query = "UPDATE contacts SET first = '$ud_first', last = '$ud_last', phone = '$ud_phone', mobile = '$ud_mobile', fax = '$ud_fax', email = '$ud_email', web = '$ud_web' WHERE id = '$ud_id'"; echo "Record Updated"; //delete contact $query = "DELETE FROM contacts WHERE id='$id'"; echo "Record Deleted"; ?>