PHP/MYSQL ..what the hell is wrong here...
| From: | Chris Cocuzzo | Date: | Tue, 25 Dec 2001 08:18:10 +0000 |
| Subject: | PHP/MYSQL ..what the hell is wrong here... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78708@lists.php.net to get a copy of this message | ||
hey-
Ok so my plan with this stuff is to enter in a few fields for a gig into the database.
Here's the code for the page where i enter the info in:
<form action="/lib/submit.php" method="POST" target="_new">
Date: <input type="text" name="date"
size="30"><br>
Location: <input type="text" name="location"
size="30"><br>
Venue: <input type="text" name="venue"
size="30"><br>
Info:<br>
<textarea name="info"></textarea>
<input type="hidden" name="table" value="gigs">
<input type="submit" value="submit">
</form>
here's the submit.php page ..which is the one that I suspect is giving me problems:
case 'gigs':
print "$date<br>";
$date = strtotime($date);
print "$date<br>";
$query = "INSERT INTO gigs
VALUES('0','$date','$location','$venue','$info')";
break;
I'm almost positive it has nothing to do with the quotes, because it never ran into a problem
before with the quotes in the SQL statement. is there something wrong with that line that has the
strtotime() function in it? ...Both of the print statements there are printing the correct values.
here's the database description of that table:
+----------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------------+------+-----+---------+----------------+
| showid | mediumint(5) | | PRI | NULL | auto_increment |
| date | timestamp(10) | YES | | NULL | |
| location | varchar(40) | | | | |
| venue | varchar(40) | | | | |
| info | mediumtext | | | | |
+----------+---------------+------+-----+---------+----------------+
and when i query it i get this:
+--------+------------+-----------------+--------------+-------+
| showid | date | location | venue | info |
+--------+------------+-----------------+--------------+-------+
| 1 | 0000000000 | Framingham, Ma. | Denison Hall | -TBA- |
+--------+------------+-----------------+--------------+-------+
the date field is empty, but it should be filled. When i enter in the value for the date field in
the form, I enter it as such: Jan 11, 2002 .. I tested this beforehand and it worked. What the hell
is wrong??
-chris