HartleySan
Members-
Posts
3047 -
Joined
-
Last visited
-
Days Won
243
Everything posted by HartleySan
-
No, you're not. The actual characters in the string should be completely irrelevant. The whole point of mysqli_real_escape_string is to escape characters that could potentially harm a DB query. That's it. The actual characters in the string should not cause the function to fail. Are you sure your DB connection and all of that is valid?
-
There is overlap between the advanced book and the e-commerce book, but I think the e-commerce book focuses more on online payments, security and advanced MySQL queries, whereas the advanced book focuses more on OOP and advanced stuff in PHP. I personally think that the e-commerce book is more practical, but again, they're all worth reading and good to know about if you're serious about web development.
-
Normalization Is Unclear.
HartleySan replied to Edward's topic in MySQL: Visual QuickStart Guide (2nd Edition)
If one category can have multiple items, and an item will never be in more than one category, then I would have a table to describe all the categories, and then in a separate table that contains all the items, I would have a column for the category ID to act as a foreign key to link the two tables. That make sense? -
Charset
HartleySan replied to fingers's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
They're the same, but for the argument you pass to set_charset, you have to use the string 'utf8'; 'utf-8', 'UTF8', etc. will not work. -
I think it depends on where you want to go with your learning. If you want a more well-rounded view of the web and making sites, I recommend the JavaScript book. If you want an e-commerce site and want to better understand web security, then I recommend the e-commerce book. And if you want to just be really good at PHP, I recommend the advanced book. Really, they're all worth reading, but I would recommend the JavaScript book first. Also, the Yii book is pretty good, if you want to learn a framework.
-
MikeMikeMike is an older forum member that had several uncomfortable exchanges with other people on this forum. No one has seen him around for ages though.
-
In my personal opinion, Flex is becoming less and less useful, like you said. it doesn't hurt to know Flex though, as a lot of the programming concepts found in Flex carry over to other languages (after all, ActionScript and JavaScript are both based on ECMAScript), but I agree with you that your time would be better spent learning JavaScript if your goal is to make yourself relevant and marketable. Still, Flex is an interesting thing to learn as a hobby (and there are still the occasion jobs that float around that ask for Flex devs, which there aren't many of anymore). Hope that helps, and welcome to the forums, kelvin.
-
Because your while loop is not set up correctly. Something like the following should get you there: $i = 0; while (something) { if ($i % 4 === 0) { // echo tr start tag. } // echo td tag with img. if ($i % 4 === 0) { // echo tr end tag. } $i++; } Better than that solution though, you could just use CSS to set the td widths to 25%, or even better than that, you could not use a table at all (tables are for tabular data!), and instead used an unordered list or just images that are either floated left or have the inline-block display property. That all make sense?
-
I'm not sure I understand your question, but it sounds like you're asking what to do when $_POST['tag'] is an array, and not a number. If $_POST['tag'] is an array of numbers, then you can use a for loop or a foreach loop to loop through the array, and run the filter_var function on each of the elements in the array. If the values are strings, then you can easily typecast the values to integers with (int). That answer your question (assuming I even understood it correctly)?
-
Sounds good. Once you have the PHP and front-end code down, it's always good to try and set up PHP, etc. on your own. Thanks for sharing your experiences.
-
laurent, there are actually a lot of issues with your code, but in general, it seems like you do not have a fundamental grasp of the difference between strings and arrays, and how they're used. Please do me a favor and start at the beginning of Larry's book and any other basic PHP tutorials you can find to get the basics down. Once you have the basics down, I think the rest will fall into place. Thanks, and sorry if I hurt your feelings/pride at all.
-
The problem is that you're using the variable $tag for two different purposes. If $tag is an array, then you start to loop through it, and then you add another string element onto the end of the same $tag array, which is incorrect. Furthermore, your approach to doing a multiinsert is incorrect. You have to build up the query string with multiple sets of parentheses. For example: $q = "INSERT INTO pages_tag (page_id, tag_id) VALUES"; if (is_array($tag)) { foreach ($tag as $tag_id) { $q .= " ($page_id, $tag_id)"; } } else { echo 'loupé coco'; } $q .= ";"; echo $q; // This is the actual query string you want. Please note that this code will leave you with an ill-formatted query string when $tag is not an array. You should account for that.
-
Text Areas
HartleySan replied to briansgl's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
As Antonio said, using a solution that already exists would probably be best. It's not necessarily that hard to do, but it does require a decent amount of JS knowledge, and how to handle cross-browser issues.