Jump to content

aFk

Member
  • Posts

    9
  • Joined

  • Last visited

aFk's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. aFk

    Newb needing assistance

    Thanks again Tino, I will play with this before I ask anymore questions.
  2. aFk

    Newb needing assistance

    Hey isn't there a way to write the same thing doing switch statment? to avoid all the if else statments?
  3. aFk

    Newb needing assistance

    Thanks for the great info Tino. I will remember that sir
  4. aFk

    Newb needing assistance

    Thanks for the reply bud. I figured it out and here's what I got. $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("stats", $con); if ($score_compare[1]==$score_conmpare[2]) { mysql_query("INSERT INTO `standings` (draw) VALUES ('".$draw."')"); mysql_query ("INSERT INTO `standings` (team1) VALUES ('".$team."')"); mysql_query ("INSERT INTO `standings` (team2) VALUES ('".$team2."')"); } elseif ($score_compare[1]>$score_conmpare[2]) { mysql_query("INSERT INTO `standings` (wins) VALUES ('".$wins."')"); mysql_query ("INSERT INTO `standings` (team1) VALUES ('".$team."')"); mysql_query ("INSERT INTO `standings` (loss) VALUES ('".$loss."')"); mysql_query ("INSERT INTO `standings` (team2) VALUES ('".$loss."')"); } else { if ($score_compare[1]<$score_conmpare[2]) mysql_query ("INSERT INTO `standings` (loss) VALUES ('".$loss."')"); mysql_query ("INSERT INTO `standings` (team1) VALUES ('".$team."')"); mysql_query("INSERT INTO `standings` (wins) VALUES ('".$wins."')"); mysql_query ("INSERT INTO `standings` (team2) VALUES ('".$team2."')"); } mysql_close($con); There's probably a easier way of doing this. But I'm still learning.
  5. aFk

    Different question

    Hard to be patient when stuck on a syntax. I mean, my other post has be patiently waiting for a reply for 2 days. It's ok I joined a different forum no biggie. Thanks
  6. aFk

    Different question

    sigh never mind thanks for the help 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.
  7. aFk

    Different question

    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
  8. aFk

    Newb needing assistance

    Am I one of the lucky few who don't get a reply? lol
×
×
  • Create New...