Web Design Forum: What am i doing wrong? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

What am i doing wrong? Rate Topic: -----

#1 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 07:51 PM

Hi Guys,

I'm trying to create a page where i can add new users to a database

my code is

<?php
$connection = mysql_connect("***","***","***"); // Mysql Connection

if (!$connection)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("***", $connection);
	

$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";
	
if (!mysql_query($sql,$connection))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($connection)
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add New User</title>
</head>

<body>
<form action="add_user.php" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="hashed_password" /><br />
Fullname: <input type="text" name="fullname"	 /><br />
<input type="submit" />
</form>
</body>
</html>


I have ***'s out my login details and database name, but can anyone see why i get an error when i load the page

I look forward to hearing your response

Kind Regards

Shane
0

#2 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 07:58 PM

can you echo out your SQL query before running it? chances are that you're not passing the right values (or the POST values aren't being converted inside the string)
0

#3 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 07:58 PM

Also what is the error that mysql is giving?
0

#4 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 08:00 PM

i'm getting an internal server error

500 - Internal server error.

i cannot even load the page

any ideas?
0

#5 User is online   notbanksy 

  • Refreshingly Belligerent Marxist
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 3,937
  • Joined: 14-February 08
  • Reputation: 183
  • Gender:Male
  • Location:Darkest rural Somersetshire
  • Experience:Advanced
  • Area of Expertise:Copywriter

Posted 08 March 2010 - 08:01 PM

