I have aProblem with database
Posted by: Fatih (85.107.224.---)
Date: September 14, 2006 08:42PM

before all !! SORRY FOR MY BROKEN ENLISH .....

hi everybody.
i have a really strange problem with WAMP5.let me explain it one one. for example i am going to write a code which take registration information from you and send it to database. (by the way i am using WAMP in my local computer).
<?php
mysql_connect("localhost", "Blue", "geek"winking smiley or die (mysql_error());
mysql_select_db("test"winking smiley or die(mysql_error());
mysql_query("INSERT INTO example
(name, surename,user_name,password) VALUES('$name', $surename','$user_name','$password') "winking smiley
or die(mysql_error());
?>

As you see, there is no problem with this code righT ?.so when i click to "SEND" button (actually i save this code in a text file called reg.php and call it by another html file registration .html and my form action will run this code. any way. ). assume that i typed some information such as, name= david, sure name =web, user name = Geek, password =1234. so when i click the SEND button , it sends the data .and also redirect me to my success page.so the problem is that when i see at my database in phpmyadmin for "test"-->"example ", rows are created in table for my datas (david, web,Geek,1234) but the letters r not writen. inside the table is empty. can anybody tell me what is the problem exactly before i lose my mind. i really want to know this problem. thanks in advance .

NOTE : i tried connecting to server and database seperately, it connects. and also i can take from database by "SELECT * FROM example";



Post Edited (09-15-06 23:46)

Options: ReplyQuote
Re: I have aProblem with database
Posted by: Andre Rotband (---.sesirs.org.br)
Date: September 15, 2006 12:08AM

Hi.

In php5 you canĀ“t do this.
You need to use an array called $_POST (if you use Method POST in
your form) or use $_GET (if you use Method GET in your form).

Then:

mysql_query("INSERT INTO example
(name, surename,user_name,password) VALUES('$_POST[name]', $_POST[surename]','$_POST[user_name]','$_POST[password]') "winking smiley
or die(mysql_error());

You can use this command to help you.

print_r($_POST);

This command is show all variables that going to your save to database script.

Good Work;

Options: ReplyQuote
Re: I have aProblem with database
Posted by: Fatih (85.101.136.---)
Date: September 19, 2006 03:38PM

thanks in advace Mr Andre Rotband .i hope this will solve my problem. thanks again . best of luck

Options: ReplyQuote
Re: I have aProblem with database
Posted by: Fatih (85.101.136.---)
Date: September 19, 2006 03:39PM

Thanks in advance MR Andre Rotband . i hope this will solve my problem. thanks again. best of luck ...

Options: ReplyQuote


Sorry, only registered users may post in this forum.