jimmyp3016 Posted January 11, 2007 Author Share Posted January 11, 2007 I'm pretty sure it is[code]Array ( [id] => 7 [userName] => testuser [firstName] => John [lastName] => Doe [address] => 56 happy rd [city] => Boston [state] => MA [zip] => 01915 [phone] => 333-333-3333 [company] => Google [website] => www.yahoo.com [aboutme] => a little about me [Submit] => Submit ) 2Warning: Cannot modify header information - headers already sent by (output started at /home/content/p/o/w/powerpage/html/mem/signup.php:1) in /home/content/p/o/w/powerpage/html/mem/signup.php on line 39[/code]I kept the echo $numrows; on for this testI am baffled as to why it isnt working... Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 Just as a test... what does this produce?[code]<?php$sql = "SELECT userName FROM user WHERE userName='$user'";if ($result = mysql_query($sql,$db)) { if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { echo $row['userName']."<br />"; } }}?>[/code] Quote Link to comment Share on other sites More sharing options...
jimmyp3016 Posted January 11, 2007 Author Share Posted January 11, 2007 Can't query DB: Unknown column 'address' in 'field list'Weird?... Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 Real wierd. remove the $db variable and try again.[code]<?php$sql = "SELECT userName FROM user WHERE userName='$user'";if ($result = mysql_query($sql)) { if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { echo $row['userName']."<br />"; } }}?>[/code] Quote Link to comment Share on other sites More sharing options...
jimmyp3016 Posted January 11, 2007 Author Share Posted January 11, 2007 my address field in the db was called address1 not address! :-XIt works now!Thank you for all of your Debugging help! Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 11, 2007 Share Posted January 11, 2007 Good! Don't forget to hit the solved button. Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 Your query has nothing to do with the address field. Are yo saying you initial issue was solved? How? Is this....[code=php:0]$sql = "SELECT userName FROM user WHERE userName='$user'";if ($result = mysql_query($sql,$db)) { if (mysql_num_rows($result) > 0) { header("Location: error2.html"); exit; }}[/code]working for you now? Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 [quote]Don't forget to hit the solved button[/quote]Hehe... the solved button has dissapeared since the forum upgrade. Quote Link to comment Share on other sites More sharing options...
jimmyp3016 Posted January 11, 2007 Author Share Posted January 11, 2007 So I jumped the gun and thought it was solved after I changed the address field. When i submit I get this errorWarning: Cannot modify header information - headers already sent by (output started at /home/content/p/o/w/powerpage/html/mem/signup.php:3) in /home/content/p/o/w/powerpage/html/mem/signup.php on line 46Line 46 is the error2.html header so nothing is getting updated to the db Quote Link to comment Share on other sites More sharing options...
jimmyp3016 Posted January 11, 2007 Author Share Posted January 11, 2007 Ok i fixed the header problem and the form is working correctly now.The only problem is it adds all the data to the users row execpt the username. For some reason its not sending it up Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 Post your actual code (all of it), you don't have any reference to userName in your UPDATE query if that is what your talking about. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 11, 2007 Share Posted January 11, 2007 BAH! Why no more solved button? Quote Link to comment Share on other sites More sharing options...
jimmyp3016 Posted January 11, 2007 Author Share Posted January 11, 2007 Ok here is the current working code. This code works perfect and goes to the next page and also updates the users fields. The field that it does not update is the userName field! Haha The one I actually need!The funny thing is that it sends out a mail to myself one someone signs up and it includes the username in it! It sent the username in the email! Its just not updating on the table!What is happening!BTW...You guys/girls are the best![code]<?php$userID = $_REQUEST['id'];$user = $_GET['userName'];$firstname = $_GET['firstName'];$lastname = $_GET['lastName'];$address = $_GET['address1'];$city = $_GET['city'];$state = $_GET['state'];$zip = $_GET['zip'];$phone = $_GET['phone'];$company = $_GET['company'];$website = $_GET['website'];$aboutme = $_GET['aboutme'];if ( ($user=="") || ($firstname=="") || ($lastname=="") || ($phone=="") || ($company=="") || ($website=="") ){ header("Location:error1.html"); exit;}include "../config-site.php";include 'corpmessage.php';// Open database...$db = mysql_connect("$localhost", "$databaseuser", "$databasepasswd");mysql_select_db("$databasename",$db);$sql="SELECT userName FROM user WHERE userName='$user'";$result = mysql_query("$sql",$db);if (mysql_num_rows($result) != 0) { header("Location:error2.html"); exit;}$sql = "SELECT * FROM user WHERE id='$userID'";$sql = "UPDATE user SET firstName = '$firstname', lastName = '$lastname', address1 = '$address', city = '$city', state = '$state', zip = '$zip', userName = '$user', phone = '$phone', company = '$company', website = '$website', aboutme = '$aboutme' WHERE id='$userID'";$result = mysql_query($sql,$db) || die("Can't query DB: ". mysql_error());// Close database...mysql_close($db);// Send message to inform webmaster about the new affiliate...$subject="$firstname $lastname has signed up with $sitename";mail("$affiliaterecipient","$subject","$mailbody","From: $siteemail \nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit");// Show thank you message...header("Location:invite.php?id=$userID");?>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 [quote]The funny thing is that it sends out a mail to myself one someone signs up and it includes the username in it![/quote]How? Where do you define $mailbody?Also, are you aware that variables do NOT need to be surrounded by quotes?If your not getting the mysql_error() as defined within the die() then your query is fine. If userName is not being updated then $user is empty. However this would normally trigger an error unless your userName field allows nulls. Quote Link to comment Share on other sites More sharing options...
jimmyp3016 Posted January 11, 2007 Author Share Posted January 11, 2007 [quote author=thorpe link=topic=121872.msg501977#msg501977 date=1168488981]How? Where do you define $mailbody?[color=red]In the include 'corpmessage.php'; line[/color]Also, are you aware that variables do NOT need to be surrounded by quotes?[color=red]Im still pretty new to php so I dont know exact syntax[/color]If your not getting the mysql_error() as defined within the die() then your query is fine. If userName is not being updated then $user is empty. However this would normally trigger an error unless your userName field allows nulls.[color=red]Should I set the userName field to Null?[/color][/quote] Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 [quote]Should I set the userName field to Null?[/quote]No. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.