Jump to content

requinix

Administrators
  • Posts

    15,045
  • Joined

  • Last visited

  • Days Won

    413

Posts posted by requinix

  1. :psychic:

    Sounds like you're not submitting the data in the format the API requires. Check the documentation for what you should be doing and compare it to what you are actually doing.

    Also, maybe it's just me, but shouldn't that "Select Date" have, you know, some kind of date field associated with it? It's just empty...

  2. 9 hours ago, Daniele80 said:

    Do you know where I can find some code examples?

    No, because it varies depending on the different CSS and JS frameworks you're using.

    If you're using a framework then research what it supports in terms of responsive design. If you aren't, and you don't want to start using one, then learn about CSS media queries so you can write your own responsive rules, and also spend some time understanding your target audience so you know what size screens you should be designing for.

  3. Most of the time a responsive design moves horizontal elements gradually vertical.

    Right now you have Device Info and Network Settings in a left column and the settings themselves in a right column. The first responsive step towards a narrower design is to use one column and make the labels on the left be headings - which they might already be.

    Device Info
    =======================================
    
    ...
    
    Network Settings
    =======================================
    
    Ethernet Settings
    ---------------------------------------
    
    DHCP                                [ ]
    IP Address                 [__________]
    Subnet Mask                [__________]
    Default Gateway            [__________]
    DNS                        [__________]
    

    Side note #1: you really ought to support multiple DNS servers.

    You could keep the navigation anchors, which I assume exists, by moving the left column into a slide-out menu.

    To go narrower, you take the two columns of setting name on the left and setting value on the right and merge them into a single column of setting name then setting value.

    Device Info
    ===================
    
    ...
    
    Network Settings
    ===================
    
    Ethernet Settings
    -------------------
    
    DHCP
    [ ] Enabled
    
    IP Address
    [_________________]
    
    Subnet Mask
    [_________________]
    
    Default Gateway
    [_________________]
    
    DNS
    [_________________]
    

     

    Side note #2: many interfaces for DHCP present it as a DHCP vs. manual/static option, not just a mere checkbox.

    • Great Answer 1
  4. 41 minutes ago, danx994 said:

    Guys, can anyone help me write code for a request to the huggingface API in php?

    Which API?

    41 minutes ago, danx994 said:

    I try everything in PHP but nothing works.

    If you're having trouble making your PHP code work then you'll have to post (the relevant parts of) your PHP code. Because :psychic:

  5. To make sure I understand, you have two options:

    (a) Do three normal INSERT statements, and get the auto-incremented IDs of what you need
    (b) Do a normal INSERT and then craft a couple INSERT...SELECT queries based on the raw values you want to insert plus a reference or two to the IDs of the new rows you created that hopefully don't have any duplicates

    I'm thinking you should go for the simpler option.

  6. 5 hours ago, rick645 said:

    The page talks about Attribute::TARGET_*[1] and not Attribute::TARGET

    Yeah.

    "The targets are the Attribute::TARGET values."

    Plural.

    5 hours ago, rick645 said:

    Anyway, do you know what the constant ReflectionAttribute::IS_INSTANCEOF is for?

    https://www.php.net/manual/en/class.reflectionattribute.php#reflectionattribute.constants.is-instanceof

    "Retrieve attributes using an instanceof check."

    Do you know how to "retrieve attributes"?

  7. 1 hour ago, Table said:

    Why do you reply in the first case?

    The other problems are:

    1. Connecting to the database as root and without a password
    2. Running 26 separate queries to get row counts for each letter
    3. Running the same query multiple times without using a prepared statement
    4. The line that calls mysqli_fetch_assoc
    5. Using PHP_SELF
    6. Trying to navigate from one letter page to another won't work
    7. Freeing a result in a variable that doesn't exist
    8. Closing a connection in a variable that doesn't exist

    I assumed that you would fix your current problem, find some of the others, and probably have more questions to ask. Then I would try to help answer them. But if you'd prefer I don't reply to you then I won't do that anymore.

    • Like 1
  8. Here's the code you have:

    $query_result = mysqli_query($query);

    The "procedural style" mentioned in the docs shows this:

    mysqli_query(mysqli $mysql, string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool

    You read it like this:

    1. This is a function named "mysqli_query"
    2. The first parameter is called $mysql - at least in the documentation itself, you can name your variables whatever you want - and it is a mysqli (that's a class) value
    3. The second parameter is called $query and is a string value
    4. The third parameter is called $result_mode and is an int(eger) value; it has a default value of MYSQLI_STORE_RESULT, which will apply when you do not pass a third argument
    5. The function returns a value that is mysqli_result|bool, meaning it will be a mysqli_result (another class) value or a bool(ean) value

    The Parameters section gives more details about those three parameters. Same for the Return Values section and the return value.
    There's also an Errors/Exceptions that is useful to understand when and why the function may or may not behave correctly.

    But back on topic:

    The first parameter is not optional - there is no default value, so you must provide one yourself. You have done so with your $query variable; remember, your variable can be named whatever you want.
    But there's a problem: the parameter is supposed to be a mysqli value, and you provided a query string.

    The second parameter is not optional either, however you are not providing one. That's what PHP is complaining about.

    If you combine those two facts together, the problem should be pretty clear: you need to call the function with a mysqli and a query string, but you only called it with a query string.
    I'm guessing this was originally based on mysql (no 'i') code? There is a mysql_query function but it isn't the same as the mysqli_query function.

    • Like 1
×
×
  • 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.