Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Phi11W last won the day on March 7 2018

Phi11W had the most liked content!

Community Reputation

1 Neutral

About Phi11W

  • Rank
  1. Remember that you're constructing a PHP string that just happens to contain some HTML markup that a web browser can make sense of. Nothing magical is going to happen to the way PHO does that building just because you're building "HTML" (or "SQL"). You must follow PHP Rules for constructing strings and having that "loose" ampersand floating around in the middle, whether or not it's wrapped in braces, just won't work. How about something more like this: printf( '<a href='?page=%d&country=%s'>%s</a>', $page_number + 1, $cleaned_current_page_country, 'Next' ); Regards, Phill W.
  2. XPath is surprisingly powerful, but fiddly (a bit like Regular Expressions). Have a read about what it can (and can't) do: https://www.w3schools.com/xml/xpath_syntax.asp Regards, Phill W.
  3. Your XPath query is asking for "Staff" nodes - the lowest part of the path, before the square brackets - where the "Name" element within that equals the value stated. What you want is all the "Job" nodes where the Name element within the Staff element within the Assigned element equals the value stated, or, more succinctly: $jobs = $xml->xpath(" Jobs / Job [ Assigned / Staff / Name = '$Staff' ] "); I think of the bits in brackets like SQL's "where" clauses. Regards, Phill W.
  4. IIS implements a Request-Response model. It's not suited to long-running or cyclical processes. However, PHP code doesn't only run inside IIS. You can run it as a standalone program by "feeding" the PHP script file into the PHP executable. php.exe -f myscript.php That means that you can create a PHP script that does whatever you want it to, and schedule it to run whenever you need it to run using, say, Windows Task Scheduler.
  5. Which function actually does the searching? I'm guessing that's where your problem lies, but, as has already been said, the volunteers you'll find around here are not going to "reverse engineer" hundreds of lines of code from somebody else's commercial package. Have you considered talking to people that know WordPress? Or the AliPlugin that you're using? They may have encountered (and overcome) your concerns previously. Also, we're not going to visit URL's of completely unknown provenance. Regards, Phill W.
  6. Unfortunately, that is exactly what you need to do. PHP is telling you that you're trying to do arithmetic on duff data values - things that really are not numbers. It's not, as in other languages, telling you that you're using String-typed variables in an arithmetic expression and that it might have to do some [Evil] Type Coercion that might give you some strange results. It's telling you, unequivocally, that the data values coming into that expression are wrong! You need to find out where that dodgy data is coming from and fix it. Regards, Phill W.
  7. This is a remarkably common problem and it's all to do with Data Types: These are Character data and so are sorted alphabetically. "010" < "02" < "021" < "022" < "03" < "031" < "034" What you want is more like these, which are numeric and so are sorted numerically. 2 < 3 < 10 < 21 < 22 < 31 < 34 Somewhere along the line, your predecessor managed to get this value into a Character-based form instead of a numeric one, hence your current difficulties. Regards, Phill W.
  8. Obligatory XKCD Reference - Little Bobby Tables Regards, Phill W.
  9. It's unclear (to me) what you want. To me, "uniform" generally means "the same", not "... 1 or 2 or 3 or 0 ...". If you want a pre-defined set of data, then delete the rows and reinsert them the way you want them. Also; you say "gap". Remember that rows in a relational table have no intrinsic order. Regards, Phill W.
  10. In a simple Array, each element can be indexed by its [numeric] offset. Note that's "offset", not "position"; we count from [offset] zero. Refer to http://php.net/manual/en/language.types.array.php Regards, Phill W.
  11. You can [manually] use "select *" for testing and diagnostics. Applications should never do so. Databases are intrinsically shared entities and other people might be changing the table structures, adding all sorts of gigantic "text" fields that your application doesn't [know or] care about but using "select *" will retrieve them all anyway. Regards, Phill W.
  12. You can't. When you create an instance of a class, it's constructor function gets run. Then and there. Your [calling] code waits until that constructor completes before carrying on. By the time your code gets around to calling the updateDB function, the code execution and, more importantly, the local variables within the constructor are long gone, so there are no local variables for you to access! Now, the number of accounts could be a class-level variable, because it persists after the constructor has run, but any idea of the "current" account? Probably not. Regards, Phill W.
  13. I fail to see the difference between the two cases. If the deciding factor is whether the magnitude of the value is greater than [or equal to] one, then CASE operator in the SQL should suffice. select case when abs( value ) >= 1 then round( value, 4 ) else value end value from ... Regards, Phill W.
  14. You could do worse than start by reading some bits of the Manual: Arrays: array Looping: for or foreach Conditions: if Regards, Phill W.
  15. $sql = "UPDATE ".$d203." SET u102='".$newPassword."', u103='N' WHERE 104=".$a104; Never use any value supplied by a user without validating it thoroughly first. Obligatory XKCD Reference: Little Bobby Tables. Never, ever store passwords in plain text. Generate a hash of the the user-supplied password and store/ compare against that. You appear to be using multiple tables (with the same structure) for multiple "things" (User groups?). That's generally a poor design choice and doesn't scale out half as well as you might think. Better to use a single table and to use other methods (views/ application code) to keep different "communities" separate from one another. You appear to be using arbitrarily-generated table and column names. This is also, generally, a poor design choice, unless you have a lot of metadata elsewhere in your database/application that describes what all of these meaningless names ("u102", "u103", etc.) actually mean. I would expect you to have a "Users" table containing columns like "ID", "Name" and "PasswordHash". If you're especially paranoid about values "bleeding" between user groups, then separate each into its own database. The SQL that you are building is a String values that just happens to be meaningful to your database engine. Always give yourself the opportunity to examine generated SQL before it gets submitted to the database. During development, take the generated SQL, copy and paste it into your database tool of choice and make sure that it works. As mac_gyver has already said, your WHERE clause ( "104=something" is never going to match anything (except the value 104, of course), so no rows will get updated. Regards, Phill W.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.