1.I have a MySql DB called 'scheduled' and table called 'messagelist'.
The first field msgID is int(10). Rest all are varchar(20).
2.broadcasttext.php
<form name="frmText" method="post" action="addScheduled.php">
3.addScheduled.php
<?php
$host="localhost"; // Host name
$username="scheduledUudk8"; // Mysql username
$password="KeszRXqXo.)-"; // Mysql password
$db_name="scheduled"; // Database name
$tbl_name="messagelist"; // Table name
$i = 0;
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$result = mysql_query("SELECT * FROM messagelist");
while($row = mysql_fetch_array($result))
{
$i = $i + 1;
}
// Get values from form
$txtText=$_POST['txtText'];
$sqlDate=$_POST['sqlDate'];
$sqlTime=$_POST['sqlTime'];
$chkDir=$_POST['chkDir'];
if($chkDir == "All")
{
$reach = "64,000";
}
// Insert data into mysql
$sql="INSERT INTO $tbl_name(msgID,msg,msgDate,msgTime,msgDir,msgReach)VALUES('$i', '$txtText', '$sqlDate',' $sqlTime', '$chkDir', '$reach')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='index.php#!scheduled'>Back to main page</a>";
}
else {
echo "ERROR";
}
?>
<?php
// close connection
mysql_close();
?>
4.Output Table
No. Message Message Date Message Time Message Group Message Reach
id0
Every field remains blank.. one column is updated and no error message is shown. Please help.
Thankyou :)