Jump to content

Recommended Posts

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

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.

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?

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.