Cazpa.com PHP Developer & Website Designer

14Jan/100

Add – Update & Delete records from a MySQL database using PHP

The purpose of this PHP script is to show you how to connect to a MySql database, retrive records, add records,  update them and delete them, this script also uses Javascript to query the database to cut down on page refreshes.

I will add a full explenation very soon but for now you can download the example PHP script to see how you could complete the tasks.

Any questions then please leave a comment and I will get back to you.

http://cazpa.com/wp-content/plugins/downloads-manager/img/icons/winzip.gif download: Add-Update-Delete-PHP-Mysql (5.51KB)
added: 14/01/2010
clicks: 436
description:

24Oct/091

Update Twitter From Your Website (HTML form)

Here is a small script that allows you to post updates to twitter from a simple HTML form on your website.

First thing you need is the form, this is a simple HTML form, very easy to add to your existing website:

<form name="form1" method="post" action="twitter.php">

Now for the script, just copy and paste this code into a blank document and save as twitter.php, you can name it what you want just remember to change the form action variable:

$username = ($_POST['t_user']);
$password = ($_POST['t_pass']);
$message = ($_POST['t_update']);

$url = 'http://twitter.com/statuses/update.xml';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($buffer)) {
    echo 'message';
} else {
    echo 'success';
}

And that is it, if you want to set the username and password then all you need to do is change:

$username = ($_POST['t_user']);
$password = ($_POST['t_pass']);

// to

$username = 'yourusername';
$password = 'yourpassword';

http://cazpa.com/wp-content/plugins/downloads-manager/img/icons/winzip.gif download: Web To Twitter (957B)
added: 24/10/2009
clicks: 137
description: Post updates to Twitter from your website (Script)

   
Powered by WordPress Lab