postbil.com Posted December 21, 2009 Share Posted December 21, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/ Share on other sites More sharing options...
trq Posted December 21, 2009 Share Posted December 21, 2009 And the error is? Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981403 Share on other sites More sharing options...
postbil.com Posted December 21, 2009 Author Share Posted December 21, 2009 I dont know what the problem is but, I get the error from the mysql_error(), Why can that be? Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981409 Share on other sites More sharing options...
rajivgonsalves Posted December 21, 2009 Share Posted December 21, 2009 your trying to insert with a where did you mean to update a user_id ? Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981412 Share on other sites More sharing options...
trq Posted December 21, 2009 Share Posted December 21, 2009 I dont know what the problem is but, I get the error from the mysql_error(), Why can that be? Yeah, and its usually helpful to tell us what that error is. Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981468 Share on other sites More sharing options...
postbil.com Posted December 21, 2009 Author Share Posted December 21, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981480 Share on other sites More sharing options...
rajivgonsalves Posted December 21, 2009 Share Posted December 21, 2009 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981483 Share on other sites More sharing options...
trq Posted December 21, 2009 Share Posted December 21, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981486 Share on other sites More sharing options...
premiso Posted December 21, 2009 Share Posted December 21, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/185859-i-get-an-error-but-i-dont-know-why/#findComment-981664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.