rawky1976 Posted August 13, 2007 Share Posted August 13, 2007 Hello This: - <?php if(isset($_POST['adduser'])) { include 'config.php'; include 'opendb.php'; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $ext = $_POST['ext']; $bleep = $_POST['bleep']; $exttel = $_POST['exttel']; $email = $_POST['email']; $query = "INSERT INTO users (user_fname, user_sname, user_ext, user_bleep, user_extno, user_email) VALUES ('$firstname', '$lastname', '$ext', '$bleep', '$exttel', '$email')"; mysql_query($query) or die('Error, insert query failed'); include 'closedb.php'; echo "New MySQL user added"; } ?> ...always throws the 'die' error and doesn't complete the INSERT. Is it the code or my config? Mark Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/ Share on other sites More sharing options...
lemmin Posted August 13, 2007 Share Posted August 13, 2007 Have your die function output a mysql_error() to see why it fails. Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/#findComment-322793 Share on other sites More sharing options...
the_oliver Posted August 13, 2007 Share Posted August 13, 2007 I think its your code. Your not giveing it the mySQL connetion details. You need someting like: $oConn = mysql_connect("dbserver","username","password"); Then change mysql_query($query) or die('Error, insert query failed'); to mysql_query($query,$oConn) or die('Error, insert query failed');; Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/#findComment-322795 Share on other sites More sharing options...
rawky1976 Posted August 13, 2007 Author Share Posted August 13, 2007 Thanks, the connection details are in the include files, I've used them before (on IIS 5 & 6). How do I get it to output the errors please? Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/#findComment-322798 Share on other sites More sharing options...
lemmin Posted August 13, 2007 Share Posted August 13, 2007 Change: mysql_query($query) or die('Error, insert query failed'); to: mysql_query($query) or die('Error, insert query failed with error:' . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/#findComment-322800 Share on other sites More sharing options...
rawky1976 Posted August 13, 2007 Author Share Posted August 13, 2007 Thanks! I was trying: - mysql_query($query) or die mysql_error(('Error, insert query failed with error:')); !!! Don't worry, ordered some php books from Amazon last night! Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/#findComment-322803 Share on other sites More sharing options...
rawky1976 Posted August 13, 2007 Author Share Posted August 13, 2007 Would you believe my user_id column was not set as PK or set to auto-increment! Thanks for your help Mark Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/#findComment-322810 Share on other sites More sharing options...
rawky1976 Posted August 13, 2007 Author Share Posted August 13, 2007 Not really a PHP question but after the INSERT and reload it is not retaining all the CSS, it displays left instead of centered and the menus aren't aligned. I thought it was the echo statement at the end of the function but I removed that and it still does it? Quote Link to comment https://forums.phpfreaks.com/topic/64730-solved-is-this-because-of-iis7vista-or-my-code/#findComment-322827 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.