Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\xamp

Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\xamp

pewds12312pewds12312 Posts: 5Questions: 2Answers: 0
edited February 2016 in Free community support
<img src="homepage.jpg" alt="HTML5 Icon" style="width:1500px;height:300px;">
<?php
 // Connects to your Database 
 mysql_connect("localhost", "root", "") or die(mysql_error()); 
 mysql_select_db("corporate_personnel_order_for_2016") or die(mysql_error());

    @$mode = $_GET['mode'];
    @$code = $_GET['CODE'];
    @$document_title = $_GET['DOCUMENT_TITLE'];
    @$process_owner = $_GET['PROCESS_OWNER'];
    @$revision = $_GET['REVISION'];
    @$date_of_issue = $_GET['DATE_OF_ISSUE'];
    
if(isset($_POST["submit"])){    
 $result = mysql_query("SELECT * FROM table2 WHERE CODE=CODE ,DOCUMENT_TITLE=DOCUMENT_TITLE,PROCESS_OWNER=PROCESS_OWNER,REVISION=REVISION,DATE_OF_ISSUE=DATE_OF_ISSUE");


echo "<center><table><tr><th width=200>Code</th><th width=200>Document Title</th><th width=200>Process Owner</th><th width=200>Revision</th><th width=200>Date of Issue</center></th></tr>";
while ($row = mysql_fetch_row($result)) {
echo '<table><tr>';
    echo '<tr>';
    echo '<td width=200>' . $row['CODE'] . '</td>';
    echo '<td width=200>' . $row['DOCUMENT_TITLE'] . '</td>';
    echo '<td width=200>' . $row['PROCESS_OWNER'] . '</td>';
    echo '<td width=200>' . $row['REVISION'] . '</td>';
    echo '<td width=200>' . $row['DATE_OF_ISSUE'] . '</td>';
    echo '</tr>';
echo "</table>";
}
}

<?php
>
?>


<!doctype html>
<html>
    <head>
        
        <h2><center>Search Personnel Corporate Order</center></h2>
    </head>
    

<body>

<form  method = "POST"> 

 <table>
 <tr><td><center>CODE:</td><td><input type="text" name="CODE" /></center></td></tr> 
 <tr><td><center>DOCUMENT TITLE:</center></td><td><input type="text" name="DOCUMENT_TITLE" /></td></tr> 
 <tr><td><center>PROCESS OWNER:</center></td><td><input type="text" name="PROCESS_OWNER" /></td></tr>
 <tr><td><center>REVISION:</center></td><td><input type="text" name="REVISION" /></td></tr>
 <tr><td><center>DATE OF ISSUE:</center></td><td><input type="date" name="DATE_OF_ISSUE" /></td></tr>  
 
 <tr><td><center><tf colspan="2" align="center"><input type="submit" name="submit" value="submit"/></center></td></tr>
 </table> 
 </form> 
</body>
</html>

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • pewds12312pewds12312 Posts: 5Questions: 2Answers: 0

    Pls Help me don't know where is the error

  • stsh3011stsh3011 Posts: 11Questions: 4Answers: 0

    variable names are case sensitive in php i.e. you have passed in your sql query as CODE= CODE instead of CODE= '$code' or CODE = $code if value is numeric and so on for all values passed in where clause.Hope this will clear your doubt and solve your problem.

  • pewds12312pewds12312 Posts: 5Questions: 2Answers: 0

    what should i put?

  • allanallan Posts: 63,872Questions: 1Answers: 10,526 Site admin

    I'm not quite clear on what your question has to do with the DataTables Javascript library, which your code above doesn't appear to use.

    If you need general programming help I would suggest you ask your question on StackOverflow or similar.

    The error you are seeing suggests that an SQL error occurred. However, as I say, that is not a DataTables issue and not something we offer support for here.

    Allan

  • pewds12312pewds12312 Posts: 5Questions: 2Answers: 0

    Sorry for the wrong post..

This discussion has been closed.