INSERT mssql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

INSERT mssql

Post by ol4pr0 »

No errors however it doesn insert anything

Code: Select all

<?
error_reporting(15);
                                                                                                                             
$host = "10.10.10.5:1433";
$usr = "sa";
$pwd = "sa";
$msdb = "tms";
$mstb = "uinfo";
                                                                                                                             
if (isset($_COOKIE['USERNAME'])){
                                                                                                                             
$connect = @mssql_connect($host, $usr, $pwd)
  or die ("Coudnt connect to the mssql, please contact the site administrator immediatly");
                                                                                                                             
$select = @mssql_select_db($msdb, $connect)
   or die ("Couldnt select the ms db, please contact the site administrator immediatly");
                                                                                                                             
$username = "HTTP_COOKIE_VARS['USERNAME']";
$date = ("m.d.y");
                                                                                                                             
if ($username == 'test'){
$email = ('somemail@1.com');
$codigo_operador = '1';
$clave = '2';
                                                                                                                             
$query = "INSERT INTO '$mstb'(username, email, codigo_operador, clave, date) VALUES ($username, $email, $codigo_operador, $clave, $date)";
}
if ($username == 'test2'){
                                                                                                                             
$query = "INSERT INTO '$mstb'(username, email, codigo_operador, clave, date) VALUES ($username, $email, $codigo_operador, $clave, $date)";
}
Any suggestions..
Last edited by ol4pr0 on Fri Apr 02, 2004 11:29 am, edited 1 time in total.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

let me put the complete code as it is... without the cutting out of the nonsens..

Problem before i added the mssql query it would check the user and login.. when all was c00l.. now it wont do anything it does doesnt do anything ( the page. )

It doesn INsert anything and doesnt login. Please advise

Code: Select all

<?
        include_once ("../auth.php");
        include_once ("../authconfig.php");
        include_once ("../check.php");
                                                                                                                             
                                                                                                                             
        $USERNAME = $_COOKIE['USERNAME'];
                                                                                                                             
        echo $username;
        $date = ("m.d.y");
                                                                                                                             
        $host = "10.10.10.5:1433";
        $usr = "sa";
        $pwd = "sa";
        $msdb = "tms";
        $mstb = "upload";
                                                                                                                             
                                                                                                                             
        $connect = @mssql_connect($host, $usr, $pwd)
                or die ("Coudnt connect to the mssql, please contact the site administrator immediatly");
                                                                                                                             
        $select = @mssql_select_db($msdb, $connect)
                or die ("Couldnt select the ms db, please contact the site administrator immediatly");
                                                                                                                             
        if ($username == 'test')
        {
        $email = ('somemail@1.com');
        $codigo_operador = '1';
        $clave = '2';
                                                                                                                             
        $query = "INSERT INTO '$mstb'(username, email, codigo_operador, clave, date)
         VALUES ($username, $email, $codigo_operador, $clave, $date)";
        }

        if ($username == 'test2')
        {
        $email = ('somemail@2.com');
        $codigo_operador = '2';
        $clave = '3';
        $query .= "INSERT INTO '$mstb'(username, email, codigo_operador, clave, date)
        VALUES ($username, $email, $codigo_operador, $clave, $date)";
        }
                                                                                                                             
        if ($username == 'test3')
        {
        $email = ('somemail@3.com');
        $codigo_operador = '3';
        $clave = '4';
        $query .= "INSERT INTO '$mstb'(username, email, codigo_operador, clave, date)
        VALUES ($username, $email, $codigo_operaodr, $clave, $date)";
        }
                                                                                                                             
                                                                                                                             
  if (!($check['team']=='Group 1')
        && !($check['team']=='Group 2')
           &&!($check['team'] =='Group 3'))
  {
    ?>
<html>
 <body>
  <meta http-equiv="refresh" content="5; url=grouppage.php">
        <div align=center valign=middle>
                <font color=black>Checking you're password, Please Wait
                                                                                                                             
                <p>
                <img src=../images/loading.gif>


        <div>
  </body>
</html><?
    exit();
  }
                                                                                                                             
                                                                                                                             
                                                                                                                             
else {
                                                                                                                             
                                                                                                                             
  if (($check['level'] < 4) || ($check['level'] > 6))
  {
                                                                                                                             
                                                                                                                             
?>
<html>
<body>
<meta http-equiv="refresh" content="5; url=levelpage.php">
<div align=center valign=middle>
<font color=000000 size=2>Welcome Administrator<br><p>
Please Wait....
<p>
<img border="0" src=../images/loading.gif>
</div>
</body>
</html><?
    exit();
  }
                                                                                                                             
                                                                                                                             
                                                                                                                             
}
?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Code: Select all

$USERNAME = $_COOKIE['USERNAME'];
                                                                                                                             
        echo $username;
$USERNAME != $username - PHP is case sensitive. Do you have your error reporting set at the highest level (ie. E_ALL)?

Mac
Post Reply