Page 1 of 1

[SOLVED] query error

Posted: Mon Jan 31, 2005 6:58 pm
by C_Calav
hi guys,

got this query thats not working out and dont know why can anyone see anything wrong?

thanx guys

EDIT. this error is comming up becuase the first time i go to the page nothing is selected. once i select something i get this error now
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Apache2\htdocs\survey\users.php on line 78
Unknown column 'IT' in 'where clause'

Code: Select all

<?php 
   include("conection.php");    

     $e_dept = $_POST&#1111;"select_dept"];

     $query = "select * from tbl_emp WHERE e_dept=$e_dept"; 
     $result = mysql_query($query); 
     $num_results = mysql_num_rows($result) or die (mysql_error()); 
    
     for ($i=0; $i <$num_results; $i++) 
     &#123; 
     $row = mysql_fetch_array($result); 
      
     $e_first = $row&#1111;'e_first']; 
?>

Posted: Mon Jan 31, 2005 7:26 pm
by C_Calav
fixed.. needed single quotes

Code: Select all

WHERE e_dept='$e_dept'";
solved my own thread ... hmmmm :roll:

Posted: Mon Jan 31, 2005 7:28 pm
by Wldrumstcs
change the line with the query to

Code: Select all

WHERE e_dept='$e_dept'";
You need the single quotes in there.

EDIT: Whoops, you found it too.