-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
How to use quotation marks and apostrophes in Xpath
requinix replied to loo9162's topic in PHP Coding Help
I believe you have to do some ugly concat() stuff. Given a string like Colin "The Hand" O'Malley you need to end up with concat("Colin ", '"', "The Hand", '"', " O'Malley")and the query channel/item[title=concat("Colin ", '"', "The Hand", '"', " O'Malley")]/titleHacking something out, function escapexpath($string) { $return = array(); foreach (explode('"', $string) as $part) { $return && $return[] = "'\"'"; $return[] = '"' . $part . '"'; } if (count($return) > 1) { return "concat(" . implode(",", $return) . ")"; } else { return '"' . $string . '"'; } } -
How about renaming your files to include the date? Daily is YYYY-MM-DD.txt, weekly is YYYY-WW.txt, monthly is YYYY-MM.txt. What are you using these files for? Using files like this is almost never the right solution.
-
exec() is for executing files. There is no such file as "CreateDealerCatalogDB.php?ID=123&save=1". There is one called "CreateDealerCatalogDB.php" though. Why not just include() the file normally? $get = $_GET; // save old values $_GET["ID"] = $DealerID; $_GET["save"] = 1; include $_SERVER["DOCUMENT_ROOT"] . "/CreateDealerCatalogDB.php"; $_GET = $get; // restore
-
Close as in close, not as in it does exactly what you want. You're SELECTing and GROUPing BY the title. Presumably the video title. That's not what you want. You want the tag name. So SELECT and GROUP BY the tag name.
-
That's word wrap.
-
There aren't any line breaks in there. Are you talking about word wrapping now?
-
Use nl2br, which will convert the regular \r and \n line breaks into the s HTML actually cares about.
-
So what happened to the SQL you posted a bit earlier? That was probably going to pull video titles instead of tags but it was really close - why'd you change it?
-
Copying files from one hard drive to another
requinix replied to The Little Guy's topic in Miscellaneous
If it doesn't already have a drive letter (in Win8), run diskmgmt.msc: that will list all the hard drives and you can mount it from there. -
The slow query log. It's generally disabled because it can be a bit of a performance hit but at that point you're already suffering. For the query, try connecting as root.
-
PHP doesn't have file scopes. If you dl() an extension then the extension is loaded. Stuff before can't use it, stuff after can. But avoid dl(). If your script requires an extension then it should be specifically enabled in the php.ini, and if it doesn't require it then don't load it if it's not present.
-
Dude. I'm sure there's just a good example somewhere out there that isn't related to porn. And next time spell out that you're linking to something NSFW. Want a page that lists all the tags? Then do that. Use a query like SELECT t.name, COUNT(*) AS count FROM tags t JOIN tags_videos tv ON t.id = tv.tag GROUP BY t.name
-
Asking how to remove the warning is the wrong question. You should be asking how to fix the problem that's causing the warning. Which, in this case, is the same thing because session_start() simply is not working for you. You can't use it if you've outputted anything. Rearrange your code so that you call session_start() as close to the beginning of the script as possible.
-
Cron runs commands at certain times. It's very flexible in how it does so but that's it in a nutshell. Then you just make a PHP script. You can't use web-specific stuff like the REMOTE_ADDR, and the DOCUMENT_ROOT might not be what you expect, but it's all just PHP.
-
Okay... header('location:../artikeldetail.php?msg=86&articleid='.$aid'&userid='.$uid);Look at that. You're missing a bit of punctuation.
-
Don't include it yourself. Because that's what's happening. They aren't added automatically.
-
what header, Content-Type should i use for a .reg file?
requinix replied to Dragosvr92's topic in PHP Coding Help
My favorite source doesn't say anything either. I'd go with application/octet-stream. -
Assuming you exit; or die; immediately after the header(), you're redirecting to one version but arriving at another. There must be another redirection somewhere.
-
Cookies were originally designed (unintentionally) so that it's not possible: www.qip.gr cannot set a cookie for "qip.gr", and while it can set one for ".qip.gr" the no-subdomain site couldn't read that. Force one or the other on your site - don't allow both. Which is a best practice anyways.
-
Meaning defined at the class (trait) level. Defining them in methods is fine. trait Counter { private static $c = 0; public function inc() { $this->c++; echo $this->c, "\n"; } }
-
Cron. It's not that complicated really: you add an entry to cron telling it to run a script (from the command line) every once in a while, like every five minutes, and that script does whatever it wants to do. Like process all notifications it should send out at that time.
-
Could someone help review this code & process?
requinix replied to RecklessArcher's topic in PHP Coding Help
That's what the .htaccess does. -
PHP Include workaround need for tough/rough coded site
requinix replied to mag00's topic in PHP Coding Help
Reconfiguring their servers to make them more secure is not "screwing you". You have code likeinclude("http://www.thefastesthorse.com/syndication/folder1/top1.html");That's incorrect. Never, ever include() URLs. Especially when they only contain HTML. Instead doreadfile($_SERVER["DOCUMENT_ROOT"] . "/syndication/folder1/top1.html");That will output a] the file as it exists on the machine, rather than as a location on the Internet and b] without trying to treat the file as PHP code, which it is not. -
Adding Multiple Parameters to bind_param()
requinix replied to timothyarden's topic in PHP Coding Help
There should be some output of some kind. If not then you may have a parse error somewhere, but if it's in that code then I don't see it.- 5 replies
-
- mysqli
- bind_param
-
(and 2 more)
Tagged with: