0

Hi,

Been working on this PHP snippet and it was fine until I changed one line. I am doing this inside Wordpress so I can't echo the problems out.

"Server error"

Hopefull you guys can see where my snippet has gone wrong :))

        <?php
        //Create connection
        //new mysqli("localhost", "user", "password", "database");
        $db = mysqli_connect("localhost", "ebook","Password", "Ebook") or die("Cannot Connect to the database");



        //Adding Sent Over Data

        ///////////////Values///////////////////
            $value_name = $_POST['Name'];
           $value_email = $_POST['Email'];
        $value_category = $_POST['Category'];
        $value_download= $row['Download'];
        ////////////////////////////////////////

        $ChangeDownloadSQL = "SELECT Name FROM details WHERE Download=1 UPDATE Download=0";
        $Changers = mysqli_query($db, $ChangeDownloadSQL);


        if ($Changers) {
            mysqli_fetch_assoc($ChangeDownloadSQL){
            echo "Changed Details";
        } else {
            echo "Failed";
            }
        }
        //CRONJOBCHECK//
        //$sqlquery = "SELECT ID, Name FROM details WHERE Download=0";
        $strSQL = "SELECT Name FROM details WHERE Download=1";
        //RS = Record Set
        $rs = mysqli_query($db, $strSQL);
        if ( $rs) {

            while($row = mysqli_fetch_assoc($rs)){
               echo "<p>" . $row['Name'] . " " . "</p>";
               echo $value_download;
            }
        }else{
            //Display Error Message
            echo '<p>';
            echo mysqli_error($db);
            echo '</p>';
        }

        echo "<p>" . $row['ID'] . $row['Name'] . "</p>";
        ?>
2
Contributors
2
Replies
14
Views
4 Years
Discussion Span
Last Post by bradly.spicer
0
if ($Changers) {
            mysqli_fetch_assoc($ChangeDownloadSQL);
            echo "Changed Details";
        } else {
            echo "Failed";
            }

This fixed it, I am getting "Failed" come up now and information not being submitted to the db but that's another story :P

I'l get to work on that.

Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.