It is currently Sun Jul 15, 2018 9:20 pm


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: accessing database using php
PostPosted: Sat Nov 05, 2005 5:32 pm 
Noobie
Noobie

Joined: Sat Nov 05, 2005 5:30 pm
Posts: 4
when i try to access my database through a php script i use this,


<?

$user="robsmi3_user";
$password="forgot";
$database="user_info";
$host="localhost";


$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];

mysql_connect($host,$user,$password);
@mysql_select_db($database) or die("unable to connect to the database");

$query = "INSERT INTO user_info VALUES
('$username','$password','$email')";

mysql_query($query);

mysql_close();

?>


it says theres an error on line 13 and that it can't access the database i've used localhost, or should i be using a different web address?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 6:41 pm 
What server are you on? If you are on 100webcustomers.com enter 100webcustomers.com for the host, if you are on farvista.net, enter farvista.net for the host, etc..


Top
  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 7:06 pm 
Noobie
Noobie

Joined: Thu Jul 21, 2005 6:49 pm
Posts: 12
As a side note, you should probably change "$password = $_POST['password']" to a different variable, eg $userpass

Otherwise, it'll be trying to use the $_POST['password'] as the password to access the MySQL database, which not be "forgot", or whatever the password you are using is.

_________________
<insert wit here>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 7:15 pm 
Noobie
Noobie

Joined: Sat Nov 05, 2005 5:30 pm
Posts: 4
yes that could be the problem i changed the access host to

freesuperhost.com as it isn't localhost but now it says it can't access, i'll just try changing the password$_post one


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 9:52 pm 
okay :)


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ]  Moderators: fhmagic, KJ, Support Team, Moderators

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
100WebSpace © 2011