Log in

View Full Version : Resolved Insert Problem using php...



Rockonmetal
10-04-2008, 06:34 PM
I am having a problem with my user status system. When the user wants to updates their status it goes here. I am having a problem with this though. I want to store all the time/date information along with the message, and user id. I am not getting any errors but it doesn't insert the status into the table?


<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$email = $_SESSION['email'];
$password = $_SESSION['password'];
$id = $_SESSION['id'];
$status = $_POST['status'];
$status = strip_tags($status);
$status = addslashes($status);
$date=getdate();
$con = mysql_connect("localhost","reader","correctpassword");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("markmon_getaband_feeds", $con);

mysql_query("INSERT INTO status (user_id, message, seconds, minutes, hours, mday, wday, mon, year, yday, weekday, month, 0) VALUES ('$id', '$status', '$date[seconds]', '$date[minutes]', '$date[hours]', '$date[mday]', '$date[wday]', '$date[mon]', '$date[year]', '$date[yday]', '$date[weekday]', '$date[month]', '$date[0]')");
?>
<a href="../cp/index.php">Go back to your homepage</a>
</body>
</html>

Thanks upfront

Twey
10-04-2008, 06:59 PM
There is no such column `0`. You don't get any errors because you don't check for them: it's advisable to do mysql_query(...) or die(mysql_error());