Skip to content

Instantly share code, notes, and snippets.

@GeeH
Created August 4, 2014 09:26
Show Gist options
  • Save GeeH/e7a2b23f268194a654dd to your computer and use it in GitHub Desktop.
Save GeeH/e7a2b23f268194a654dd to your computer and use it in GitHub Desktop.
<?php
// Clevertext db update script.
// Gary Hockin .. gary --at-- garyhockin --dot-- co --dot-- uk
// June 2006
// input stuff
// extract the GET values into variables
extract($_GET);
// connect to database
// obviously remove this if you have a globals file or persistant connection
$host = 'localhost';
$uname = 'test';
$pass = 'test';
$db = 'test';
$dbconn = mysql_connect($host, $uname, $pass);
mysql_select_db($db);
$val = htmlentities($val);
// do the db update
$q = 'UPDATE `'.$table.'` SET `'.$field.'` = \''.$val.'\' WHERE `'.$pk.'` = \''.$pkval.'\'';
$r = mysql_query($q) or die(mysql_error());
$result = mysql_query($q);
// output
header('Content-Type: text/xml');
header('Pragma: no-cache');
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
echo "<data>\n";
echo "<field id='field' name='".$field."' value='".$val."' error='".$error."' />\n";
echo "</data>\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment