the first echo

echo $strSQL;

gives:

SELECT company_name from passwds where user = "jgonzalez" and ID = "0052"

wich is allright

but the second pair of echos are supposed to return solution if company_name is solutions and selex if company name is selex

but i always get for an echo selex, even if in the database its solutions

what am i doing wrong?

<?php
 if ($submit)
 {	

	$dbcnx = mysql_connect("localhost", "mydabase", "mypassword");
	mysql_select_db("selex", $dbcnx);
	$strSQL = 'SELECT company_name from passwds where user = "' . $_POST['user'] . '" and ID = "' . $_POST['pass'] . '"' or die(mysql_error()); 
	$res = mysql_query($strSQL);
	echo $strSQL;
 	$x = @mysql_num_rows($res);
	
if($row[company_name] = 'selex')
{
echo 'selex'; 
//$image = 'selex.jpg';
} else {
//$image = 'selex.jpg';
echo 'solutions';
}

ok, i forgot an extra equal sign. It should be '==' and not '='.

now i always get solutions for an echo

Should you be selecting the Selex database all the time, or do you want both?

mysql_select_db("selex", $dbcnx);

you need to have

$row = mysql_fetch_array($res);

because $row never gets populated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.