School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / mysql101 ![]() |
Week #3 ADVANCED to-do assignment here |
(#24 2003-08-22 13:15:40) Post Reply |
|
TDavid
|
Your Week #3 ADVANCED TO-DO assignment should be posted here in this thread only. If you have specific questions about the week 1 course text then please also post them in this thread so that other students can learn from the information and we can collectively build a knowledge base.
Here is the details on what you need to do in this assignment: Do the basic assignment and add more advanced error handling, such as checking the length of passwords, determining if a quantity, age, or date field is a number and compare it to a qualifying point, or perhaps researching and using ways to ensure that email addresses are valid. Provide 'customized' error messages for each field - or perhaps customized animated images and/or sounds to indicate different errors. |
(#39 2003-09-09 05:24:43) Post Reply |
|
lizabit
|
Hi Logspirit
Ok, I'm still behind. I am actually working on week 4 right now and will post wk3 advanced soon. But I have a question. I'm following the logic through (on week 3) and I get to the logic sequence. Then I have a bit of trouble. Could you walk me through. //if data was submitted, format the data so it can be inserted correctly into mysql - ok //check whitespaces and errors - ok //connect to mysql - ok //connect to database - ok //see if submit button was posted. - ok if posted insert query to $query_insert_website - ok **************************************************************** //check if row added - ? if((@ mysql_query($query_insert_website, $db)) && @ mysql_affected_rows() == 1) does this mean... the array that was posted that now exsists in $query_insert_website in this database and new mysql rows... if returns true....but doesn't new_mysql_rows return the number of new rows added? ...OK the posted array is all one row maybe? But one returns true and one returns a count? Am I reading this right. ***************************************************************** Is this where the query is executed? But where exactly is the query created? ****************************************************************** Sorry if it seems a bit redundant but if you spell it out it might help a bit. Is the chat set for Tues? Thanks for all your help. I think I will get this in the end. Kind Regards Liz |
(#40 2003-09-11 01:11:52) Post Reply |
|
logspirit
|
Liz, The answer is...
mysql_affected_rows() returns the NUMBER of rows that the last query affected. The last query in this case was: mysql_query($query_insert_website, $db)) Which, as You correctly figured out, returns TRUE or FALSE. So what is happening in: // Do Websites Table Data Insert, check if Row added: if((@ mysql_query ($query_insert_website, $db)) && @ mysql_affected_rows() == 1){ // Report success: echo '<h3>Website Data Inserted into Websites Table.</h3>'; } else { // Report problem: echo '<h3>Could not add data to Websites Table.</h3>'; }//end query Is checking if the query was properly executed AND if it affected one row. Sometimes queries can execute correctly, and not affect any rows. Apologies on my slight delay in responding, Somehow I missed Your post... and You in Tuesday's workshop... See You in Script School on Friday, and in the Workshop on Tuesday... logspirit |
|
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission