Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


requinix last won the day on July 4

requinix had the most liked content!

Community Reputation

643 Excellent

About requinix

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Don't hijack other people's threads. Assuming this isn't already being addressed in one of your other threads, post your code and an explanation of the problem you're trying to solve.
  2. strpos is case-sensitive. You can use stripos if that's a problem.
  3. Take a look at these two lines of code $row = mysqli_fetch_assoc($result); while($row = mysqli_fetch_assoc($result)){ and tell your rubber duck what they are doing.
  4. requinix

    how to make city display based on province

    If you have province displaying according to country then it shouldn't be hard to do cities according to province. But if it is hard then maybe you need to find a better way to do it it...
  5. if (strcmp("http://", substr($url, 0, 7)) !== 0) { $url = "http://" . $url; } Look up strcmp and substr and you should be able to tell what this code is doing (if it wasn't already apparent). Since this code fixes URLs, if you want it to support HTTP and HTTPS then you need to add another condition in there that makes sure it only fixes URLs that don't have http:// and don't have https://. if (strcmp("http://", substr($url, 0, 7)) !== 0 && strcmp("https://", substr($url, 0, 8)) !== 0) { $url = "http://" . $url; } Except there's a better way of doing that, and in a way that allow for URLs that aren't in lowercase, though they probably are: strncasecmp. if (strncasecmp("http://", $url, 7) !== 0 && strncasecmp("https://", $url, 8) !== 0) { Now try fixing GetHTML yourself. As for the other one, what you posted doesn't involve "http://" anywhere so it doesn't have to be fixed, but it's very likely that whole thing needs to be pulled out and replaced anyways. What's the rest of it?
  6. Look at my post, click the link to the documentation for mysqli_num_rows, see how it's supposed to be used, and fix your code accordingly.
  7. requinix

    reset stylesheet affecting my php drop down menu

    Kinda hard to know what's wrong from a screenshot.
  8. requinix

    reset stylesheet affecting my php drop down menu

    Reset stylesheets are dumb. Learn to work without them.
  9. yay, no more ridiculously large videos! float was available earlier, but since CSS 2.1 inline-block is indeed superior for this. Google can offer more on the subject; basically, float has a much more significant impact on elements' positioning, so if all you want to do is "collapse" elements to display side by side then inline-block will have the desired effect without other side effects.
  10. mysqli_query() does not return all the rows from the query. You need mysqli_num_rows.
  11. requinix

    Help structuring a very lightweight CMS of sorts

    If you want a very simple solution, serialization. The panel classes don't do anything except implement Serializable, and the database saving/restoring code simply un/serializes the objects as needed. They get serialized into a string which you can store directly. It's not searchable in the database, but I don't think the nature of this problem really lends itself to searching anyways. Adding Serializable means a little more work because if the classes might possibly change implementations in the future then non-Serializable classes can break: if stored in one form, changed in the code, then unserialized later you can get weird results. A common way to use Serializable would be like public function serialize() { return json_encode([ "v" => 1, "header" => $this->header, "fullWidth" => $this->fullWidth, "footer" => $this->footer ]); } public function unserialize($string) { $array = json_decode($string, false); switch ($array["v"]) { case 1: default: $this->header = $array["header"] ?? ""; $this->fullWidth = $array["fullWidth"] ?? ""; $this->footer = $array["footer"] ?? ""; break; } } Should the class need to change in the future you update the methods accordingly. public function serialize() { return json_encode([ "v" => 2, "banner" => $this->banner, "fullWidth" => $this->fullWidth, "marquee" => $this->footer ]); } public function unserialize($string) { $array = json_decode($string, false); switch ($array["v"]) { case 1: $this->banner = $array["header"]; $this->fullWidth = $array["fullWidth"]; $this->marquee = $array["footer"]; break; case 2: default: $this->banner = $array["banner"] ?? ""; $this->fullWidth = $array["fullWidth"] ?? ""; $this->marquee = $array["marquee"] ?? ""; break; } }
  12. Did you look at the example in the documentation or not?
  13. requinix

    mysqli rename table column

    RENAME COLUMN requires MySQL 8.0 so apparently you don't have that.
  14. Look at the examples in the documentation. fgetcsv() returns each line in the file, one by one, into an array. The first item in the array [0] is the first column, and the second item [1] is the second column.
  15. Used to shell scripting, huh? PHP is a fully-fledged language, you know. It can do things like listing files in a directory (you don't need to use this one), and creating directories, and moving files. Making PHP go off into a shell for those things is rather silly. You say it's a CSV file. Is it actually a CSV file, as in Cats.txt,Dogs.txt Silk.txt,Cotton.txt Coke.txt,Pepsi.txt or something else? Because if it's actually a CSV file then yes, you should be using something like fgetcsv to read lines. Then you can check if the primary file exists and delete the secondary file if it does (or you can move it).

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.