-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
oh man i feel you. I was up until 3a getting thoroughly wasted, only to have screaming kids jumping up and down on my bed at about 6a. My head hurts so much I wanna vomit my brain out
-
You should try out the search function, there are literally thousands of threads asking this exact same thing, even with the same bbcode style tag.
-
Get content from table into a list, without repeating.
.josh replied to nonexistentera's topic in PHP Coding Help
select distinct(author) from quote -
php is trying to execute getimagesize at the time that you are assigning the value to the array element, not when you are actually performing the preg_replace. Outside of preg_replace, $1 means nothing but a literal $1 so getimagesize is trying to find a file literally called '$1' You are going to have to reorganize your code. One way to do it would be to wrap the entire array element value in quotes (whole thing, function calls and all, so none of that stuff gets executed; php treats it as just some random string for now), and use the e modifier for preg_replace, which will cause php to parse the replacement argument in preg_replace as if you were running eval. Doing it this way will have that whole value "...getimagesize('$1')..." evaluated as php code, but since it is actually evaluated inside the preg_replace call, $1 will actually mean something. The danger to doing this though is if your preg_replace fails to make a match and capture, or if it captures something unexpected, or if the image just doesn't exist, you're going to get the same error thrown up at you, and there's nothing you can do to safeguard against that. In light of that concern, another, better way to do it would be to first preg_match for the pattern and then use the returned value from that, instead of $1. Somewhere in-between your preg_match and getimagesize, you can check to see if the image actually exists, before you try to getimagesize it.
-
should probably strtolower the session var too... $moderators = array('Admin', 'banana', 'orange'); if (in_array(strtolower($_SESSION['user_name']), array_map('strtolower', $moderators))) print('Found it!');
-
echo $uploadfile or view the output source and look at your href. Does it contain what you expect? My guess is you probably want to use $filename instead of that $_GET...
-
You probably got the off-brand sharks-with-laser-pointers then. Next time, don't be so skimpy.
-
oh come on now, why do you feel the need to lie? If you really tried sharks with lasers, you wouldn't have posted, as that would have definitely worked.
-
php is a server-side language, parsed on the server. It cannot do this sort of thing.
-
You could try telling them to stop. If that don't work, get a large dog, that usually scares people away. If that still doesn't work, I suggest looking into getting sharks with lasers.
-
it always makes me loll when someone bitches about sci-fi not being realistic/believable (enough). I think many people forget what that "fi" is short for...
-
This is not what we are here for. Read the rules.
-
if I'm not mistaken, a windows 32-bit OS can only use up to about 3gb or ram. You will need to upgrade your processor (which may involve upgrading your mobo, which in turn may involve upgrading other things like your power box), and OS.
-
what is the actual date? Is it a pre-1970 or post-2038 date?
-
are you specifying a cookie file for the target server to store its session cookie? http://www.php.net/manual/en/function.curl-setopt.php#57005
-
what format is $date ? probably date does not recognize the format you are using.
-
are you trying to login to something or just post data to something?
-
bestbuy/geeksquad? anyways...even McJobs make you sign a non-compete, so more than likely something you signed did mention it. However...freelance work is kind of a big gray area. Especially if you're not officially invoicing anybody or reporting the $$ to Uncle Sam. You can ask your boss, but more than likely (s)he will default to the "safe" answer, which is inevitably "No". I personally would ask to see the paperwork yourself, get a copy of it, ask a lawyer if you can, post it on some forums and get some opinions if you can't, see what the general consensus is. But the reality here is you are just one dude making a quick buck vs. a huge company. The odds are overwhelmingly stacked in your favor that nobody is going to notice, especially if you don't go out advertising it to the world that you work for this company. And even if your employer did notice, more than likely they will probably just fire you, as it's probably not worth their time/effort to bother pursuing something farther than that... ...But that mostly hinges on how you are getting this business... are you directly undercutting your employer? As in "Hi, thanks for calling <employer>, this is hopelessX, how may I help you? Oh, you need an OS install? Well we charge $189, but I tell you what, I'll swing by and take care of that for $75, cash under the table" - see that will get you in trouble for sure.
-
probably a stupid question, but I assume when you say you have this: $_SESSION['city'] = "Miami"; $_SESSION['state'] = "Florida; you really have something more like this, right? $_SESSION['city'] = $_POST['city']; $_SESSION['state'] = $_POST['state']; because if you have the former...well you are using hardcoded values...
-
looks like your table name is typoed. Also, in your mysql_result, for some reason you changed 0 to 10. that 2nd argument represents which array element (column). Since you are only querying for 1 column (the count), it needs to stay 0. Also, in your condition ,you are simply assigning a string to a variable, which will always be true. $query = "SELECT COUNT(*) FROM 'adccmembers'"; $number_of_users = mysql_result(mysql_query($query), 0); if ($number_of_users > 30) { $sorry = "<div id=\"warning-box\"><p class=\"main-text\"><span style=\"color:#ff0000;\">Error</span>: Sorry, There are no more spots available.<br /><br /></p></div>"; } else {
-
No, you don't want to use extract, for the same reason why you don't want to dynamically create a million individually named variables. And why is that? Well what are you going to do with them then? $x1 $x2 $x3 $x4 etc... You can't easily loop that or apply something to all of them etc.. that's the whole point of an array: a list of variables you can easily manipulate.
-
Looping through your variables is easy when you use an array. Which is what $_POST is. Try using a foreach loop. Or, perhaps it would be better if you explained what you are trying to do here, because there are very few reasons why you would need (or want) to make individual variables out of array elements.
-
[ot] mysql_fetch_array($result, MYSQL_ASSOC) is the same as mysql_fetch_assoc($result) [/ot]
-
http://www.phpfreaks.com/tutorial/php-basic-database-handling