|
| 12 Jan 2012 04:28 PM |
I've already read 130 pages and I just got it a few hours ago. So, you were expecting a PHP fragment.
function fixName($fname, $lname) { return ucfirst(strtolower($fname)) . ucfirst(strtolower($lname)); } fixName("beAU BLanK");
=> Beau Blank |
|
|
| Report Abuse |
|
|
LocalChum
|
  |
| Joined: 04 Mar 2011 |
| Total Posts: 6906 |
|
|
| 12 Jan 2012 04:29 PM |
| Why read a book when you can read up-to-date documentation? |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 04:31 PM |
| this book was published in 2011 and is very thorough |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 04:36 PM |
| If the book teaches anything about the MySQL connections and it still uses the procedural old MySQL interface and not MySQLi, it's not up to date. If it does use teach about MySQL connections and uses MySQLi, I approve. |
|
|
| Report Abuse |
|
|
LocalChum
|
  |
| Joined: 04 Mar 2011 |
| Total Posts: 6906 |
|
|
| 12 Jan 2012 04:38 PM |
@poke
I personally HATE how MySQLi looks. I generally like OOP, but I just don't like MySQLi at all. |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 12 Jan 2012 05:04 PM |
@Poke I personally don't care enough to learn MySQLi, mainly because I've gotten used to my mysql_ functions.
~THROW THE CHEEEEEEEEEEEEEEEEEEEESE!~ |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 05:33 PM |
"@Poke I personally don't care enough to learn MySQLi, mainly because I've gotten used to my mysql_ functions."
I hate that logic, thinking like that only contributes to how slowly progress is sometimes made in the technology industry, and you're also adding to the stereotype of PHP being horrible spaghetti code that never utilizes OOP. For an example of how that kind of thought slows down progress, take a look at the transition between the x86 16-bit to x86 32-bit. Intel had to pull off a horribly hacky way of implementing it to keep legacy applications written by short-sighted programmers who thought "oh, I'm used to doing this, I think I'll do it even though it's not recommended" working still. What was this horribly hacky way you ask? The A20 line. A brief statement on how processors work: Almost every single processor that runs x86 assembly code starts off in 16-bit mode to maintain legacy with 16-bit applications (which shouldn't be necessary, if programmers had followed recommendations the problems behind why they were forced to maintain legacy in such a way would never have risen), and the kernel/bootloader must enable something called the A20 line in order to enter 32-bit mode. On some modern processors/motherboards there are thankfully simple BIOS calls that make this easier, but none are guaranteed to work, and the fallback in case it doesn't work is stupid, working by sending signals to the keyboard controller. Luckily, the transition between 32-bit and 64-bit wasn't as bad as far as I'm aware, but the fact that processors still have to start out in 16-bit mode is quite sad. |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 12 Jan 2012 05:38 PM |
@Poke I see no reason why MySQLi is better, plus all my code would take ages to switch over, so I don't intend on switching to MySQLi anytime soon.
~THROW THE CHEEEEEEEEEEEEEEEEEEEESE!~ |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 05:54 PM |
"I see no reason why MySQLi is better"
Faster; supported by the PHP team while the old MySQL interface is not; has more functions than the MySQL interface does; neater and utilizes PHP's OOP interface; probably some other stuff I'm forgetting.
"plus all my code would take ages to switch over, so I don't intend on switching to MySQLi anytime soon."
More bad logic. Hint: It's INCREDIBLY easy to switch from MySQL to MySQLi, so easy that people have actually written programs that can do the conversion for you. If you're so lazy that you don't even want to do that, just add an "i" after "mysql" in all your MySQL functions, because it provides a procedural interface to make switching easy for lazy people (oh look, more legacy support that isn't needed!). |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 12 Jan 2012 07:29 PM |
a) OOP isn't necessarily better in all cases. b) My website loads about as fast as google.com... And I'm hosting it on my home PC. And I'm using mysql functions. c) Name some useful functions in MySQLi that don't exist in mysql.
~THROW THE CHEEEEEEEEEEEEEEEEEEEESE!~ |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 08:21 PM |
"a) OOP isn't necessarily better in all cases."
Of course not, but it provides some extremely nice features and nice looking syntax, especially in the case of MySQLi.
"b) My website loads about as fast as google.com... And I'm hosting it on my home PC. And I'm using mysql functions."
Well of course it's going to, for several reasons. For one, if you're accessing your own site on your own machine from your own machine or local network, it's not going to take very long for your machine to resolve to itself and connect to itself. If it still loads as fast on other networks, then you're likely not using that many queries on one page, so you're not going to see a large impact. However, on larger web pages, switching to MySQLi will be faster, and offers functions that MySQL doesn't that are useful for this case. Which brings me to my next point...
"c) Name some useful functions in MySQLi that don't exist in mysql."
Most notably is prepared statements. They're very efficient, useful, and if used properly can cut down the size of your code. Other notable things (I'm pulling these out of the PHP MySQLi manual since I don't remember them all off the top of my head. Also, this includes properties as well as functions, as MySQLi provides some neat properties that MySQL doesn't) include functions for transactions (such as mysqli::commit, though I've never learned how to use them because to me they aren't useful, but they are for a lot of sites), support for multiple queries in one statement through the mysqli::multi_query function, mysqli::warning_count returns the current number of warnings, the list goes on. In fact, you can find the whole list of MySQLi functions and compare them to the list of MySQL functions on PHP's website, where they state under the MySQLi documentation that they strongly recommend you use it over MySQL since MySQL is outdated. |
|
|
| Report Abuse |
|
|
GigsD4X
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 3794 |
|
|
| 12 Jan 2012 09:28 PM |
Everything pokelover just said.
You shouldn't read a PHP book :U Just read from the official site! |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 09:41 PM |
"but the fact that processors still have to start out in 16-bit mode is quite sad."
They still have to?
They should just not care about those idiotic programmers. If they do it the old way, then it's their fault, and too bad for them if they get errors or if their method isn't supported anymore.
I think that, overall, compatibility is given too much importance to.
I hate it whenever someone uses something that's deprecated.
I also hate how people tend to learn from books. Books are outdated and shouldn't be used, in my opinion. You can find more up to date documentation on the web.
I hate how everyone is doing efforts for those that are too lazy to actually stop using deprecated and old stuff.
Instead, we should force them to change to the new stuff. Of course, we can still support the old stuff for some time. But just 3 months is already too much, in my opinion. It shouldn't take anyone 3 months to be able to use the new stuff. Therefore, if after 3 months, they're still using the old stuff, then that means they're not dedicated to changing to the new stuff and they won't unless we force them to, by removing the old features.
Seriously, if we didn't have to care about compatibility at all, imagine how faster technology would evolve... |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2012 09:43 PM |
| I'm reading an AJAX book, and I'm on chapter 2. I've had it for 2 weeks muahahahha |
|
|
| Report Abuse |
|
|
GigsD4X
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 3794 |
|
|
| 12 Jan 2012 09:57 PM |
| Why would you need a book on AJAX?!?! |
|
|
| Report Abuse |
|
|
LPGhatguy
|
  |
 |
| Joined: 27 Jun 2008 |
| Total Posts: 4725 |
|
|
| 12 Jan 2012 10:51 PM |
It just can take long to port over very large code bases.
It would be like asking someone who wrote something for C# 2 and XNA 2 or whatnot to convert up to C# 4.5 and XNA 4R. It's just not worth it.
Sure, new stuff, use MySQLi. I just wrote something today using MySQL, because the rest of the project, which was written 4 years ago, didn't use MySQLi. |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
| |
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 13 Jan 2012 10:16 AM |
I don't pronounce it "MySquel", I pronounce it MySQL".
~THROW THE CHEEEEEEEEEEEEEEEEEEEESE!~ |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2012 12:29 PM |
Same @Jode. It's an acronym, not a capitalised word.
Anyway,
Why not just use PDO (No, not that. It's Prepared Database Object, if my memory serves me) It's much bettar, can you can use the same query for multiple things without retyping, and use prepared statements-- No sanitizing or desanitizing, and no SQLi! :D |
|
|
| Report Abuse |
|
|