Jump to content

Insert into?


Unseeeen

Recommended Posts

I honestly cant find anything wrong with this script, other than it's extremely insecure (and I'll fix that later [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /])

[code]<?php
$dbconnect = mysql_connect ("localhost", "***", "***") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("***");
$title = $_POST['title'];
$author = $_POST['author'];
$news = $_POST['news'];
$submit = $_POST['submit'];
$time = date('D M j');

if(isset($submit))
$sql = "INSERT INTO news ( id, title, newsbody, username, time ) values ( 'NULL', '$title', '$news', '$author', '$time' )";
mysql_query ($sql) or die(mysql_error();
echo "News successfully submitted!";
} else {
?>[/code]

I get a unexpected ';' error on line 12, and thats

[code]if(isset($submit))[/code]

I'm pretty sure I used isset() correctly?

I was thinking there could be an error on the next line...but I've been trying everything I can think of and it just won't work

Can anyone see what's wrong with it? Thanks.
Link to comment
Share on other sites

v3x: That didn't fix the error.

phpstuck: the reason why I have that if there is because that's not all of it...I made it so if there's a post, basically send it to the database, else post the form. I didn't bother posting the form because I didn't feel it was needed and would just make my post longer.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.