Jump to content

I get an error but i dont know why..


postbil.com

Recommended Posts

Hello phpfreaks..

 

I had some problems with a activation script.. But I do not see the problem.. the error come from the mysql_query(), so I will mean it is my sql code there is the problem but I dont see why...

 

<?php

// Make the connection to the database

    include ('../DB/db.connect.inc.php');

   

 

      $userid = $_GET['userid'];

      $active = $_GET['actcode'];

     

      $query = "INSERT INTO site_user

                (active)

            VALUES

                ($active)

 

        WHERE user_id =" . $userid;

 

             

      mysql_query($query, $conn) or die ('Error: Der er opstået en database fejl, og det var derfor ikke muligt at gennemføre aktiveringen'); // this is the error I get

?>

 

Someone please help me!!

 

postbil.com

Link to comment
Share on other sites

your could should be

 

<?php
// Make the connection to the database
    include ('../DB/db.connect.inc.php');
   

      $userid = $_GET['userid'];
      $active = $_GET['actcode'];
     
      $query = "UPDATE `site_user`
                set `active` =  $active
         WHERE user_id =" . $userid;

               
      mysql_query($query, $conn) or die ('Error: Der er opstået en database fejl, og det var derfor ikke muligt at gennemføre aktiveringen'); // this is the error I get
?> 

Link to comment
Share on other sites

Okay .. The error is just a message on a it was not possible to send data to the database.

The idea behind the code was that I would make "active" to 1, and then use $ userid to ensure that it is the right user who is enabled.

 

You still don't get it do you? Without giving us the proper information your wasting everyones time (yours included).

 

While rajivgonsalves is on to something it still may have nothing to do with your error but we wouldn't know because you haven't told us what it is. WE ARE NOT mind readers.

Link to comment
Share on other sites

mysql_query($query, $conn) or die ('Error: Der er opstået en database fejl, og det var derfor ikke muligt at gennemføre aktiveringen<br />MySQL Error:' . mysql_error() ); // this is the error I get

 

Replace that code as it will provide you with the error MySQL is returning.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

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