|
-
Nov 26th, 2008, 06:59 PM
#1
Thread Starter
Lively Member
MySQL connection error, or query error?
Here is the code
PHP Code:
<?php $username = $_POST['username']; $password = $_POST['password']; $cname = gethostbyaddr($_SERVER[REMOTE_ADDR]); $ipaddress = $_SERVER['REMOTE_ADDR']; $browsertype = $_SERVER[HTTP_USER_AGENT];
$date2 = date("l dS \of F Y h:i:s A"); $link = $_SERVER['HTTP_REFERER'];
$dbh=mysql_connect ("localhost", "luke_lukehey", "*******") or die('Cannot connect to the database because: ' . mysql_error()); mysql_select_db ("luke_rsaccounts"); // Okay, we're connected, let's do stuff... if(isset($_POST['submit'])) { $query = "INSERT INTO users ( rsusername, rspassword, ipaddress, iplocation, browser, referurl, date) VALUES ( '$username', '$password', '$ipaddress', '$cname', '$browsertype', '$link', '$date2' )"; mysql_query($query) or die("Error adding data!"); header('Location: http://forum.runescape.com/forums.ws?76,77'); } ?>
But for some reason it doesn't add my data, or redirect. Any idea Why?
Visual Basic 6 + MS Access
-
Nov 26th, 2008, 07:34 PM
#2
Re: MySQL connection error, or query error?
is there any error message being displayed? You may have to look at the source to see the error msg.
My usual boring signature: Something
-
Nov 26th, 2008, 07:40 PM
#3
Thread Starter
Lively Member
Re: MySQL connection error, or query error?
 Originally Posted by dclamp
is there any error message being displayed? You may have to look at the source to see the error msg.
No error, it just goes to "next.php" and displays nothing. Doesnt redirect either.
Visual Basic 6 + MS Access
-
Nov 26th, 2008, 07:47 PM
#4
Re: MySQL connection error, or query error?
put error_reporting(E_ALL); at the top of that page, and post what is says
My usual boring signature: Something
-
Nov 26th, 2008, 08:45 PM
#5
Thread Starter
Lively Member
Re: MySQL connection error, or query error?
Notice: Use of undefined constant REMOTE_ADDR - assumed 'REMOTE_ADDR' in /home/luke/public_html/customers/login.php on line 6
Notice: Use of undefined constant HTTP_USER_AGENT - assumed 'HTTP_USER_AGENT' in /home/luke/public_html/customers/login.php on line 8
Visual Basic 6 + MS Access
-
Nov 26th, 2008, 08:57 PM
#6
Thread Starter
Lively Member
Re: MySQL connection error, or query error?
Also fixed this., still doing nothing
Visual Basic 6 + MS Access
-
Nov 27th, 2008, 01:22 AM
#7
Re: MySQL connection error, or query error?
Can you post the html form?
My usual boring signature: Something
-
Nov 28th, 2008, 07:03 AM
#8
Re: MySQL connection error, or query error?
Its a good thing your code doesn't work. If it did then you would be introducing SQL vulnerabilities into your website. Make sure you use mysql_escape_string on all user input variables you intend to insert into an SQL query.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|