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
https://forums.phpfreaks.com/topic/223875-need-help-with-if-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.