The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
I realize this is really basic, I'm learning as I go.
I'm trying to make a simple page to add data to a database. The database is named 'php', and I have a table with: id (int, auto increment) and text fields named lastname, firstname, org, cdate and notes. My form input is a quick table, the inputs look like this: Code:
<td width="100">Lastname</td> <td><input name="lastname" type="text" id="lastname"></td> I've defined these variables to grab the post data: Code:
$lastname = $_POST['lastname']; $firstname = $_POST['firstname']; $org = $_POST['org']; $cdate = $_POST['cdate']; $notes = $_POST['notes']; Code:
// Add the info
$query = "INSERT INTO users (lastname, firstname, org, cdate, notes) VALUES ('$lastname', '$firstname', '$org', '$cdate', '$notes')";
mysql_query($query) or die('Error, insert query failed');
I'm reading and googling, but right now I'm kind of stuck at this point and not sure what I'm missing. If anyone could enlighten me, I'd really appreciate it.
|
|
#2
|
|||
|
|||
|
Replace the query line with this to see the error being generated:
Code:
mysql_query($query) or die(mysql_error()); |
|
#3
|
|||
|
|||
|
Aah, thanks.
![]() Quote:
Edit: Woohoo! I got it! ![]() That error is because I'm going by the O'Reilly book and was flushing privelages after the submit. Honestly I don't even know what it does (hehehe) so I dumped it and it works now. ![]() Thank you very much!
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|