Jump to content
Larry Ullman's Book Forums

Edward

Members
  • Posts

    1115
  • Joined

  • Last visited

  • Days Won

    27

Everything posted by Edward

  1. Yeah i was unaware of that, i have seen some sites adding that in there code, i wasn't aware that PHP would interpret that as an array, even though it was originally declared in php but in the HTML source.
  2. I guess is doesn't but i found BOOLEAN in a drop down list when i was adding a new column to one of my tables in PhpMyAdmin, but after the column was created it showed tinyint(1) as i earlier stated.
  3. Well after saving my data as Boolean the value in MySQL actually showed as a tinyint(1), well unless any of you suggest something better i see no reason in not going with that.
  4. Just want extend on this topic, we can tidy up our registration form for example by using an array like this user[first_name]; user[last_name]; user[address]; user[age]; now if we do this we don't have to over populate our global $_POST array, with all this garbage for example $_POST['first_name'] $_POST['last_name']; $_POST['address']; $_POST['age']; We would only need instead to use $_POST['user']; This could then be banged into an array as $user = $_POST['user']; Then user can be referenced as $first_name = $user['first_name'] $last_name = $user['last_name']; $address = $user['address']; $age = $user['age']; You don't need to assign array values to separate variables its just to break it up a bit and explain. Well the reason i wanted to add this is because if you have a larger website, you need to really organize exactly what will be saved in your $_POST array so by doing this your code will be more modular.
  5. I was unaware it was available before this, but i prefer learning from paperbacks. Ive checked out the contents for me i have to do about 330pages to cover most of the stuff i need for now, the rest ill learn later on. Ive done OOP stuff in another book and already use my own classes but i will give Larry's a read to brush up on it before starting the Yii stuff. I am looking forward to learning about the MOD REWRITE, its difficult to get that stuff well explained anywhere.
  6. I went to the JS errata page but it didn't work, the javascript kept loading but didn't submit my comment. So i will post the comment here. On PG.253 words.js i changed from numbers to message for the script to work. Apart from that this book is awesome, i am just dieing now to be able to get javascript into my webpages. // Function for setting text of an element: function setText(elementId, message) { 'use strict'; if ( (typeof elementId == 'string') && (typeof message == 'string') ) { var output = $(elementId); if (output.textContent !== undefined) { output.textContent = message; } else { output.innerText = message; } } // End of main IF. } // End of setText() function.
  7. I have a status value which i need to store in my database, either a 0 or 1, could anyone suggest the best data type for this with some reason. I noticed boolean would that be a good choice if not why?
  8. This is something that stumped me right now and i found this webpage with a useful solution. I have an inventory page in which i can select check boxes next to the product listing to end as many products as i like, there could be 10 or 20 products, depending how many the user has added. We can add our checkbox values into an array. http://www.kavoir.com/2009/01/php-checkbox-array-in-form-handling-multiple-checkbox-values-in-an-array.html
  9. A PHP only site would be nice but for examples there are also cases like if you need a drop down menu to appear you can do this by css only but its ugly, its just much easier to use jquery or js alone to bring out an invisible div and then disable it, the js way is much neater and logical than messing around with css. I think if you want a descent site these days you have to move forward and use js, like i mentioned already just an alert at the top of the screen to indicate this page needs js to function probably is fine. Jesus we got kids here at 5 years old that its there 2nd nature to use an iphone, people really need to be getting there act together if they don't even have a browser with JS, what are we going to do hold there hands for ever or is time for them to grow up?
  10. I thought Twitter only works if you have Js enabled and its one of the worlds most popular sites. The seo you are talking about on sites makes little or no difference everyone's site will do that so how can one be picked out from another. Seo works best from articles posted only, blogs, press releases, social bookmarking etc, youtube video's whatever. The more of those key things you have done for your site the more traffic you will drive in. Also the sites are ranked by how long they are active. That's probably why our friend Buzzmart is struggling right now, it needs more time to get overall traffic.
  11. I wanted to add its practically impossible now to make a descent web site these days without javascript. I think with most of the main sites on the market, there will be some part of the site where you can't operate if you don't have javascript enabled in your browser. My site also would be inoperable without js at parts, so i think the best solution is that if someone does not have js use and alert message to tell the user that he must have javascript enabled in order to view the page with full functionality. Lets face it we are pretty much past the days of PHP only websites, that's great news by the way of the upcoming death of IE6 and IE7, awesome.
  12. Last time i disabled JS on Buzzmart i wasn't able to even register, its possible they have updated the site since then, i was there probably 6 months ago. Anyway all round i think its quite a good website, in terms of functionality there isn't much but its a good starting point.
  13. Its quite a common error, that most of us run into at some point. I am using Dreamweaver CS5.5 for my IDE and that open PHP tag show up in the color red, so if i mistyped it i could spot the error by the incorrect color. So the IDE you are using can also help you to spot these errors.
  14. I just paid for mine now on Amazon, only 17 left after I got it, this is exciting.
  15. Because its just a basic example of how PHP and MySQL works, the book wasn't written to help you specifically build professional forums like vBulletin or phpbb. It would be more concrete anyway to be build your site into a PHP framework to give you more leverage.
  16. I have been wondering myself as to when these objects would be used in your web pages with javascript, most of my stuff would be handled server side via PHP. I saw a marketplace web site called Buzzmart.com, if you make an account with them and go to their item listing it all works in javascript, i could see the js objects fitting nicely into a situation like that where all the product data could be held within an object. If you don't have Javascript enabled with Buzzmart you can't even register with them, its a hardcore js site.
  17. Just want to make this post to say tomorrow i will be buying this book from Amazon, i have been waiting for this for a long time I currently have the 2nd edition but since i know there was a 3rd edition coming out i decided to wait for it, i know i have made the right decision. I have finished PHP and MySQL for Dynamic Web Sites Fourth Edition, anything with PHP and MySQL i can now build with ease. My aim with this new book is to work through mostly the Object-Orientated Programming chapters to get geared up for Larry's Yii eBook which is coming out next month. Now i just hope Amazon will get this book to me by the end of next week.
  18. Just a quick question, my site is based in the United States Dollars currency, however i would like to add in some common currencies, GBP, EURO etc so a user can select one of these. Does anyone have any recommendations of an api or some kind of currencies app that can be connected to by our web site to fetch then display the most up to date value.
  19. Can you show us the messages table SQL so we can check the data types? I like to do these prepared statements the object way, and what i have is almost identical to your statement but worked for me, so not sure what is up with yours: $q = 'INSERT INTO address (user_id, address, city, state_code, province, zip, country_id) VALUES (?, ?, ?, ?, ?, ?, ?)'; // Prepare the statement: $stmt = $mysqli->prepare($q); // Bind the variables: $stmt->bind_param('isssssi', $user_id, $address, $city, $state, $province, $zip, $country); // Execute the query: $stmt->execute(); Thank you buddy, i learn from you also!
  20. Yeah i must of deleted it out when i was adding in the NOW() well if that was my code and running it i would of found that easy when running, i don't have the full app here. Edited thanks, now its perfect.
  21. I usually set my variables first before preparing statement for binding, you only need to bind the 5 variables, just assign date_entered the SQL NOW() function, no need to try and bind SQL functions, stick to variables only. // Make the query: $q = 'INSERT INTO messages (forum_id, parent_id, user_id, subject, body, date_entered=NOW()) VALUES (?, ?, ?, ?, ?)'; // Prepare the statement: $stmt = mysqli_prepare($dbc, $q); // Assign the values to variables: $forum_id = (int) $_POST['forum_id']; $parent_id = (int) $_POST['parent_id']; $user_id = 3; // The user_id value would normally come from the session. $subject = strip_tags($_POST['subject']); $body = strip_tags($_POST['body']); // Bind the variables: mysqli_stmt_bind_param($stmt, 'iiiss', $forum_id, $parent_id, $user_id, $subject, $body); // Execute the query: mysqli_stmt_execute($stmt);
  22. Only the E commerce example in chap 19 uses the transactions, the forum demo was just a basic example it doesn't incorporate those. Yes you are right you must use InnoDB tables to perform transactions. Check out pages 654 onwards.
  23. Edward

    Yii 2.0

    Ive just seen your new books contents, the contents are awesome, i love this statement. "The first is to help readers understand why you do things in certain ways. In other words, I want the reader to fully understand what’s going on behind the scenes so that he or she appreciates the context for whatever bit of code. This big picture approach is what I think is missing among the current documentation. The second goal is to demonstrate common tasks using real-world examples." Like i was saying earlier Qiang may write all these classes with methods knowing himself what they are for but for other they may not know how to put these together. I have seen people on the Yiiframework forum stating how they managed to get their stuff working with a few of a classes methods but just left out the others. This is the one thing that kind of puts me of about it but i am prepared to give it a try anyway. Sorry i forgot to add, after seeing what you have coming up i am going to live the other Yii book so i don't get myself confused. I'll continue working through the JS book.
  24. Edward

    Yii 2.0

    Okay sounds good, i am going to rerun through the Jeffrey Winesett Agile Web Application Development with Yii 1.1 and PHP5 just before your stuff starts. Look forward to hearing the contents, hope you are going to make this easy for us, i actually think myself that Yii is pretty hard to understand what is going on, its very strict. I have confidence that with your LU style that we should be able to catch this.
  25. Edward

    Yii 2.0

    Sorry to keep bugging you Larry, but i am curious when are you planning to release your first Yii Ebook chapters for us to download?
×
×
  • Create New...