Jump to content

martinhynd

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

martinhynd's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm "helping" a friend make a lot of changes to a website which is full of PHP and has a SQL database. I'm out of my depth here but learning fast. Everything is working now except one thing...the thing I thought would be most simple. What I am trying to to in a PHP file is to read an entry from a database, compare what comes back to a set value and, depending if it matches that value or is different, go to one page or another. In basic language: look at database and get result if result = value then go to page 1 else go to page 2 The code I have in the PHP file at the moment is: $conn=mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD); mysql_select_db(DB_DATABASE) or die("database not available"); $sql="select question from DATABASE where usernumber='$uname'"; $res=mysql_query($sql) or die(mysql_error()); if(mysql_result($res) == Premier) { header("Location: thispage.htm"); } else { header("Location: thatpage.htm"); exit(); } When it says Premier that is the value I am looking for from the database...simply the word Premier. That value is definitely in the database. I've tried it with and without quotes ... with = and == ... etc ... and I've run out of ideas. Can someone put me out of my misery?
×
×
  • 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.