MySQL Forums
Forum List  »  Connector/Node.js

Re: Data Insert Using XML
Posted by: frank
Date: July 22, 2006 08:23PM

<?xml version="1.0"?>

<card id="card2" title="userdetails">

User Details:<br/>

Enter User ID<br/>
<input name="repid"/><br/>
Enter Name<br/>
<input name="name"/><br/>
Enter address<br/>
<input name="address"/><br/>

Enter Telephone Number<br/>
<input name="tel"/><br/>

//old line
//<go method="GET" href="insert.php">
//change to this
<go method="POST" href="insert.php">

<postfield name="customer_id" value="$(repid)"/>
<postfield name="name" value="$(name)"/>
<postfield name="address" value="$(address)"/>
<postfield name="tel" value="$(tel)"/>
Submit Data

header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"\">";

<card id="card2" title="add">


//connect to database server
$connection = mysql_connect("localhost", "user", "userpass")
or die ("connection failed");

//Select the database
$db = mysql_select_db("info", $connection)
or die ("failed to select database <br />\n");

//execute a query
//old script
//$sql = mysql_query("INSERT INTO 'tbl_User' ('repid', 'name', 'address', 'tel') Values ('$_GET[repid]', '$_GET[name]', '$_GET[address]', '$_GET[tel]')") or die("Input failed");

//change to this
$sql = mysql_query("INSERT INTO `tbl_User` (`repid`, `name`, `address`, `tel`) Values ('$_GET[repid]', '$_GET[name]', '$_GET[address]', '$_GET[tel]')") or die("Input failed");

if (!$sql) {
echo "Error cannot Insert record.!!!<BR>"; mysql_error;exit;
}else {
echo "record inserted";

//insert OK inform user

print "<b>Customer Database:</b> <br/>";


Options: ReplyQuote

Written By
January 04, 2006 12:36AM
Re: Data Insert Using XML
July 22, 2006 08:23PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.