Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2005-01-30, 10:20 AM
Junior Member
 
Join Date: Jan 2005
Location: London
Posts: 8
Dimerx
Default

I am novice at sql and continue to having trouble in inserting data from a php form to the database.

All I get is a blank page rather than the page going to login page.

In addition the data is not being stored into the database. This is the script I am using:-
<?php


// Check Username code to be introduced


if (@$userName != "") {
include ("serverdtl.php")// Server Details
@$reGdate = date("d-m-y");
@$logDate = mktime("d-m-y-H-i-s");
@$regIP = getenv("REMOTE_ADDR");
@$logiNip = getenv("REMOTE_ADDR");
@$loginnUmber = count($loginnUmber++);
session_start();
//add member details
$connect = mysql_connect($host,$user,$password) or die ("Unable to connect to server!");
$db = mysql_select_db($database);
$sql = "INSERT INTO Auth_members (userName, emalAdd, password, reGdate, regIp,paymPr,valMem,logDate,logiNip,loginnUmber) VALUES ('@$userName',@$emailAdd','@$password','@reGdate', '@$regIp','@$paymPr','@$valMem', '@$logDate','@$logiNip','@$loginnUmber')";
mysql_query($sql);
mysql_close();
echo "

Member Created ! </p>";
header ("Location: http://www.mysite.com/Memcon/Login.php");
exit;
}

?>

Please tell me what am I doing wrong?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2005-01-30, 12:07 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

i see several problems with the quotes. I also dont understand using the @ in front of the variable names, considering they are not assignment.

use

mysql_query($sql) or die(mysql_error() . "
" . $sql);

That way it will tell you what the problem is.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #3 (permalink)  
Old 2005-01-30, 03:06 PM
Junior Member
 
Join Date: Jan 2005
Location: London
Posts: 8
Dimerx
Default

Thanks for your assistance!
I copied @ varibles from a manual. I am now able to add members
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:05 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.