Jump to content

Need help with if statement


erik345

Recommended Posts

<?php

 

$con = mysql_connect("127.0.0.1","root","") or die(mysql_error());

 

mysql_select_db("schemalaggare", $con);

 

$date = (isset($_POST["date"])) ? $_POST["date"] : "Inget datum";

$amne = (isset($_POST["amne"])) ? $_POST["amne"] : "Inget ämne valt";

$beskrivning =  (isset($_POST["beskriv"])) ? $_POST["beskriv"] : "Ingen beskrivning";

$betyg =  (isset($_POST["betyg"])) ? $_POST["betyg"] : "Inget betyg";

$sort =  (isset($_POST["sort"])) ? $_POST["sort"] : "Inget arbete";

/* Något fel */

 

if ( (mysql_query("SELECT datum FROM struktur WHERE datum=\"" $_POST["date"]  '"')) == NULL)

{

mysql_query("INSERT INTO struktur(datum, sort, amne, beskrivning, betyg) VALUES ('$date', '$sort', '$amne', '$beskrivning', '$betyg')");}

 

else

{

mysql_query("UPDATE struktur(datum, sort, amne, beskrivning, betyg) VALUES ('$date, '$sort', '$amne', '$beskrivning', '$betyg')");

}

echo 'Inlägg sparat!'

 

?>

 

Can someone please tell my why i get this error?

Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files (x86)\EasyPHP-5.3.3.1\www\Schema projekt\send.php on line 14

 

the if statement is on line 14.

if ( (mysql_query("SELECT datum FROM struktur WHERE datum=\"" $_POST["date"]  '"')) == NULL)

 

what's wrong with it? I really can't see it.

 

Thanks for helping out a beginner.

 

EDIT: Sorry if im posting in the wrong forum.

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.