Windows 10: Undefined variable error in array (PHP)

Discus and support Undefined variable error in array (PHP) in Windows 10 Software and Apps to solve the problem; I have a collection of check boxes all with the name c[] but different values. From php8 the code below works but gives me an 'Undefined variable... Discussion in 'Windows 10 Software and Apps' started by Perantine, Apr 26, 2021.

  1. Perantine Win User

    Undefined variable error in array (PHP)


    I have a collection of check boxes all with the name c[] but different values. From php8 the code below works but gives me an 'Undefined variable $sql_c’ warning (perhaps this error was just suppressed in earlier versions?). I was given the code years back and have now updated it with numerous 'if isset()' functions, but if I do that to the $sql_c function, I get no results. Any help would be appreciated.

    if (isset($_POST['submit']) && isset($_POST['c'])) {

    $sql="stuno,fname,lname"...

    Read more
     
    Perantine, Apr 26, 2021
    #1
  2. Aquinus Win User

    PHP - Setting session variables from database records?

    I typically use PostgteSQL and I have a web framework I've been developing which is soon to be used in production where I work. It simplifies a lot of things, such as not having to worry about connecting to the database or handling errors, because the database abstraction layer handles that. I don't know about MySQLi, but PostgreSQL will tell you what a query has returned.

    So in what I've written (using postgresql,) it would look like this:

    Code: class SomeNewController { public function index() { $db = \Plum\DB::get_conn(); $rec = $db->select('users', array('email' => \Plum\HTTP::input('email')), 1); // Or: $rec = $db->select_sql('SELECT * FROM {users} WHERE email = ?', array(\Plum\HTTP::input('email')), 1); if(!empty($rec)) { \Plum\Session::set('email', $rec->email); } } }[/quote] I would have used php tags, but for some reason wrapping php code with namespacing in PHP tags strips the backslashes out, which are needed to determine namespace scope.


    No, but it returns a type that PHP interprets as a false, but that isn't what I was talking about. mysql_fetch_assoc says this in php.net's doc.
    Just because a query returns no rows doesn't mean it threw an error.
     
    Aquinus, Apr 26, 2021
    #2
  3. caleb Win User
    PHP - Setting session variables from database records?

    PS. I see they are suggesting to move out to PDO from regular query stuff nowdays. I'd go with their suggestions as they move PHP development very quickly.
     
    caleb, Apr 26, 2021
    #3
  4. W1zzard Win User

    Undefined variable error in array (PHP)

    PHP dynamic page + return results into a dynamic table

    you probably want to turn on error reporting in php.ini. that will give much better error messages

    also i suggest to separate code and design more. put the php code at the start, save data into php variables and then use a minimum of php code in the html section, basically just echo and foreach. that also saves you from having all those echos around.

    something like that
    Code: <?php $foo='bar'; ?> <html><body><?php echo $foo; ?></body></html>[/quote]
     
    W1zzard, Apr 26, 2021
    #4
Thema:

Undefined variable error in array (PHP)

Loading...
  1. Undefined variable error in array (PHP) - Similar Threads - Undefined variable error

  2. Undefined Bitlocker Error

    in AntiVirus, Firewalls and System Security
    Undefined Bitlocker Error: Hello Microsoft ,Yesterday I got a problem in by Dell Inspiron laptop having windows 10. Usually I was Downloading Cricket 07 From Ocean of Games Site.According to the tutorial I got from them. It was to disable all the antivirus and security for running exe file which I...
  3. Undefined Bitlocker Error

    in Windows 10 Gaming
    Undefined Bitlocker Error: Hello Microsoft ,Yesterday I got a problem in by Dell Inspiron laptop having windows 10. Usually I was Downloading Cricket 07 From Ocean of Games Site.According to the tutorial I got from them. It was to disable all the antivirus and security for running exe file which I...
  4. Undefined Bitlocker Error

    in Windows 10 Software and Apps
    Undefined Bitlocker Error: Hello Microsoft ,Yesterday I got a problem in by Dell Inspiron laptop having windows 10. Usually I was Downloading Cricket 07 From Ocean of Games Site.According to the tutorial I got from them. It was to disable all the antivirus and security for running exe file which I...
  5. PHP

    in Windows 10 BSOD Crashes and Debugging
    PHP: Hiwon't let me send an email that says I need a PHP server what does that mean?Thank you https://answers.microsoft.com/en-us/windows/forum/all/php/4e99d17f-a423-44d3-9387-2ae3f8f13083
  6. Undefined index:

    in Windows 10 Software and Apps
    Undefined index:: My goodness, here again. with I thought would be simple. Object is to add 1 to the "receiptno" in the "numbers" table and print the receiptno. please tell me in lay terms what is wrong. ---------------------------------- code: <?php $server = "localhost"; $user = "root";...
  7. php ini.Mcrypt PHP extension required.

    in Windows 10 Drivers and Hardware
    php ini.Mcrypt PHP extension required.: Where can I find my php ini. on windows 10 to enable or install it? https://answers.microsoft.com/en-us/windows/forum/all/php-inimcrypt-php-extension-required/69c7f857-a936-4097-9e31-6b00ab344ed2
  8. Undefined windows update errors

    in Windows 10 Updates and Activation
    Undefined windows update errors: Periodically, I when I open the windows settings/updates page, I note a error display which according to the detail was a result of a (presumed background) update not completing because a shut down was in progress. The latest one happened either early this am (mon 2Nov or...
  9. undefined script error

    in Windows 10 BSOD Crashes and Debugging
    undefined script error: After the Windows 10 Insider update my watchfire ignite program started to open a script error, specifically: The value of the property "Show Status" is null or undefined, not a Function object. Is there any fix, I am unable to get rid of rendering app...
  10. Undefined problem

    in Windows 10 BSOD Crashes and Debugging
    Undefined problem: Hello everyone, I wonder why my Window 10 become no font in start and notification area? Is that virus attack? [ATTACH] https://answers.microsoft.com/en-us/windows/forum/all/undefined-problem/8d424da2-60f1-4a96-b206-7ec8efdbcf3b