Jump to content


Photo

Mysql problem


  • Please log in to reply
8 replies to this topic

#1 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 26 July 2006 - 08:43 AM

Hi,
I want the username and passowrd to be inputed in the database, but I've got a little problem:
The username is not saved in the database, I don't undestand why. But Password is saved correctly. any ideas how can I fix that? Thank you.

here is the code:

<?php
$con = mysql_connect("localhost","3d","password"); //connect to the sql database
if(!$con)
{
  die('Couldn"t connect'.mysql_error());
}

mysql_select_db("3d",$con);
$insert = "INSERT INTO password
(user, pass)
VALUES
('$_POST[$user]','$_POST[pass]')";
if(!mysql_query($insert,$con))
{
  die('Error'.mysql_error());
}
echo "Welcome George, your username and password is saved in Database";
mysql_close($con);
?>
I don't need your script, I'll try to write it myself

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 08:46 AM

$user

user

ok
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 26 July 2006 - 08:53 AM

Thanks man, I'am dead.....time to sleep now :P
I don't need your script, I'll try to write it myself

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 08:54 AM

There you go mate

good luck.

<?php

//connect database.

$con = mysql_connect("localhost","3d","password"); //connect to the sql database 

//post varables.

$user=($_POST['user']);
$pass=($_POST['pass']);

//addslasshes to insert to database for database hekth lol....

$user=addslashes($user);
$pass=addslashes($pass);


if(!$con) 
{
  die('Couldn"t connect'.mysql_error());
}

mysql_select_db("3d",$con);

if($_POST['submit']) {
 
$insert = "INSERT INTO password(user, pass)VALUES('$user','$pass')"; 

if(!mysql_query($insert,$con)) 
{
  die('Error'.mysql_error());
}
echo "Welcome $user, your username and $pass is saved in Database";

//send user to the index page in stead of the above message ok.

//header("location: index.php");

 }
mysql_close($con); 
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 26 July 2006 - 08:57 AM

Thanks, that's great:)
I don't need your script, I'll try to write it myself

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 08:59 AM

Your more then welcome becouse you was nice,

ill help you next time your on ok

good luck mate.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 26 July 2006 - 09:01 AM

thank u very much redarrow! I've already added u to my buddy list ;)
I don't need your script, I'll try to write it myself

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 09:04 AM

ok mate pm me anytime ok.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 26 July 2006 - 01:50 PM

ok mate pm me anytime ok.

Kinda hard that when the PM system is disabled.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users