ballouta Posted February 1, 2010 Share Posted February 1, 2010 Hello I am trying to loop a certain text file that contains email addresses, I wanted to query my DB first and check if the email already exists or not. the upload process is working fine, and i can print each line from the text file correctly. but the error i have is in line 37 which i will comment next to it. => Warning: mysql_num_rows(): supplied argument is not a valid MySQL result would u please help me foreach($text as $line) { //check if this email address already exisit $result = mysql_query("SELECT * FROM `list` where `email` = '$line' "); $count=mysql_num_rows($row); //line 37 if($count== 1) { echo "This email address already exists: $line <br/>"; } else { $query="INSERT INTO `list` (`email` ) VALUES ('$line')"; $query_result = mysql_query ($query); echo "the email has been inserted $line <br/>"; } }//for each loop Thank You Link to comment https://forums.phpfreaks.com/topic/190521-query-problem/ Share on other sites More sharing options...
jl5501 Posted February 1, 2010 Share Posted February 1, 2010 $count=mysql_num_rows($row); I think you mean $count=mysql_num_rows($result); //line 37 Link to comment https://forums.phpfreaks.com/topic/190521-query-problem/#findComment-1004940 Share on other sites More sharing options...
ballouta Posted February 1, 2010 Author Share Posted February 1, 2010 Thank You Link to comment https://forums.phpfreaks.com/topic/190521-query-problem/#findComment-1005046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.