Walker33 Posted July 15, 2009 Share Posted July 15, 2009 Hello! Sorry if this is incredibly simplistic. Scenario is: User logs in with their account name, pass, etc. Script lets them in if name is 'like', since many users have last name changes, nicknames (sue for sue ann, etc.). So if they are Sue but database has Sue Ann, I want them to see Sue Ann in their profile so that they can change their profile accordingly. Currently, that doesn't happen when there's a space between names. If they are SueAnn, all one word, they can log in as Sue, and the echo in profile shows SueAnn, but if there's a space as in Sue Ann, it will only show Sue in the profile echo. Ideas? <?php $scoquery1 = mysql_query("SELECT License_Num, FirstName, LastName, Email FROM customer_details WHERE FirstName like '%$memfname%' AND LastName like '%$memlname%' AND status like '%active%' AND Email = '$mememail' AND Password = '$mempass' AND activate = 'yes'"); $findit = mysql_fetch_assoc($scoquery1); $masterlic = $findit ['License_Num']; $userfirst = $findit ['FirstName']; $userlast = $findit ['LastName']; $useremail = $findit ['Email']; echo $userfirst; ?> Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/166118-solved-echo-data-containing-space/ Share on other sites More sharing options...
seventheyejosh Posted July 15, 2009 Share Posted July 15, 2009 echo "$userfirst"; like so? Quote Link to comment https://forums.phpfreaks.com/topic/166118-solved-echo-data-containing-space/#findComment-876064 Share on other sites More sharing options...
Walker33 Posted July 15, 2009 Author Share Posted July 15, 2009 nope, that didn't do it. Quote Link to comment https://forums.phpfreaks.com/topic/166118-solved-echo-data-containing-space/#findComment-876068 Share on other sites More sharing options...
seventheyejosh Posted July 15, 2009 Share Posted July 15, 2009 are you sure that it is saving in the database properly? do a print_r($findit); and see what is in FirstName => ?? Quote Link to comment https://forums.phpfreaks.com/topic/166118-solved-echo-data-containing-space/#findComment-876069 Share on other sites More sharing options...
Walker33 Posted July 15, 2009 Author Share Posted July 15, 2009 let me clarify, which I should have done from the start. A standard echo WILL give both names. But when I echo it in a form for them to change, it does not. So: <form name="profileupdate" method="post" action="/memberupdate.php"> <strong>First:</strong> <input type="text" name="newfirst" size="30" value=<?php echo $userfirst; ?>><br> <strong>Last:</strong> <input type="text" name="newlast" size="30" value=<?php echo $userlast; ?>><br> <strong>Email:</strong> <input type="text" name="newemail" size="30" value=<?php echo $useremail; ?>><br> Does that help? Quote Link to comment https://forums.phpfreaks.com/topic/166118-solved-echo-data-containing-space/#findComment-876071 Share on other sites More sharing options...
seventheyejosh Posted July 15, 2009 Share Posted July 15, 2009 ah yes, you have to enclose the value in " " 's so this : $ok = "HEY HO!"; value=$ok //outputs HEY value="$ok" //outputs HEY HO! so value="<?php echo $userfirst; ?>" Quote Link to comment https://forums.phpfreaks.com/topic/166118-solved-echo-data-containing-space/#findComment-876074 Share on other sites More sharing options...
Walker33 Posted July 15, 2009 Author Share Posted July 15, 2009 Beautiful! Thanks a ton, that was what I was looking for. Really appreciate the help. Quote Link to comment https://forums.phpfreaks.com/topic/166118-solved-echo-data-containing-space/#findComment-876076 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.