-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
And everything mentioned so far is totally possible with SimpleXML. What kind of code do you have?
-
XML Display Last Information Rather Than The First
requinix replied to michael.davis's topic in PHP Coding Help
$xml = new SimpleXMLElement('http://www.tva.gov/lakes/xml/OHH_R.xml', 0, true); $row = current($xml->xpath('/DBI/RESULTSET/ROW[uPSTREAM_ELEV][last()]')); echo trim($row->UPSTREAM_ELEV); The trim() is because of the whitespace they stick in their XML -
What you're doing wrong is just throwing stuff into your .htaccess without actually knowing what you're doing. mod_rewrite
-
Well yeah: that URL doesn't match up with what you're trying to use. ^cats/([^/]+)/(\d+)\.html$ (assuming this will go in /template/.htaccess)
-
This topic has been moved to mod_rewrite because URL rewriting isn't a client-side thing. http://forums.phpfreaks.com/index.php?topic=361416.0
-
LCD displays.
-
Yeah. As long as you remember to convert back from HTML every time you want to use something like strlen() or string replacing or RSS feeds or someone's API or... Because it's easier that way!
-
3. Whatever page does the redirecting sticks in the new URL the one the user was trying to visit. log_in.php?return=report_comment.php%3Fcomment%3D1234 Note how the old URL was urlencoded before it went into the new URL. When they log in correctly you check if that return URL was passed (and if not you go to the homepage or something). If it was and is appropriate to redirect to then you redirect to it. The key part there is "is appropriate": you don't want to redirect to just anyplace.
-
For starters, do you actually have a DNS server running on your PC? Which one? Have you considered just editing the hosts file?
-
Common example: HTML versus XML. You can't stick things like © or ´ in XML so your clean() will not work for it.
-
Sounds like phpMyAdmin.
-
So if you want to keep the existing one, where is the new one supposed to go?
-
JavaScript code cannot call PHP functions. They are very, very separate things. Look into AJAX if you don't want any page reloads or just a normal POSTed form if you don't mind them. And that reference thing you've got going with deleteRecord()? Get rid of it. You won't be using it. Just stick with normal variables until you understand what references are and, more importantly, when you should use them.
-
Trouble with functions syntax, please help :(
requinix replied to Kimomaru's topic in PHP Coding Help
To close the function you have to go back into PHP code with another <?php. function display_site_info() { ?> </pre> <ul> This is test gibberish </ul> -
Then let's try just a new set of rules. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)(/([^/]+))?/?$ index.php?p=$1&s=$3 [L,QSA]
-
PHP as XML using Mod-Re-write
requinix replied to gerkintrigg's topic in PHP Installation and Configuration
Oh... you want the URL to look different? You know the extension means nothing technically, right? RewriteRule ^sitemap.xml$ sitemap.php [L] -
If "Siri Pembuat" is actually the name of a field then 1. Shame on you for putting spaces in a field name. 2. Quote it with backticks. And you're vulnerable to SQL injection. Fix it: $qsafe = mysql_real_escape_string($q); "select ... like \'$qsafe\'\n"
-
./ is relative to what the browser thinks is the current directory. When your friendly URLs have slashes then that might not match up with what you consider to be the current directory. Long story short use absolute locations everywhere. header("Location: /path/to/here");
-
PHP as XML using Mod-Re-write
requinix replied to gerkintrigg's topic in PHP Installation and Configuration
...mod_rewrite has nothing to do with it. Google, and everything that downloads files, cares about what you claim the file is. And that's what the header() is for. If text/xml doesn't work well then try application/xml. -
1. RewriteConds only apply to the next RewriteRule. And only the one. 2. Not only can you not [OR] a RewriteRule, it wouldn't even make sense to. "Oh sorry officer, I know I'm going the wrong way down a one-way street, but I'm late for work and I'm too important."
-
This topic has been moved to mod_rewrite because that's where it belongs. http://www.phpfreaks.com/forums/index.php?topic=361209.0
-
Can't reuse keys like that. You need an outer array along the lines of [{ "id": 14373, "name": "David", "age": 25, "gender": "m" }, { "id": 14373, "name": "Julie", "age": 31, "gender": "f" }, { "id": 65643, "name": "John", "age": 42, "gender": "m" }] With that done, start using each() properly.
-
PHP as XML using Mod-Re-write
requinix replied to gerkintrigg's topic in PHP Installation and Configuration
header("Content-Type: application/xml"); Before you output anything. But are you sure you need this? It's already being sent as text/xml which is probably okay. Is there a problem you need to fix? -
No. Are you not paying attention? Sticking with your code and just fiddling with it until it works? function dateByZone($format, $zone){ $default = date_default_timezone_get(); date_default_timezone_set($zone); $string = date($format); date_default_timezone_set($default); return $string; } echo dateByZone('d-m-Y h:i:s a', 'America/Toronto') . ' ';
-
It's funny that you say "closest".