navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

*FIXED* php wont post

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> *FIXED* php wont post
Page: [1]
 
Ryokotsusai

 

Posts: 248
Joined: 10/5/2005
Status: offline

 
*FIXED* php wont post - 4/21/2006 12:10:49   
Hi,

I am new to php, and I have a script that is supposed to enter info into a MySQL database, but it does't and I can't figure out why...

the php script is:
<?
//Connection Settings

$sqname="************";
$sqpass="********";
$sqdata="************";

mysql_connect('65.98.98.58',$sqname,$sqpass);
@mysql_select_db($sqdata) or die("Unable to select database");

//Data From Html

$fname = $_POST['FN'];
$lname = $_POST['LN'];
$uname = $_POST['UN'];
$upass = $_POST['PASS'];
$cpass = $_POST['PASS2'];
$email = $_POST['EM'];

$url = $_POST['URL'];
$aim = $_POST['AIM'];
$msn = $_POST['MSN'];
$yah = $_POST['YAH'];
$not = $_POST['NOT'];

$query = "INSERT INTO Users VALUES ($fname,$lname,$uname,$upass,$email,$url,$aim,$msn,$yah,$not)";
mysql_query($query);


mysql_close();		//Ends Connection
?>


when i run through the form, it gives me no error messages, it just shows a blank page, so I assume it thinks its working, but none of the info put into the form is put in the database.

If you want to try it the url is: http://dotm.ath.cx/Reg.htm

could someone please tell me what i did wrong?

thanks

< Message edited by Ryokotsusai -- 4/23/2006 13:53:44 >


_____________________________

The world is more like it is now than it ever has been before.
--Dwight Eisenhower
Tailslide

 

Posts: 6290
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: php wont post - 4/22/2006 3:29:39   
As mentioned I'm not an expert so forgive me if I go the long way round with this!

<? 
    $dbh=mysql_connect ("localhost", "USERNAME", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
     mysql_select_db ("DATABASENAME");
   
    //making variables
   $fname= $_POST['FN'];
   $lname= $_POST['LN'];
   $uname= $_POST['UN'];
   $upass= $_POST['PASS'];
   $cpass= $_POST['PASS2'];
   $email= $_POST['EM'];
   $url= $_POST['URL'];
   $aim= $_POST['AIM'];
   $msn= $_POST['MSN'];
   $yah= $_POST['YAH'];
   $not= $_POST['NOT'];


   //oh the query!
   $result=MYSQL_QUERY("INSERT INTO Users (FN,UN,PASS,PASS2,EM,URL,AIM,MSN,YAH,NOT)".
   "VALUES ('$fname', '$lname','$upass','$cpass','$email','$url','$aim','$msn','$yah','$not')");

    //confirm
   echo "Your details have been added. <p><a href=\"/Reg.htm\">Back to the Registration Page</a></p>";

?>


I have no idea if this is a better method than the one you use - but I do know that this method works as I've used it several times.



_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to Ryokotsusai)
Ryokotsusai

 

Posts: 248
Joined: 10/5/2005
Status: offline

 
RE: php wont post - 4/22/2006 9:55:28   
Thanks, im trying it now, and thank you again for your earlier help:)

_____________________________

The world is more like it is now than it ever has been before.
--Dwight Eisenhower

(in reply to Tailslide)
Ryokotsusai

 

Posts: 248
Joined: 10/5/2005
Status: offline

 
RE: php wont post - 4/22/2006 10:11:18   
Nope, it didn't change it, this one does the same, says it's working but doesn't connect

the 2 things i can think of that could be the problem now are either php is evil or my host is blocking connections to the database

there is a very good chance it is the first one, but i'm looking into the second and playing with settings

_____________________________

The world is more like it is now than it ever has been before.
--Dwight Eisenhower

(in reply to Ryokotsusai)
Tailslide

 

Posts: 6290
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: php wont post - 4/22/2006 10:53:51   
Can you add stuff to the db via phpmyadmin?

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to Ryokotsusai)
dpf

 

Posts: 7126
Joined: 11/12/2003
From: India-napolis
Status: offline

 
RE: php wont post - 4/22/2006 11:13:01   
yes, add something to the db and then use php to see if it will display
Select * from table

if it wont display, you have a connection issue probably

_____________________________

Dan

(in reply to Tailslide)
Ryokotsusai

 

Posts: 248
Joined: 10/5/2005
Status: offline

 
RE: php wont post - 4/22/2006 11:53:12   
Edit>>NVM My fault...

yes I can insert info through phpmyadmin



_____________________________

The world is more like it is now than it ever has been before.
--Dwight Eisenhower

(in reply to dpf)
Ryokotsusai

 

Posts: 248
Joined: 10/5/2005
Status: offline

 
RE: php wont post - 4/23/2006 13:53:19   
*FIXED* I forgot a set of quotes... (now i really feel dumb)

thank you everyone

_____________________________

The world is more like it is now than it ever has been before.
--Dwight Eisenhower

(in reply to Ryokotsusai)
Tailslide

 

Posts: 6290
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: php wont post - 4/23/2006 14:31:00   
quote:

ORIGINAL: Ryokotsusai

*FIXED* I forgot a set of quotes... (now i really feel dumb)



Oh I woudn't worry - anyone that tells you they haven't done exactly the same is a big liar!

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to Ryokotsusai)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> *FIXED* php wont post
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts