jeudi 20 août 2015

SQL SELECT Query is not working through PHP Script

I am waiting till value of text field in form is set. Then I check the value in database .But while trying to query database using SELECT , but it gives output:

I just ran a php functionCould not run query: 

PHP SCRIPT

<html>
<head>

<?php

include_once("connect_to_Mysql.php");


function runMyFunction() {
    echo 'I just ran a php function';

    $result = mysqli_query($db_conx,"SELECT * FROM book WHERE Book_name ='A Textbook of Algebra'");

    if (!$result) {
        echo 'Could not run query: ' . mysqli_error($db_conx);
        exit;
    }
    $row = mysql_fetch_row($result);    

    echo $row[0];
    echo $row[1];
           }


  if (isset($_GET['svalue'])) {
      runMyFunction();
}


?>
<script language="JavaScript">
function showInput() {
    var message_entered =  document.getElementById("user_input").value;
    alert(message_entered);

                   }

</script>
</head>





 <body>

 <form >
      First search: <input type="text" name="svalue" id="user_input"><br>

      <input type="submit" onclick="showInput();"><br />

</form> 

Thanks in Advance.

Aucun commentaire:

Enregistrer un commentaire