Jump to content

Query Problem


ballouta

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.