I have reached to chapter 8 in the book with a few small questions I have.
1) the $_POST array- does it delete itself after the script on the page is executed? (I have been thinking that if i have 2 different forms in my site both share some fields in common and in one point I filled in one of the forms and after a of bit of browsing fill in the second form. will the second form processing script will use the first form input?)
2) I noticed as the book progresses the explanations are becoming less detailed (which is understandable on certain parts of the script that uses familiar code)
and some of the code is left unexplained (or not explained enough). this includes the code
header (‘content-type: image/jpeg)
(what does it do? can I use the same concept for other file types?) and the imagecreatetruecolor()
functions (the last two where explained about what they do but not how to use them or their arguments ) in chapter 7. also the join()
function that is (used in chapter 8 page 224) is not explained. this function I actually searched and found in the php documentation and in this place: http://www.w3schools.com/php/func_string_join.asp
and it seems you mixed between the two arguments of the function.
3) I saw many times in the book that when you make an insert query you place the query into a $result variable. I wanted to know if I have to that or I can just make the query
$query = ‘INSERT INTO images (image_caption, image_username, image_data) VALUES (“yadi”, “yadi”, “yada”)’;
// insted of $result = ..
$result = mysql_query($query, $db) or die(mysql_error($db);
// just simply .
mysql_query($query, $db) or die(mysql_error($db);
4) I don't know if you will cover this later in the book (I am right now in chapter 8) but how do I deal with empty fields in the data base or a query that returns nothing?