HartleySan
Members-
Posts
3047 -
Joined
-
Last visited
-
Days Won
243
Everything posted by HartleySan
-
I'm having a lot of trouble following your code. I think it would help if you used the <> button in the editor to better format and color code everything. As a general answer to your question though, you can either pass back true/false from the subfunctions to the main function and return that, or you can have an independent Boolean, whose value is calculated based on some sort of condition(s). I know that probably doesn't help much, but without cleaning up your code more, there isn't much we can do to help.
-
NULL and an empty string are two different things. An empty string means that there is a value, but that value is nothing, whereas NULL is the absence of a value. As such, depending on your data and what it's being used for, you need to make the determination for which you think is best in which scenario. This may offer further info: http://programmers.stackexchange.com/questions/32578/sql-empty-string-vs-null-value As for setting NULL in SQL, when you send the parameters to your PHP script, if something is set to an empty string, then you have to set it to NULL. If you're using a regular mysqli_execute function call, then the following is one way of handling it: $param1 = $_POST['param1'] !== '' ? $_POST['param1'] : 'NULL';
-
It's nothing, really. I just have more familiarity with JS than most people. Anyway, enjoy the rest of your holidays.
- 3 replies
-
- regular expression
- test method
-
(and 1 more)
Tagged with:
-
Hello and welcome to the forums. In my opinion, this is still the best book for getting started with PHP/MySQL. Virtually everything in it is still relevant, and most importantly, it'll give you that great base, which is very easy to build on and use to then learn all of the most recent best practices. In short, don't delay any longer. Start reading and writing code, as this is still the best PHP/MySQL book around.
-
Php-Not-Read-W-Html
HartleySan replied to phred's topic in PHP for the Web: Visual QuickStart Guide (4th Edition)
First off, localhost is local only to you, meaning that the URL you posted will not work for anyone else. More importantly than that though, you need to change index.html to index.php and then run the script through a server. Do you have XAMPP or some other server software installed? -
It's pretty simple to do what you want. The first thing to do is load the initial images for each product on the page. This is basic HTML. Once that's done, then use JS to load all the images that are used when a color swatch is moused over. All of those extra images can be simply loaded into the DOM and hidden, or "displayed" but hidden out of the bounds of an element with overflow: hidden, etc. Point being, there are any number of ways to hide all the other images, but have them readily available for swapping in and out. Also, when the page loads, you'll want to set up mouseover event handlers for each of the color swatches, and then swap the currently displayed image out with the moused-over image each time a color swatch is hovered over. Again, there are any number of specific implementations that are possible here, but the general principle is the same. Lastly, if you want to support smartphones and tablets, know that they don't support mouseover events, so you'll have to set up a click event for the swatches on mobile. Hopefully that answers your questions.
-
It's because the second argument you're passing to the function is a string literal, not a regular expression literal. In PHP, you have to declare regexes as strings, but in JS, regexes have their own type (and should not be surrounded by quotes). You would only ever use a string for a regex in JS if you're using the RegExp constructor, which you're not. Short answer: If you want to do a regex literal, which I assume you do, take the quotes off the second parameter being passed to the function. That will fix that error. As for the error message you're getting, you're getting it because there is no test method for strings in JS, just regexes.
- 3 replies
-
- 1
-
- regular expression
- test method
-
(and 1 more)
Tagged with:
-
I worked as a developer for about eight months for a fairly larger online clothing vendor, and as far as I could tell, they had an entire marketing team that decided which picture/color should be the default for each product. Of course, below the main image for a product were the color swatches, which you could click on any one of them to switch the color/image displayed. I guess the point is, if you're a small operation and don't have the time/money to invest in such things, just pick whatever you think is best, or always have it be black, etc., or have it be random. Truth be told, while I'm not in expert in that sort of thing, that seems like the kind of optimization that is probably not worth worrying about during the initial building of your site.
-
The Form On Submit
HartleySan replied to ionezation's topic in Modern Javascript: Develop and Design
If window is undefined, then there is definitely some really weird stuff going on. Unfortunately, without more knowledge of your code and setup, it's hard to help. My guess though, is that an error farther up the script is causing the script to shut down midstream. -
There's no right answer, but always using curly braces is (I think) clearer, more consistent and makes your code easier to read. Furthermore, I think Larry recommends that in the JS book in particular because the most popular JS code checking tool, JSLint, will throw an error if you don't use curly braces every time.
-
The Form On Submit
HartleySan replied to ionezation's topic in Modern Javascript: Develop and Design
angel, what errors, if any, are showing up in your browser console? Thanks. -
How Common Are Part Time Developer Positions?
HartleySan replied to a topic in Newsletter, Blog, and Other Topics
Buttercream, just try to relax a bit. It wasn't a bad question to ask, I was just simply stating that it's not really a question that can be easily answered based on my experience. If you want to know the truth, the best thing you can do is not act like you just did in your previous post. Your previous post sounded a bit on the immature side (and please excuse me if I misinterpreted what you wrote). If you want to get a job as a developer, learn the trade well (but you don't need to be an expert), and then apply for jobs in your area, and if you score an interview, go in there and be professional and confident. If you really want to be a developer, the first job is all about getting your foot in the door and building up experience and connections, even if you don't like the job that much or it doesn't pay well. -
Why Won't The Script Call My Init() Function?
HartleySan replied to a topic in Modern Javascript: Develop and Design
While I personally don't like JSFiddle (and I while I was being a bit facetious in my remark about JSFiddle), it's not a bad prototyping tool. As long as you're aware of its limitations, etc., you can still use it to get you 90% there. -
How Common Are Part Time Developer Positions?
HartleySan replied to a topic in Newsletter, Blog, and Other Topics
In my opinion, it's impossible to generalize your questions into meaningful answers. I think you're best to look at the local job listings and talk to some local recruiters to get a better idea of what is actually available in your area. If you see something close to what you want, then I would then inquire into part-time possibilities, etc. -
Why Won't The Script Call My Init() Function?
HartleySan replied to a topic in Modern Javascript: Develop and Design
Probably because JSFiddle sucks. But in all seriousness, I imagine that any code you type into the JSFiddle textarea is going to behave slightly differently than regular JS. Edit: Here's the answer: http://stackoverflow.com/questions/5468350/javascript-not-running-on-jsfiddle-net -
How To Save A File To Two Computers Simultaneously
HartleySan replied to a topic in Newsletter, Blog, and Other Topics
Did you set up the Ruby interpreter? Did you download the tutorial package? In other words, did you do all the steps between the first few commands and executing "git init"?