Current location: Hot Scripts Forums » Programming Languages » PHP » My SQL_Error()


My SQL_Error()

Closed Thread
  #1 (permalink)  
Old 06-30-09, 12:09 PM
DarkestSoul DarkestSoul is offline
Newbie Coder
 
Join Date: Jun 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
My SQL_Error()

i am getting an error at line 14. Which might be require once connect.php
They are not connecting to the database of my web hoster. Is there anything wrong with them



PHP Code:

<?php 


// Check if he wants to register: 
if (!empty($_POST[username])) 

    
// Check if passwords match. 
    
if ($_POST[password] != $_POST[password2]) 
        exit(
"Error - Passwords don't match. Please go back and try again."); 

    
// Assign some variables. 
    
$date mktime(date("d - m - Y")); 
    
$ip $_SERVER[REMOTE_ADDR]; 

    require_once(
"connect.php"); 

    
// Register him. 
    
$query mysql_query("INSERT INTO members  
    (username, firstname, lastname, password, date, ip) 
    VALUES    ('
$_POST[username]','$_POST[firstname]','$_POST[lastname]','$_POST[password]','$date','$ip')"
    or die (
"Error - Couldn't register user."); 
     
    echo 
"Welcome $_POST[username]! You've been successfully reigstered!<br /><br /> 
        Please login <a href='login.php'><b>here</b></a>."

    exit(); 


?>


PHP Code:

<?php 


    
// MySQL connect information. 
    
$c_username "database_username"
    
$c_password "database_password"
    
$c_host "localhost"
    
$c_database "database_name"

    
// Connect. 
    
$connection mysql_connect($c_host$c_username$c_password
    or die (
"It seems this site's database isn't responding."); 

    
mysql_select_db($c_database
    or die (
"It seems this site's database isn't responding."); 

?>
Do they have anything wrong because they don't connect. Thank you all for trying.
I really appriciate it.
Thank You
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
  #2 (permalink)  
Old 06-30-09, 12:12 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Please don't create multiple threads for the same problem. Continue in the other one.

If you have any questions regarding what I said, please ask!


/Closed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Closed Thread

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 11:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.