Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsZymic Free Web HostingDatabases & MySQL right
  Reply to this topic Start new topic
left right
danielwtn
post May 26 2009, 08:56 PM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 26-May 09
Member No.: 96,660



using assorted guides on the internet, i managed to peice together a php code for opening a database, writing values to it, and closing it; but for some reason it doesn't work. i wanted to know whether or not it was my code or my database, and if it is the code how do i fix it?

Here is my code:

<?php
$fname=$_POST[fname];
$lname=$_POST[lname];
$uname=$_POST[uname];
$pname=$_POST[pname];
$ename=$_POST[ename];
$member=mysql_connect(localhost,ncpi_danielwtn,danny21);
mysql_query(members,$member);
$register=insert into members (firstname,lastname,username,password,email) values ($fname,$lname,$uname,$pname,$ename);
mysql_query(members,$register);
mysql_close($member);
?>
Go to the top of the page 
 
  + Quote Post
Ed
post May 26 2009, 09:03 PM
Post #2


Outrageously Uber Ninja
*******

Group: Administrators
Posts: 2,526
Joined: 11-March 07
From: UK
Member No.: 9



Try after your query:
CODE
echo mysql_error();


Also, you really should be sanitizing the values being inserted by using http://www.php.net/mysql-real-escape-string
Go to the top of the page 
 
  + Quote Post
 Reply to this topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 21st November 2009 - 01:33 PM