![]() ![]() $sql_string = $sql_string.$num_kat.") " Did you notice all the ".char(34)."s? Yeah, that's how he/she appends double quotes to the beginning and end of his SQL strings. $sql_string = $sql_string.$num_size.", " $sql_string = $sql_string.$num_track.", " $sql_string = $sql_string.$num_genre.", " $sql_string = $sql_string.$num_length.", " $sql_string = $sql_string.$num_year.", " $sql_string = $sql_string.$txt_song.chr(34).", ".chr(34) OK, I amaze myself of how I cant accomplish very simple tasks sometimes, but I am actually trying to create a doc using ezpdf but cannot get any newlines to work. "NUM_Genre, NUM_Track, NUM_CD, NUM_Size, DAT_Date, NUM_Kat) VALUES " "TXT_Quality, TXT_Name, TXT_Path, NUM_Year, NUM_Length, ". $sql_string = "INSERT INTO naamah (TXT_Artist, TXT_Album, TXT_Song, ". This is a simple echo statement without heredoc notation: So instead of being forced to use double or single quotes, you could instead use EOD or Badger_7 or pretty much anything you want for an identifier, as long as it follows the same naming rules for PHP variables. Said feature is the ability to define your own delimiter. In actuality, heredoc is just another way of defining a string, but with one little feature that makes it far superior to the conventional way of defining strings. I'll go ahead and explain what it is and how it works, then I'll give a few examples of some pretty common situations where it could be used, but often is not. ![]() I've looked at a lot of PHP code where, looking back, heredoc notation could have, should have, and probably would have been used had the developer known about it. It's called heredoc notation, and now that I know about it, I wonder why I've never heard about it before. I finally took a PHP class last semester and I was introduced to a really interesting technique for echoing data (whether it be HTML, Javascript, or just a string) to the browser or saving it to a variable using PHP. I've done web development off and on for the last few years, and since then I've learned my way around PHP fairly well (or so I thought). ![]() I suppose this is as much a rant as it is a guide, but either way, I hope it's helpful to someone! ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |