Hello,
The given below script is not inserting the following data in the specified database i dont know whats the problem i
i have checked with the mysql configuration and web server config it seems to be okay as other scripts can insert
Here is the php code
[php]<!—
/**
- Created by PhpStorm.
- User: karan
- Date: 13/03/14
- Time: 10:01 AM
*/
—>
Step 1
Please enter the specified information
Number of Items :Name of Raffle :
Slots :
Credit :
SteamID of user :
SteamID of Admin:
<? session_start(); if($_POST) { $no = $_POST['no']; $_SESSION['number'] =$no; $nameofraffle = $_POST['nameofraffle']; $slots = $_POST['slots']; $credits = $_POST['credits']; $usteamid =$_POST['usteamid']; $asteamid =$_POST['asteamid']; $otherinfo =$_POST['otherinfo'];
## MYSQL Connection #
$host = ‘localhost’;
$pass = ‘’;
$user = ‘root’;
$db = ‘test’;
$con=mysqli_connect($host,$user,$pass,$db);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
## Mysql query insert ##
mysqli_query($con,"INSERT INTO tstraffle (nameofraffle,slots,otherinfo,entfees,usteamid,asteamid) VALUES ('$nameofraffle','$slots','$otherinfo','$credits','$usteamid','$asteamid'");
$RID =mysqli_query($con,"SELECT * FROM tstraffle ORDER BY RID DESC LIMIT 1");
$_SESSION['rid'] =$RID;
$host = $_SERVER[‘HTTP_HOST’];
$uri = rtrim(dirname($_SERVER[‘PHP_SELF’]), ‘/\’);
$extra = ‘step1.php’;
header(“Location: http://$host$uri/$extra”);
exit;
}
?>
[/php]
& my mysql structure of the table is this
[code]CREATE TABLE IF NOT EXISTS tstraffle
(
RID
int(11) NOT NULL AUTO_INCREMENT,
nameofraffle
varchar(30) NOT NULL,
slots
varchar(16) DEFAULT NULL,
otherinfo
varchar(225) DEFAULT NULL,
entfees
varchar(32) DEFAULT NULL,
usteamid
varchar(64) NOT NULL,
asteamid
varchar(64) NOT NULL,
PRIMARY KEY (RID
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
[/code]
Some help would be really appreciated
Thanks