Jump to content

cearlp

Members
  • Posts

    20
  • Joined

  • Last visited

Posts posted by cearlp

  1. Sorry about the code block. I'm also sorry that by not using a code block I made a mistake in the coding I showed. 

    There is no single quote in the line <td><input size="20" maxlength="20" name="password" value'"  "></td>

    It is a fat finger on my typing. It is as shown but without the single quote after value.

    I couldn't drag a file or even part of a file because the program code is not on this machine. 

  2. Validate function is within a <script language=javascript> and is -----

    function Validate() {

      if (document.form1.password.value == "zxyzz")

     {

        window.location="<?php echo 'disp.php'; ?>";

        return(false);

      } else {

        window.location="<?php echo 'displess.php'; ?>";

        return(false);

     }

    }

    Body is---

    <body onload="self.focus();document.form1.password.focus()" > 

      <form name= "form1" method="post" onsubmit="return Validate()">

      <table width="1000" border="0" cellspacing="1" cellpadding="0">

        <tr>

        <td align= "right">Password: </td>

        <td><input size="20" maxlength="20" name="password" value'"  "></td>

        </tr>

      </table>

      </form>

    </body>

     

    Problem is that under Firefox it always goes to displess.php

    but under Safari typing in zxyzz it goes to disp.php, anything else goes to displess.php

    Any suggestions or evidence of errors will be appreciated.

  3. Is an error obvious in the following code. It worked okay until just recently.

    Could a Ubuntu update to 22.04 have changed something i neew to change in the PHP coding?

           body {
              font-family: Georgia, "Times New Roman",
                    Times, serif;
            color: maroon;
            background-color: #daa520 }
            h2 {
              padding-left: 8em }
            p {
              font-size: 13.5pt;
              text-indent: 5em }
            a:link {
              color:blue;
              text-decoration: none }
            a:visited {
              color:purple;
              text-decoration: none }
            </style>
    
            <script language=javascript>
              function Validate() {
                if (document.form1.password.value == "fredpeabody")
                {
                   window.location="<?php echo 'sxdisp.php'; ?>";
                   return(false);
                } else {
                   window.location="<?php echo 'sxdispunprotect.php'; ?>";
                   return(false);
                }
              }
            </script>
    
    </head>
    
    <body onLoad="self.focus();document.form1.password.focus()" >
    
    <div id="main-content">
      <p> Enter the Password to search and display all the information on the Sigma Database. </p>
      <p> Otherwise only the unprotected information will be displayed.</p>
    
        <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']?>"
    onsubmit="return Validate()">
        <table width="1000" border="0" cellspacing="1" cellpading="0">
          <tr>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
           <td align="right">Password: </td>
           <td><input size="20" maxlength="20" name="password"  value="  "> </td>
          </tr>
        </table>  
    
     </form>
    </div>
    </body>

     

  4. I tried the following after researching mysqli exceptions and the result was the same,,,first two echos are displayed, no error printout but the echo "after conn" was not displayed.

    function conn($sql)
    {

      $host = "localhost";
      $user = "root";  
      $pass = "xxx";    valid root password for database
      $db   = "xxx";     looking at database with PHPMYADMIN seems okay

    echo "in conn--- ";
    echo "HOST $host, USER $user, PASS $pass, DB $db";

     $con = new mysqli($host, $user, $pass, $db);
     if ($con->connect_errno) {
        printf("connect failed: %s\n" , $con->connect_error());
        exit();
     }

    echo "after conn";

    }

  5. No error or any message. The program seems to finish normally except nothing was available to be displayed from the database. The code:

    if (!($conn=mysqli_connect($host, $user, $psss, &db))) {

       printf("error connecting to DB by user = $user");

       exit;

    }

  6. After years of working, the call to mysql_connect does nothing.

    Software  installed is:

    Server: Localhost via UNIX socket

    Server type: MariaDB

    Server version: 10.6.18-MAriaDB-0ubuntu0.22.04.1

    Protocol version: 10

    Apache/2.4.52 (Ubuntu)

    Database client version: libmysql - mysqlind 8.1.2-1ubuntu2.18   

    PHP extension: mysqli curl mbstring

    PHP version: 8.1.2-1ubuntu2.18

    What have I missed, some update or could the database be corrupted?

                

     

  7. Two identical php programs doing a mysqli_query, but on different databases. One succeeds and the other fails. The one that fails returns no errno.

    Could the cause be the databases?

    If so, what could be the problem? They are real similar in construction, one has more fields than the other, but almost the same data in both. 

    $conn = use, passwd, database

    $sql = insert into members (name,addr,city,state) values('Joe','123 St','Somecity','CA')

    $result = mysqli_query($conn, $sql) or die (Can't run query because " . mysql_errno());

     

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