Jump to content

Different question


aFk

Recommended Posts

Since nobody could answer my first question, probably cause it was impossible to explain fine lol.

 

Yes, I'm very new to PHP but perhaps someone could explain why this isn't inserting into my table on msql.

 

<?php

$wins=$_POST['winner'];
$loss=$_POST['loser'];
$draw=('1');
$streak=$_POST[''];
$team1=$_POST['select2'];
$team2=$_POST['select'];

$con = mysql_connect("localhost","root","");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }

mysql_select_db("stats", $con);
if ($wins==$loss){
mysql_query("INSERT INTO standings (draw,) VALUES (".$draw.")");}
else echo "false!";
mysql_close($con);
?>

 

I have a form with the name "winner" && "loser"

Basically I have it comparing fine, if the score is a draw I want the variable $wins && $loss to insert into table the result from $draw variable.

 

But it's not inserting into data base? please someone explain! thanks

Edited by aFk
Link to comment
Share on other sites

sigh never mind thanks for the help :rolleyes:

 

correct syntax was

mysql_query("INSERT INTO `standings` (wins) VALUES ('".$wins."')");
mysql_query("INSERT INTO `standings` (draw) VALUES ('".$draw."')");

 

I don't understand why nobody could answer this question.

Edited by aFk
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...