Jump to content

Problem finding my error


Bisa

Recommended Posts

Hi, i figured since I started learning php yesterday im still a newb [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] thus posting in here and not in "php Help".

well, to the problem.

Below is my "savenews.php" a file the user is directed to when trying to add a news item on the blog-site im working with.

[code]Parse error: syntax error, unexpected T_EXIT in savenews.php on line 14[/code]

Is all i get when trying to save my news :( If I remove the if (!mysql_query($sql,$con) and the next line all I get is the Success message but nothing is added to mysql database.

could any1 help me spot the problem?

[code]<?php

include ("databaseconnection.php");    //Connection with the mysql-server.

mysql_select_db("blog", $con);        //Select database to work with.

$date = date('Y-m-d H:i:s');        //Assign time/date.

$sql="INSERT INTO news (subject, text, date) VALUES

('".mysql_real_escape_string($_POST['subject'])."', '".mysql_real_escape_string($_POST['text'])."', '".$date."')";        //Insert subject, text and date into the table news.

if (!mysql_query($sql,$con)
    die('Error: ' . mysql_error());

echo "Success!";

?>[/code]

Link to comment
Share on other sites

Ah =) you got to love the n00b-iness of that [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]

thnx for the help, it sorted my problem (but creating another1, but thats another story)
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.