Jump to content
Larry Ullman's Book Forums

AprilSwenby

Members
  • Content Count

    85
  • Joined

  • Last visited

Community Reputation

1 Neutral

About AprilSwenby

  • Rank
    Advanced Member
  1. I too had this question and I thank you for your answer - I am trying to find a way to answer the first review question on chapter 414. Do you mean - how would we re-write rather than how would the the function be called?
  2. Part of my problem was that on page 394, the written instructions did not say to type lines 22 and 23.... so I wasn't included the database connect file. I have done that now, and Now I am getting a message that says... Could not store the quote because: No database selected. The query being run was: INSERT INTO quotes (quote, source, favorite) VALUES ('test', 'test', 0) That's why I think I either have something typed wrong in my table or things aren't stored in the right directories.... I have debugged and I am connected to the database…. it still seems to be having a problem se
  3. Yes - thank you I did fix that error right away - that is not my problem.
  4. Hi Larry - I am following along in the book - and I am on page 393 when we begin to add quotes. When I add a quote, the page returned sends back these errors: Notice: Undefined variable: dbc in C:\xampp\htdocs\add_quote.php on line 18 Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\xampp\htdocs\add_quote.php on line 18 Notice: Undefined variable: dbc in C:\xampp\htdocs\add_quote.php on line 19 Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\xampp\htdocs\add_quote.php on line 19 Notice: Undefined variable: db
  5. Yes! That worked for me too! So it seems I had it right at one point - but just had it in the wrong place! How frustrating! I've been working on this for over a week now.... Thank you so much for pointing that out to me.
  6. Hi Larry - I took a break like you said, and I feel like I'm so close! But...... This script returns about 100 lines of But that's because I've been entering 'april' for the last 100 times I've been testing the script. I tried a new name and the first time I entered the name it said that I've been registered, and the second time it told me This username is already used. Please enter a unique username! You are now registered! So it's returning two of my statements that contradict each other. This is further than I've ever gotten before - because I could never get it to return th
  7. I am a little closer think. I used this code ini_set('auto_detect_line_endings', 1); $open = fopen($file, 'r'); //opens my data file while ($line = fgetcsv($open, 200, "\t" )) { //breaks my string from $file into parts if ($_POST['username'] == ($line[0])){ $problem = TRUE; print '<p>That username has been taken, please try again</p>'; //if above is true, print this statement } break; } fclose($open); This code was debugged and I ran the form, I rec'd this as the return... That was telling me that it wasn't looking throughout the text file and was
  8. Hi Larry - Thank you for your advice. I did apply those debugging techniques. I found that username is correct. I also found that $line is returning the first word in my text file - so it really not "looping" through the text file to find matches. That is helpful information. So the question is - how do I get things to loop through - I thought that is what my count() was doing. Can you direct me that way?
  9. Well - that didn't make sense either! I don't want the username compared to the passwords... So then I tried this... And my script worked without errors, but I am still able to enter duplicate usernames.... HELP! ini_set('auto_detect_line_endings', 1); $open = fopen("$file", 'r'); //opens my data file while ($line = fgetcsv($open, 20, "\t" )) { //breaks my string from $file into parts $n = count($line); if ($_POST['username'] == ($line[0])){ $problem = TRUE; print '<p>That username has been taken, please try again</p>'; //if above is true, print this statement }
  10. or maybe this would be better...Still gives me an error Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\registerpursue.php on line 59 - but is this more on the right track? ini_set('auto_detect_line_endings', 1); $open = fopen("$file", 'r'); //opens my data file while ($line = fgetcsv($open, 20, "\t" )) { //breaks my string from $file into parts $n = count($line); if ($_POST['username'] == ($line[0] $line[1] $line[2])){ $problem = TRUE; print '<p>That username has been taken, please try again</p>'; //if above is true, print this statement brea
  11. Thank you lingolatz! This helped immensly - however, I am still a little unclear when trying to follow your direction on the Here is what I have based on what you stated.... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Register</title> <style type="text/css" media="screen"> .error { color: red; } </style> </hea
  12. Yes - that is exactly what the problem was! Thanks! I still can't get the script to recognize a duplicate user name though! I just don't know what I am doing wrong.... I feel like I've tried every method.....
  13. Hello all - I am having a huge stumper. I have have been diligently working on the Pursue question for chapter 11 that requires the script to guarantee unique usernames in register.php Here is my script. I just can't figure out what I am doing wrong and why this won't work for me. I have modified it so many times! Here is what I have right now. This is what is being returned with this script: Register You are now registered! Warning: fgetcsv(): 3 is not a valid stream resource in C:\xampp\htdocs\registerpursue.php on line 55 <!DOCTYPE html PUBLIC "-//W3C//DTD
  14. Jonathon - Here is my error now - I've been working on it non - stop . Found out that users directory was missing a slash. Argh... Anyway. I now have an error to work with - Warning: fgetcsv() expects parameter 1 to be resource, string given in C:\xampp\htdocs\registerpursue.php on line 54 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <tit
×
×
  • Create New...