Using a href onclick to update div without reloading page?

前端 未结 4 690
长情又很酷
长情又很酷 2021-01-20 04:40

I used this existing question to help me out: HTML - Change\\Update page contents without refreshing\\reloading the page

The template-comparison.php file fetches the

4条回答
  •  感情败类
    2021-01-20 04:57

    $results = mysql_query("SELECT * FROM PresidentialCandidate WHERE  ID='$ID'");   
    if( mysql_num_rows($results) > 0 )
    {
       $row = mysql_fetch_array( $results );
       echo $row['ID'];
    }
    

    Replace with:

    $sql = "SELECT * FROM PresidentialCandidate WHERE  ID='$ID'";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
      $row = $result->fetch_assoc();
      echo $row['ID'];
    }
    

    Please don't mix both mysql_* & mysqli_* functions.

提交回复
热议问题