-3

i'm getting the exact result that i want from the tables using following query in phpmyadmin.

INSERT INTO resultTable( item, division, epf, person )
SELECT item.name AS item, person.full_name AS personName, person.epf_no AS epf, division.name AS division
FROM item
JOIN person ON person.item_id = item.id
JOIN division ON division.id = person.div_id
WHERE item.name LIKE '%desk%

i need to get the same result when the user search for a word via my user interface written in php.. database connection is ok..but, it's very complicated for me as i'm new to both mysql and php. this is the error..

mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:..

please help me. it's better if you can give the code to be written in the code block 'mysql_fetch_array()' thank you.

ollo
  • 24,053
  • 13
  • 97
  • 150
MNA Sha
  • 23
  • 7

1 Answers1

0

mysql_fetch_array() expects parameter 1 to be resource,

This error normally occurs when there is some error in the mysql_query and return result is not a valid result set.

so always use

    if(!$result) {
        echo mysql_error(); // to see what went wrong
    }

this is good practice for the beginners.

War10ck
  • 12,060
  • 7
  • 40
  • 51
Gaurav Mehra
  • 439
  • 7
  • 19
  • Result"; echo ""; // printing table headers for($i=0; $i{$field->name}"; } echo "\n"; // printing table rows while($row = MYSQL_FETCH_ROW($results)) { echo ""; // puts every element of $row(array) to $cell variable foreach($row AS $cell) echo ""; echo "\n"; } MYSQL_FREE_RESULT($results); }>
    $cell

    ?> code which worked for me.

    – MNA Sha Jun 27 '13 at 07:41