It might be that you're trying to enter a NULL value into the id field. If it's the primary key and set to auto_increment, it won't like this. Try changing your code to:
$sql="INSERT INTO 'users' (username, hashed_password, full_name)
VALUES ( '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";

0

#6 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 08:05 PM

If you're getting an internal server area it's nothing to do with your php, have you edit a htaccess file? If not, contact your host since its a problem with your apache server

Also, the NULL value should be fine if the field is set to auto increment
0

#7 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 08:05 PM

Quote

It might be that you're trying to enter a NULL value into the id field. Try changing your code to this:
$sql="INSERT INTO 'users' (username, hashed_password, full_name)
VALUES ( '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";



Have changed the code, still cant view the page, still getting the 500 error,

its very strange, i can manually enter the values in the above code and it works fine, but as soon as i change the code to pick up information from the form it doesnt work.

an ideas?

P.s The ID is autoincrement so i can use NULL
0

#8 User is offline   pat24 

  • Guru of nothing important!!
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,183
  • Joined: 29-April 08
  • Reputation: 131
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 08:06 PM

Hi

there is no need for single quotes around your table, users


$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";


Remove the single quotes from users and see what you get
0

#9 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 08:09 PM

Quote


Hi

there is no need for single quotes around your table, users


$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";



Remove the single quotes from users and see what you get


Have done this, still getting error :blink:
0

#10 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 08:14 PM

ok, it looks like its my host :(

however, i have uploaded to another server, each time the page loads it adds a record to the table? any idea why? and how to stop it?
0

#11 User is offline   pat24 

  • Guru of nothing important!!
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,183
  • Joined: 29-April 08
  • Reputation: 131
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 09:04 PM

View PostMake Me A Website, on 08 March 2010 - 08:14 PM, said:

ok, it looks like its my host :(

however, i have uploaded to another server, each time the page loads it adds a record to the table? any idea why? and how to stop it?


easiest way its to split the file, save all the php code as checkform.php or something then change the form action on your html to checkform.php
0

#12 User is online   andyl 

  • White space enthusiast
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,534
  • Joined: 21-January 10
  • Reputation: 210
  • Gender:Male
  • Location:Surrey
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 09:12 PM

View PostMake Me A Website, on 08 March 2010 - 08:14 PM, said:

ok, it looks like its my host :(

however, i have uploaded to another server, each time the page loads it adds a record to the table? any idea why? and how to stop it?


Because you've not added a condition which checks for any posted data...so the PHP executes every page load.
Use this code:

<?php
if (isset($_POST['submit'])){
$connection = mysql_connect("***","***","***"); // Mysql Connection

if (!$connection)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("***", $connection);
        

$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";
        
if (!mysql_query($sql,$connection))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($connection)
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add New User</title>
</head>

<body>
<form action="add_user.php" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="hashed_password" /><br />
Fullname: <input type="text" name="fullname"     /><br />
<input type="submit" name="submit" />
</form>
</body>
</html>


View Postpat24, on 08 March 2010 - 09:04 PM, said:

easiest way its to split the file, save all the php code as checkform.php or something then change the form action on your html to checkform.php


Good advice, I second this. Even better would be to include checkform.php and set action="" in the form.
1

#13 User is online   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,814
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 10:07 PM

View Postpat24, on 08 March 2010 - 08:06 PM, said:

Hi

there is no need for single quotes around your table, users


$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";


Remove the single quotes from users and see what you get


You're troubleshooting the wrong area. His script isn't even getting to the stage of execting a mysql query. The problem most likely lies at a higher level - e.g. his host.

Could even the fact you haven't added an if statement to catch your form submit(assuming your script isn't called 'add_user.php' og curse)
0

#14 User is offline   pat24 

  • Guru of nothing important!!
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,183
  • Joined: 29-April 08
  • Reputation: 131
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 10:38 PM

View Postrallport, on 08 March 2010 - 10:07 PM, said:

You're troubleshooting the wrong area. His script isn't even getting to the stage of execting a mysql query. The problem most likely lies at a higher level - e.g. his host.

Could even the fact you haven't added an if statement to catch your form submit(assuming your script isn't called 'add_user.php' og curse)


those comments have already been covered throughout the whole thread
0

#15 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 11:43 PM

Yes they have been covered so I don't understand why you continued to try and debug PHP even after he said it was the hosting :rolleyes:
0

#16 User is offline   pat24 

  • Guru of nothing important!!
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,183
  • Joined: 29-April 08
  • Reputation: 131
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 11:48 PM

View PostJay Gilford, on 08 March 2010 - 11:43 PM, said:

Yes they have been covered so I don't understand why you continued to try and debug PHP even after he said it was the hosting :rolleyes:


where exactly have i carried on debugging after the hosting was found to be the problem
0

#17 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 11:49 PM

View Postpat24, on 08 March 2010 - 09:04 PM, said:

easiest way its to split the file, save all the php code as checkform.php or something then change the form action on your html to checkform.php
Here when you even quoted his post of saying it was the host
0

#18 User is offline   pat24 

  • Guru of nothing important!!
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,183
  • Joined: 29-April 08
  • Reputation: 131
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 March 2010 - 11:52 PM

View PostMake Me A Website, on 08 March 2010 - 08:14 PM, said:

ok, it looks like its my host :(

however, i have uploaded to another server, each time the page loads it adds a record to the table? any idea why? and how to stop it?

I think he is asking a totally different question/s here.
0

#19 User is online   andyl 

  • White space enthusiast
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,534
  • Joined: 21-January 10
  • Reputation: 210
  • Gender:Male
  • Location:Surrey
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 12:21 AM

View Postpat24, on 08 March 2010 - 11:52 PM, said:

I think he is asking a totally different question/s here.


This is true, I answered the new questions in my previous post. He was wondering why the PHP was being executed on every page load, not just when the forum was submitted. I posted a solution above.

The new question(s) he asked were:

Quote

each time the page loads it adds a record to the table? any idea why? and how to stop it?

0

#20 User is offline   craigpettit 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 174
  • Joined: 11-September 08
  • Reputation: 0
  • Location:Surrey UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 10:06 AM

This is a problem i have seen when my host is on a windows server... try switching it to linux if it is on windows and this may resolve your issue.
0

#21 User is online   andyl 

  • White space enthusiast
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,534
  • Joined: 21-January 10
  • Reputation: 210
  • Gender:Male
  • Location:Surrey
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 01:50 PM

He has already resolved the original problem regarding a hosting issue.
The new problem is that of PHP code -_-
0

#22 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 01:59 PM

View Postandyl, on 09 March 2010 - 01:50 PM, said:

He has already resolved the original problem regarding a hosting issue.
The new problem is that of PHP code -_-


Yup, and Andy has posted the right solution for that too so this should be completely done
0

#23 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 02:30 PM

Hi Guys,



My inital question was answered and i've been able to load the page.

I have asked a second question which was how to i prevent the query from submitting when the page loads.

i hope this clears up any confusion

Kind Regards

Shane
0

#24 User is online   andyl 

  • White space enthusiast
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,534
  • Joined: 21-January 10
  • Reputation: 210
  • Gender:Male
  • Location:Surrey
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 02:57 PM

View PostMake Me A Website, on 09 March 2010 - 02:30 PM, said:

Hi Guys,



My inital question was answered and i've been able to load the page.

I have asked a second question which was how to i prevent the query from submitting when the page loads.

i hope this clears up any confusion

Kind Regards

Shane


I've answered your second question above...

Because you've not added a condition which checks for any posted data...so the PHP executes every page load.
Use this code:

<?php
if (isset($_POST['submit'])){
$connection = mysql_connect("***","***","***"); // Mysql Connection

if (!$connection)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("***", $connection);
        

$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";
        
if (!mysql_query($sql,$connection))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($connection)
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add New User</title>
</head>

<body>
<form action="add_user.php" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="hashed_password" /><br />
Fullname: <input type="text" name="fullname"     /><br />
<input type="submit" name="submit" />
</form>
</body>
</html>

0

#25 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 03:45 PM

Quote

I've answered your second question above...

Because you've not added a condition which checks for any posted data...so the PHP executes every page load.
Use this code:

<?php
if (isset($_POST['submit'])){
$connection = mysql_connect("***","***","***"); // Mysql Connection

if (!$connection)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("***", $connection);
        

$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";
        
if (!mysql_query($sql,$connection))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($connection)
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add New User</title>
</head>

<body>
<form action="add_user.php" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="hashed_password" /><br />
Fullname: <input type="text" name="fullname"     /><br />
<input type="submit" name="submit" />
</form>
</body>
</html>



I have tried this code, it send back the following error
"Parse error: syntax error, unexpected '}' in /.../add_user.php on line 29"

please see below my revised code, only has a couple of tweeks

<?php
if (isset($_POST['submit'])){
$connection = mysql_connect("***","****","***"); // Mysql Connection


if (!$connection)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("***", $connection);
	
	$username = $_POST[username];
	$password = $_POST[password];
	$fullname = $_POST[fullname];
	$hashed_password = sha1($password);

$sql="INSERT INTO users (id username, hashed_password, full_name)
VALUES ( NULL, '$username','$hashed_password', '$fullname')";
	
if (!mysql_query($sql,$connection))
  {
  die('Error: ' . mysql_error());
  }

echo "1 record added";

mysql_close($connection)
} //this is line 29
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add New User</title>
</head>

<body>
<form action="add_user.php" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
Fullname: <input type="text" name="fullname"	 /><br />
<input type="submit" name="submit" />
</form>
</body>
</html>

0

#26 User is online   andyl 

  • White space enthusiast
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,534
  • Joined: 21-January 10
  • Reputation: 210
  • Gender:Male
  • Location:Surrey
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 03:55 PM

You were missing a semi-colon after mysql_close($connection)

Here is the working code:

<?php
if (isset($_POST['submit'])){
$connection = mysql_connect("***","****","***"); // Mysql Connection


if (!$connection)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("***", $connection);
        
        $username = $_POST[username];
        $password = $_POST[password];
        $fullname = $_POST[fullname];
        $hashed_password = sha1($password);

$sql="INSERT INTO users (id username, hashed_password, full_name)
VALUES ( NULL, '$username','$hashed_password', '$fullname')";
        
if (!mysql_query($sql,$connection))
  {
  die('Error: ' . mysql_error());
  }

echo "1 record added";

mysql_close($connection);
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add New User</title>
</head>

<body>
<form action="add_user.php" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
Fullname: <input type="text" name="fullname"     /><br />
<input type="submit" name="submit" />
</form>
</body>
</html>

0

#27 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 10:04 PM

that doesn't work, it says cannot connect to database ??any ideas?
0

#28 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 11:02 PM

Did you change the *** back to your original details?
0

#29 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 09 March 2010 - 11:58 PM

yeah
0

#30 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 10 March 2010 - 12:49 AM

There are a few possible reasons for not connecting then. Either the credentials are incorrect, the mysql server is not running you are trying to use a domain rather than localhost and the domain is refusing the connection
0

#31 User is offline   Make Me A Website 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 10-November 09
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 10 March 2010 - 12:24 PM

could it be that the mysql server is on a windows host and the page is on a linux host?
0

#32 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 10 March 2010 - 12:46 PM

As I said above, if the two are on separate servers you need to make sure that the mysql server allows the remote connections to the database. You should really have both on the same server for optimal performance. With your mysql server, check with your host that you can use remote connections to access it. If you can't you'll need to move it to a server that will allow it or to the linux one as I stated above
0

#33 User is offline   Geeks 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 321
  • Joined: 07-October 09
  • Reputation: 11
  • Gender:Male
  • Location:South Africa
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 12 March 2010 - 12:28 PM

This is kind of a question and tip at the same time, as I am self taught.

as a side note, I believe you should be checked for SQL Injection
$username = mysql_real_escape_string($_POST[username]);
$fullname = mysql_real_escape_string($_POST[fullname])
;


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users