-
Posts
15,266 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
it equals zero but im still getting an echo?
requinix replied to Allenph9's topic in PHP Coding Help
You're a bit right but mostly wrong. static is an object-oriented thing, yes, but <?php blocks are not classes. If you're staying in the same file you don't need to "static" anything. The <?php blocks only control when PHP works; leaving one and entering another later won't affect your variables. -
it equals zero but im still getting an echo?
requinix replied to Allenph9's topic in PHP Coding Help
Do you know what "static" does? -
it equals zero but im still getting an echo?
requinix replied to Allenph9's topic in PHP Coding Help
Why are you using "static"? -
You can't. Which is why you'll have to come up with something that lets you (and mod_rewrite) tell the difference.
-
Use a JOIN, like JOIN this table again ON this table's parentid = the joined table's id and include this table again.name as one of the fields you retrieve. Throw in a few aliases while you're at it.
-
Do you have access to anything related to cron?
-
Which API is that?
-
Can you not fix the links to output in the right form?
-
Good, because I didn't want to try explaining things if you didn't care about it (no offense, I'm just lazy). You're looking for the exact string "" (case-insensitive). Regular expressions are overkill for that, but you need a count of matches and there is no built-in PHP function that can do that*. So now you have to create a regular expression meaning "literally ''". Two things: expressions need delimiters and [ and ] are special characters. What you had before "worked" because preg_match() accepts a [] pair as delimiters, but that meant you were actually only searching for "img". If you had the string To use img tags use "[img]". there would have been two matches. So the slashes in the expression are the new delimiters, preg_quote() turns an arbitrary string into something safe for regular expressions (turning the [ and ] into \[ and \]), and the /i flag means case-insensitive. Now that you're in the Regex forum, take a look at the stickies we have here. * substr_count() is case-sensitive.
-
Get the dates as timestamps, like what you get from mktime() and strtotime(), and just subtract the two. Timestamps themselves are seconds so the difference between them is also in seconds.
-
preg_match does much more than just look for a simple string. It requires you to actually learn how to use the function rather than just throw stuff at it. if (preg_match_all("/" . preg_quote($string) . "/i", $paragraph, $matches)) {
-
This topic has been tr///ed to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=354498.0
-
You don't need the is_numeric() check because you just floatval()ed it. It will be numeric. Or if you want to reject the request because it wasn't numeric (probably a good idea), move the is_numeric() to before you floatval() it.
-
You intval()ed it. There's nothing else you have to do - including is_numeric() on it, because it will always be numeric (you made it so).
-
You're missing parentheses. As well as a description of your problem. It's nice to include that so we don't have to guess at what you want.
-
If you have multiple inputs with names like "area" then PHP will create one $_POST["area"] and overwrite it for every one in the form. However you can name them with a special array syntax and $_POST["area"] will be an array rather than a single value. You can extend this to multiple arbitrary array keys (so long as there's at most one "[]" and it probably has to be at the end). With that second syntax, "0" would be the ID number of the row, otherwise you'd have to put the ID in the form in its own special hidden field. foreach ($_POST["area"] as $id => $area) { // update #$id, set area = $area }
-
This topic has been belatedly moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=354420.0
-
It does mean "last", as in "this is the last rule for this cycle, don't process any more". Thus mod_rewrite will do the redirect, the rule won't match the next time around, and the silent URL rewriting proceeds as normal.
-
Huh. Right. It would. Derp. Two rules. RewriteEngine on # generic HTTPSify rules, but only gets applied to the profile stuff RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !profile\.php RewriteCond %{REQUEST_URI} /([^/]+)/([^/]+)/([^/]+) RewriteRule !\.(gif|jpg|png|css)$ https://%{HTTP_HOST}%{REQUEST_URI} [L] # URL rewriting RewriteCond %{REQUEST_URI} !profile\.php RewriteCond %{REQUEST_URI} /([^/]+)/([^/]+)/([^/]+) RewriteRule !\.(gif|jpg|png|css)$ profile.php?shopid=%2&shop=%3
-
Add a RewriteCond %{HTTPS} off and change the destination of the RewriteRule so that it goes to the HTTPS location.
-
Help Importing csv file to a specific column in a database table.
requinix replied to php-newbies's topic in MySQL Help
Use whatever phpMyAdmin offers for uploading and importing. What I gave is (apparently) not what you'd need to use. -
Does the remote software offer any logs you can look at? Are the two machines the last in the "list" or are they located at random within? If you shuffle the "list" does the situation change? In your shoes I would be trying three things: finding more information (eg, logs, adding whatever debugging/verbosity options you have available), looking for patterns and similarities and differences (eg, two machines on a different subnet, not all running the same software with the same settings), and trying to change the outcome by manipulating the circumstances (eg, running the commands manually, rearranging lists).
-
Running the same command PHP tries to run: $ /var/www/html/slot_uptime/telnet_pots.sh $msan_ip $slot > /var/www/html/slot_uptime/uptime_pots.txt (after substituting values for those two variables, of course). And as a sanity check, echo out that command and make sure it is what you expect.
-
So it works when you try the bash script manually? What if you try manually running the exact same command the PHP script runs?