INSERT IGNORE will do that, but krues8dr is right, PHP should be doing the work here.
I'd say use INSERT IGNORE as a failsafe, but it would be better (and faster, i believe), to assemble a list of all the urls you want to insert, and try to select them in an initial query, then process the results, remove the duplicates, the do the insert.
insert ignore should prevent the need for a table lock though, as it would catch any that are inserted in the time between your initial query and the insert.
INSERT IGNORE should not give you errors if a url is repeated, but since it's a unique index, you also won't get it inserted, unsure if that's your desired outcome.
also, since you're using prepared statements, there's no need to use escape_string() on your inputs.
note that _get() and _set() methods are significantly slower than directly accessing the method however.
I've been thinking about this issue of no "read-only" properties, and while I think they would be useful - here's the conclusion I came to: unless you're allowing random user code to run without significant checks (in which case, BAD!), there's no reason that a public property would change unless you wrote something to change it.
if a nefarious individual somehow did get to the point where they could change your public variable - then logically they can already run arbitrary code, and you're screwed no matter what.
stay away from frameworks until you have a very good grasp of the bare language - you don't want to be reliant on a framework.
the best way i've found to learn php is just to start building things, and keep php.net open. write simple things, maybe read up a little on some functions at php.net and rewrite things. start simple, build up.
man, 100%. I know this post was on frameworks so the whole "roll your own" thing might be unwelcome, but if you slowly build your own framework over a couple projects- you'll have a better result and be a better coder because of it
not for plywood. this seems to me like an example of a marketing "expert", just out of marketing school, trying to "revitalize" a brand. unfortunately they forgot they were selling plywood, not an ipod. someone who's building a house or whatever doesn't care about how the plywood makes them feel.
how is this a brilliant ad? it says nothing about the benefits of their plywood over a competitors, and beyond the "omg guys the wood looks like water and they put a boat there" it's pretty pointless.
from a design point of view i guess it's... original? i dunno, just seems pointless to me, and from an advertising point of view, there's nothing there that makes me want to buy their plywood, thus, it's a terrible ad.
The date string "h:i a, F j" will print a date in the form:
Said correct answer was "1:23 pm, January 31" however "h" is "12-hour format of an hour with leading zeros" - should be g:i a, F j
you should always check for the value you're expecting. do not use if($var) or if(function())
you shouldn't be using if($var)
ALWAYS check for a value, or use isset() or empty()
INSERT IGNORE will do that, but krues8dr is right, PHP should be doing the work here.
I'd say use INSERT IGNORE as a failsafe, but it would be better (and faster, i believe), to assemble a list of all the urls you want to insert, and try to select them in an initial query, then process the results, remove the duplicates, the do the insert.
insert ignore should prevent the need for a table lock though, as it would catch any that are inserted in the time between your initial query and the insert.
INSERT IGNORE should not give you errors if a url is repeated, but since it's a unique index, you also won't get it inserted, unsure if that's your desired outcome.
also, since you're using prepared statements, there's no need to use escape_string() on your inputs.
note that _get() and _set() methods are significantly slower than directly accessing the method however.
I've been thinking about this issue of no "read-only" properties, and while I think they would be useful - here's the conclusion I came to: unless you're allowing random user code to run without significant checks (in which case, BAD!), there's no reason that a public property would change unless you wrote something to change it.
if a nefarious individual somehow did get to the point where they could change your public variable - then logically they can already run arbitrary code, and you're screwed no matter what.
stay away from frameworks until you have a very good grasp of the bare language - you don't want to be reliant on a framework.
the best way i've found to learn php is just to start building things, and keep php.net open. write simple things, maybe read up a little on some functions at php.net and rewrite things. start simple, build up.
of course as always, google is your friend.
man, 100%. I know this post was on frameworks so the whole "roll your own" thing might be unwelcome, but if you slowly build your own framework over a couple projects- you'll have a better result and be a better coder because of it
not for plywood. this seems to me like an example of a marketing "expert", just out of marketing school, trying to "revitalize" a brand. unfortunately they forgot they were selling plywood, not an ipod. someone who's building a house or whatever doesn't care about how the plywood makes them feel.
just sayin'
how is this a brilliant ad? it says nothing about the benefits of their plywood over a competitors, and beyond the "omg guys the wood looks like water and they put a boat there" it's pretty pointless.
from a design point of view i guess it's... original? i dunno, just seems pointless to me, and from an advertising point of view, there's nothing there that makes me want to buy their plywood, thus, it's a terrible ad.
have you considered re-writing without a framework?
glasses with no lenses
so what caused the movement in the leaves? was it dehydrated then watered?
End of this list.
Back to top