0

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';
}
3
Contributors
4
Replies
5
Views
12 Years
Discussion Span
Last Post by sarahk
0

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

0

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

mysql_select_db("selex", $dbcnx);
0

you need to have

$row = mysql_fetch_array($res);

because $row never gets populated.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.