-
Posts
15,266 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
Then scootstah's idea is still right, but it's $post->data that should be iterated on if at all. $blog_posts is an array of objects and each object has a ->data array of values. foreach ($blog_posts as $post) { foreach ($post->data as $post_data) { However I suspect that ->data will always contain exactly one value, in which case the inner loop isn't necessary and you should just use $post->data[0]->post_url.
-
Sure. One way would be to "capture" the letters and numbers, then piece the two parts back together. I felt like drawing some ASCII art. Probably because I'm really tired. "ABCD 1234" / | \ / | \ V V V ______ ______ / \ / \ | | | | /^([A-Z]{4}) ?([0-9]{4})$/ | | | | \________/ \________/ \ / $1 \ / $2 \ / V V "$1$2" | V "ABCD1234"
-
The simplest way would be (space)? like /^[A-Z]{4} ?[0-9]{4}$/ but there are a few other ways. It depends on what your expression is. By the way, what is it?
-
I wouldn't be too surprised if it was the jelly beans (reacting with something, that made me sick a couple nights ago... really, please try to keep up) because I've been eating a lot. Which I've already said (which you'd know if you have been keeping up) but could use a bit more emphasis. Have a 3lb cylindrical can thing of them and I'm through 1.5lbs of it. But when I put it that way, considering I've had it for a bit more than a week it really doesn't sound like I'm going through them *that* fast. But the absolute measurement doesn't matter if the relative measurement is "enough to make me sick", right? This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=358254.0
-
Well, it seems you already know that $_POST["checkbox"] is an array of the checkboxes the user has selected, so... use that to determine what you want to show in the second form. Can you be more specific about what you're not sure how to do?
-
Not if you can't wait three hours on a Sunday night. Fix what problem?
-
What does echo getprotobyname("tcp"); output?
-
...Of course I wrote my previous move (the one from a few minutes ago) assuming that it was the only move I'd be making tonight. I was wrong. But seriously, I don't feel so great. I need to lie down. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=358185.0
-
The "enc" in enctype is for encoding, not encryption. Error messages like "undefined index: foo" have nothing to do with JavaScript or AJAX. They're just normal PHP error messages. Post your full code and the entire message you're getting.
-
I've been eating way too many jelly beans lately. My stomach has been complaining about all the sugar, and meanwhile I'm not eating enough real food because I keep spoiling my appetite. So I'm not quite in the mood for putting some weird thing in here. (If you didn't see my last move message, I talked about food. Got tired of just changing the one "this topic has been moved" message, now I'm trying other things.) It's also 4am and I should be sleeping right now, so... This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=358182.0
-
Executing code after function has finished loading?
requinix replied to GuitarGod's topic in Javascript Help
Yes: put it into load_elements() instead. Specifically, put it at the end of the bit that loads (asynchronously I assume) the tables and divs. -
If you don't mind refreshing the page then you just use normal PHP form handling stuff. If you don't want to refresh then look into a little thing called "AJAX"...
-
Where's .ajaxForm defined? Where are PN and frmFeilds coming from?
-
You have to give a name that list.
-
Then what's your code?
-
INT versus VARCHAR (ie, number versus string): - Use numbers if the data is a number. An actual number. Just consisting of digits isn't enough (but does get you far). - Use strings for just about everything else. Default value versus empty versus NULL (ie, there's always a value versus the field can be left literally empty versus using a NULL: - Use default values when you need a value all the time and simply might not have collected it. As in "if I don't have a number then I'll assume it's X". - Use an empty value... Off the top of my head I don't have any examples of when you should do this. - Use NULL when you want to indicate that the data is missing. Not there. You don't have it. NULL is not a value - it is an absence of a value. Based on that and what I can guess about your purpose, I say a NULLable INT field. Stick a number in there when you have a number, or leave it as NULL when you are missing a number. Beyond that general advice and assumptions with it, what is this field for?
-
Populating a table with gaps in the SQL results
requinix replied to idontkno's topic in PHP Coding Help
First I have a couple questions: why are there three columns and what are they for? -
If by "PHP comform" you mean "work", then mysqli_query() can't run multiple queries. Luckily mysqli_multi_query can.
-
There's typecasting, number functions, string checking, // for example, (int)$_GET['v'] floor($_GET['v']) == ceil($_GET['v']) (float)$_GET['v'] == ($_GET['v'] + 0) ctype_digit($_GET['v']) or regular expressions which you shouldn't use because there's plenty of better options.
-
Jelly Bellys. So there are "recipes" of ones you can eat at the same time. The most well-known one is probably mixing a couple peanut butter jelly beans with a couple grapes. I have to say it's pretty good because they actually do taste like peanut butter and grapes, but I have one issue: the peanut butter flavor is too weak compared to the grape. Instead of a 1-1 ratio it takes more like 3-1. Weird thing, this has got to be the most famous recipe so why isn't it listed on their site? I see candy apple, tiramisu, and lemon meringue pie, but nothing about peanut butter and jelly sandwiches. Are they just not popular anymore? Personally I prefer peanut butter and chocolate (Nutella, specifically) but whatever. Which can't be that weird because Reese's is popular... Mind you peanut butter + Nutella sandwiches don't really taste like Reese's candies, but that could just be because of the type of chocolate. Like they use milk or dark chocolate while Nutella is based on hazelnut. Which reminds me, I have a jar of it in the cupboard, but it's been so long since I've used it that it might have turned into an oily mess by now. I know it's just the various oils and such separating but it looks like someone poured a teaspoon or two of water right into it and that just kinda puts me off the whole thing. Same for peanut butter for that matter except the "water" isn't clear. Dirty water. And mixing everything back together isn't so bad but it gets the knife dirty on the handle, which really bothers me because then my fingers get dirty and I have to stop what I'm doing and go wash my hands. I already do that enough each day, I don't want to make more reasons for me to do so. But beyond the oily mess there's also stuff getting stale. Stale Nutella is a pain because it's stiff and hard to deal with, and the kind of bread I like most is very soft and easily rips apart so spreading it on can be a real labor. Best method I've found is to spread a little bit on at a time but it takes so long to cover the whole face. Fine, it's a good sandwich, but in that same time I could have done something else. Maybe there's something in the freezer I could quickly heat up, or maybe there's some leftovers in the fridge I could eat. And if not there's pretty good odds that I need to go to the grocery store anyways. Ah, sorry. Forgot why I'm here. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=358112.0
-
Make a MySQL function that looks something like SELECT @i = SUBSTRING(tag_id, 2) FROM tags ORDER BY LEN(tag_id) DESC, tag_id DESC LIMIT 1; RETURN CONCAT("c", @i + 1); If you need the number padded to at least two digits then throw in an LPAD. Be sure to use a transaction in case two INSERTs try to run at the same time.
-
Are you making the file include() itself?
-
What would come after "c99"?
-
Ternary. It's called the ternary operator.