Jump to content
Larry Ullman's Book Forums

MikeMikeMike

Members
  • Content Count

    55
  • Joined

  • Last visited

Posts posted by MikeMikeMike


  1. It`s fairly obvious to me who was likely snooping for my private information, but there`s no point naming names because they`d just deny it.

     

    It`s obvious to me because the person must have read the post I did last week about SSL, where I posted the link to the site, and then, this week, they remembered that I had posted the link there once they became curious about me following the mildly testy exchanges in the threads this week where Larry claimed Matt had posted the correct answer, and I refused to acknowledge it. My Godaddy records show that my WhoIs info was checked on this week on the day of the testy exchanges.

     

    There`s probably a very small circle of people who read both posts, and were engaged enough with both posts to (a) remember I had posted the link and (B] to want to find out more information about this obnoxious "stranger" (i.e. me) on the forum.

     

    I have to say, though, that I`m pretty disappointed this behavior would take place.

     

    One of the reasons I come to this forum is to make my questions more reusable. I could just as easily post questions about these books on other forums, where there`s actually more people who are available to answer.


  2. Yesterday, in one of my posts the issue came up of being a "stranger" in the forum. Larry, quite rightly, said to me that he doesn't know anything about me and referred to me as a "stranger". Really, none of us know anything about each other.

     

    However, it doesn't have to remain that way, and I think that people here don't want it to remain that way. Let me explain.

     

    It so happens that I just learned about a service that GoDaddy offers. They allow you to check whether anyone has been doing WhoIs searches on your domain names. For example, i can find out how many WhoIs searches (which reveal all my personal information) were done on my domain names ordered by date-- Yesterday, Last Week, Last Month, Today, this week, This Month.

     

    As I just found out about this service, I have been using it everyday. It so happens that yesterday there were 2 WhoIs searches done on a domain name that I posted in this forum.

     

    Now, the domain name is so weird (www.TitanicRaisins.com) that it's unlikely that random people interested in the domain were checking who owns it. After all, before I bought the domain, there were no Google search results for it. Also, in the last 2 months, there were ZERO whois checks done on the domain. No one cared about it, or who owned it, until yesterday.

     

    However, I did post the domain name on Larry's site last week, as I asked for help with the code, and in the last 48 hours, the issue of my identity on this forum was raised and some mildly testy exchanges took place between users on this forum (with me even being called a "stranger"), so I find it funny that I got 2 WhoIs checks on this domain, when for the last 2 months there were 0 checks. It could be a total coincidence but to be honest I seriously doubt it. After all, I was called a "stranger" and the WhoIs reveals a lot of information for the curious.

     

    Why the sudden interest in the personal information of the owner of this domain, unless it came from people on this site!

     

    Of course, there's nothing at all wrong with doing WhoIs checks on someone. I just find it funny. People want to know information about me and they want to get it by snooping, rather than asking explicitly. Maybe Larry should change the policy for his forum regarding the kind of information we are required to provide....


  3. As to specific how's of linking the tables, that goes beyond the scope of this book and assumes you know this information already.

     

    This is of course Larry's choice, but as a bit of feedback for him, I find it a little odd.

     

    For example, Larry spends quite a bit of time explaining very simple PHP concepts and code that he explained in his first two books. However, in those other books, he didn't (to my recollection) create more involved databases where we got exposure to the best practices and strategies behind linking tables, which, in my opinion, requires more explanation than some of the simple php in this book.

     

    Therefore, he seems (in my opinion) to assume readers know the more difficult information (which requires actual thought process) while he spends some time explaining simple concepts.

     

    That's just feedback he can consider for future editions, if he likes


  4. Thanks for your input Terry. I totally understand that the features of the store might be limited in an example store. I just wanted to clarify if that's actually what's happening here, because I'm trying to learn the SQL as we go.

     

    Elsewhere in the forum Larry has said that each coffee was available in 5 sizes. The one size_id for each specific coffee seemed to contradict that.


  5. Thanks Hartley. I am unfortunately still mystified.

     

    You say that you generally put the path to the image, but in this code, Larry doesn`t put the path (as far as I can tell). Just a name of the image (unless it is of course the actual image)

     

    Can anyone explain, if it is just the name of the image, what is the value of putting only the name into the database, and where, in this application, does it connect to the actual image?

     

    INSERT INTO 'non_coffee_categories` (`category`, `description`, `image`) VALUES 
    ('Edibles', 'A wonderful assortment of goodies to eat...', 'goodies.jpg')


  6. I am using PHP 5.26 nd mysql 5.0

     

    This question was originally posted at the bottom of another thread, but as it`s actually a new question, I thought it better to post a new thread (so I erased the question from the other thread)

     

    This may be an easy question, but I found my assumption to be rather illogical (as I will explain below) so I thought I would ask.

     

    Why, in the specific_coffees table, does each coffee only have one size_id?

     

    Does that mean that each coffee is only available in one size? If not, which rationale did Larry use to assign a specific size_id to a specific coffee?

     

    The reason why I am having difficulty is the following. I find it weird that each coffee would only come in one size. Why wouldn`t each coffee be available in every size? Is this just a quirk related to Larry`s imaginary coffee store?

     

    So please explain, does the fact that each specific_coffee only has one size id mean that it only comes in one size?

     

     

    This question is sort of tangentially related to my other question, what is the rationale for choosing keys. I understand the basic idea of keys to connect tables, but I find (probably due to my limited understanding) the use of the size_id a bit counterintuitive ( because, as stated above, it suggests to me only one size is available for each coffee), unless this store really only does each coffee in one of five sizes.


  7. Larry,

     

    Thank you for answering the post with a clear explanation. By mentioning in your post that you are giving free advice to strangers, it makes you sound a little upset. The only reason I asked is because your books (which I bought) encourage me to ask questions here if I don`t understand, so I`m a little disappointed to get this put back in my face. Yes, i am a stranger, but I am also a customer and your books encourage me to post here. I don`t think it`s a good business practice to refer to your customers that way, especially when you encourage them to come to your forums.

     

    But you also seem to imply that you are upset (or less inclined to answer) to provide this advice because Matt already provided the answer and you believe he was correct, or 90% correct. I totally disagree and I think your answer proves the point.

     

    Matt provided two posts. In one post, he answered a question that wasn`t asked, and in the second post,when he tried to explain in detail the actual question that was asked, he was 100% wrong -- at least as far as I can see and which your answer shows.

     

    For example, you explain the answer here

     

    There are 10 records returned by the JOIN across general coffees and specific coffees. There are 5 sizes. When you join 5 sizes with 10 records, you get 50 matches: 5 matches for each of the 10 records (again, this is what Matt was saying). The ON clause restricts how a match is made, specifically, THIS size_id must match THAT size_id. The effect is that instead of all 5 sizes being returned for each of the original 10 records, only the 1 matching size will be returned.

     

    This is exactly the information I was looking for.

     

    Matt, in his second (incorrect post) said this which is 100% wrong

     

    The answer to this question is fairly easy! You are essentially selecting all records from the specific_coffees table WHERE the general_coffee_id = 3. If you look at the specific_coffees table, there are exactly 10 records, and all of them have a general_coffee_id of 3, so you should therefore have 10 records in your query result!

     

     

    because Matt is essentially claiming that it is this code

     

    ON gc.id = sc.general_coffee_id WHERE general_coffee_id =3

     

    that limits the result to 10.

     

    Contrary to what Larry says, I was not asking how JOINS work. I was asking how this joined work in particular. Given that Matt also didn`t understand the proper answer, it might not be as simple as you imagine for people at our level. yes, I know how JOINs work and have read about them, but understanding examples can be more difficult.

     

    Furthermore, Larry seems a little surprised I told Matt he was wrong twice. However, if I don`t agree with Matt`s answer, what am I supposed to do? Upon examination of Larry`s answer, I believe i am correct in saying that Matt was wrong!

     

    Furthermore, for your next edition, as you claim in your books that you can explain Geek to Normal people, I think it would be useful to into more depth sometimes because it`s clear that people aren`t getting it!

     

    Thank you for your assistance.

     

    I will provide the version information next time I come.


  8. @Larry I will do more reading up on it as you suggest, but I wonder if you might detail a specific example

     

    I have another post on this forum (Post where I ask how

     

    ON s.id = sc.size_id

     

    limits the results of the query from 30 to 10 with no duplicates. Looking at these tables, I see that the SC table uses a key for size_id.

     

    If you have time, and inclination to answer that other post (someone has tried unsuccessfully so far), could you also explain, using this example, how that query`s performance was enhanced using the key size_id? For example, was this key necessary to help avoid the duplication in results that I describe in that post?

     

    Thanks if you can help. As I am sure you are aware, it is quite a leap (at least for me :)) from reading the theory to understanding the more complex examples.

     

    Cheers all.


  9. Unfortunately, I'm almost 100% sure you're not right.

     

    With this On staement

    ON gc.id = sc.general_coffee_id

    In the SQL (along with the WHERE general_coffee id =3), but this ON statement

    ON s.id = sc.size_id

    ommitted from the SQL query, there are 30 results with duplicates of the SKUs, therefore this SQL

    ON gc.id = sc.general_coffee_id WHERE general_coffee_id =3

    does not limit the query to 10 results. It gets all ten types of specific coffees (which is obvious because there are only 10 types) but it also allows for duplicate records of the returns, which is 30.

     

    This code

    ON s.id = sc.size_id

    removes the duplication, and I would like to know why if someone knows.

     

    Also, as mentioned in the OP, the 30 rows with duplicates must represent the total value of something but what.

     

    Maybe Larry or someone else can answer when he has time.


  10. Thanks for trying, but you didn't answer the question that I was trying to ask. it's my fault for not being clear enough :)

     

    I understand the general purpose of ON. However, I didn't understand how this PARTICULAR ON worked in this instance. Namely, why does useing the limit of

    ON s.id = sc.size_id

    produce a result with 10skus and none of them repeated. In order to answer this question, you would probably have to look at those tables (see images below), and not just the theory behind ON.

     

    In other words, I looked at those tables, and I never would have thought that creating a query of

    ON s.id = sc.size_id

    would produce a list of the 10 Skus with no repeats.

     

    How did Larry know that creating that ON would limit the results to the 10 unique skus with no repeats.

     

    Here are the two tables for your reference. Why does joining them where s.id = sc.size_id create a result of 10 (no repeats), whereas a list of 30 is created without this join. How does the join eliminate the repeats.

    scsize.jpg

     

    scspecific.jpg


  11. UPDATE: note, to save you some time reading, you may want to read my next post (the third post on this thread) instead. After Matt responded to the OP, I realized that the OP might not be clear enough, because Matt answers a question that I wasn't trying to ask. In the third post below, I hopefully make the question clearer.

     

    In an effort to better understand this SQL quoted below (which is from page 196), I ran this SQL twice, except the second time I ran it, I removed from line 4 this code

    ON s.id = sc.size_id

     

    the first time I ran it, there were 10 results, with 10 different SKU ids. In other words, no duplicate results.

     

    The second time I ran it (removing ON s.id = sc.size_id), there were 30 rows returned, and therefore many duplicate results.

     

    the problem is, I don`t understand

     

    a) how s.id = sc.size_id limits the results to 10 without allowing duplicates.

     

    2) why, upon removing that code, did it return 30 results, as opposed to 27 or 94. 30 must represent the total number of something but what?

     

     

     

    
    SELECT gc.description, gc.image, CONCAT( "C", sc.id ) AS sku, CONCAT_WS( "-", s.size, sc.caf_decaf, sc.ground_whole, sc.price ) AS name, sc.stock
    FROM specific_coffees AS sc
    INNER JOIN sizes AS s ON s.id = sc.size_id
    INNER JOIN general_coffees AS gc ON gc.id = sc.general_coffee_id
    WHERE general_coffee_id =3
    AND stock >0
    ORDER BY name ASC
    LIMIT 0 , 30


  12. On page 194, Larry gives us code to populate our databases. For example,

     

    INSERT INTO 'non_coffee_categories` (`category`, `description`, `image`) VALUES
    ('Edibles', 'A wonderful assortment of goodies to eat...', 'goodies.jpg')

     

    In the paragraph below the code,it also says the images should be placed in the products directory.

     

    I executed these commands and, indeed, when I check the database with PhpMyAdmin, I can see the records, but I don`t understand something about the image.

     

    Is there an actual image in the database, or is it merely a record of the image?

     

    If there is an actual image in the database, how did it get there? The SQL quoted above says to put an image into the database, but I don`t understand how it actually gets the physical image (from where?) and puts it into the database, as there is nothing in the SQL that specifies where the image comes from etc.

     

    Note, I am searching around in PHP my admin but I don`t know how to check if it`s an actual image or merely a record of an image that`s being associated with the other content.

     

    I`m guessing that in the database, it is merely a record of an image that is somehow associated with the images that are placed in the products folder, as Larry specifies, but please confirm if you can. Also, if that`s correct, why is it necessary to create a mere record in the database and how (i.e. what script) does it get associated with the image in the products folder.

     

    Thanks


  13. I`m looking at the tables that are being created on page 169 of teh book.

     

    In each table, Larry creates a Primary key(id) and also usually some other keys. For example in the carts table

     

    Key 'product_type' ('product_type`, `product_id),
    Key 'user_session_id' ('user_session_id')

     

    I understand the syntax of these keys (thanks to another thread on the forum) but I don`t quite understand why these keys are created, and, conversely, why other keys were not created.

     

    What wouldn`t you be able to do if these keys weren`t created?

     

    Are these keys necessary for subsequent SQL statements, like a join?

     

    I`m asking this so that, when I hopefully/eventually create my own MySQL databases, I will know what situations will require creation of extra keys.

     

    Thanks if you can help


  14. I originally used example.com just to avoid putting my own domain on a public forum.

     

    With checkout.php, instead of creating a link like this https://titanicraisins.c8.hostexcellence.com/checkout.php?session=72cac503b52a73308af0508fe462090a

     

    it's just creating the regular url www.titanicraisins.com/checkout.php, but when I try to visit that link (i.e. to checkout), my browser gives me a warning about the link that it could not be verified and there is an https: in red letters in the url bar.

     

    I don't know on what basis you say checkout.php has to be moved somewhere else on my server. That wasn't the case for any of the admin files, and my host provider didn't say anything about that.


  15. You didn't really answer the question I asked, as far as I can tell.

     

    Assuming that $row[0] is the id from the query and $row[1] equals the category, then what do those array elements do in relation to the form. Why do they need to get repeated every loop? What do they do?

     

    If Terry was trying to suggest that the $row[0] was Dark Roast and $row[1] was Kona, then I don't think you are correct.


  16. At the bottom of the code shown below (from page 328 of the book), which creates the form for adding a specific coffee, Larry uses $row[0] to create an option value and then $row[1].

     

    I'm assumign that $row[0] = id from the query, and $row[1] equals category from the query defined a few lines above.

     

    If that's correct, are these values visible somewhere in the form? what do they do? I've attached an image below of the General Coffee Table form but don't see where the $row[0] and $row[1] would be represented...

     

    sform.jpg

     

     

    <h3>Add Specific Coffees</h3>
    
    <form action="add_specific_coffees.php" method="post" accept-charset="utf-8">
    
    <fieldset><legend>Fill out the form to add specific coffee products to the site.</legend>
    
    	<div class="field"><label for="category"><strong>General Coffee Type</strong></label><br />
    	<select name="category"><option>Select One</option>
    	<?php // Retrieve all the categories and add to the pull-down menu:
    	$q = 'SELECT id, category FROM general_coffees ORDER BY category ASC';		
    	$r = mysqli_query ($dbc, $q);
    		while ($row = mysqli_fetch_array ($r, MYSQLI_NUM)) {
    			echo "<option value=\"$row[0]\">$row[1]</option>\n";
    		}
    	?>

×
×
  • Create New...