[PHP-DB] Table Search ... HELP

2001-09-06 Thread Devon

Below is an example of my code which searches a table and prints the result,
the problem is that it only displays the TechContact where I want it to
display all the fields that associated with it in that row off the colum eg.
Mobile, AdminContact etc etc  Any suggestions?

if ($TechContact == )
{$TechContact = '%';}
$result = mysql_query (SELECT * FROM enet
 WHERE TechContact LIKE '$TechContact%');
print $row[TechContact];





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Table Search ... HELP

2001-09-06 Thread Steve Cayford

All the info you want should be in $result after the query. But to get it
out of $result you need to access one row at a time with
mysql_fetch_array($result), which returns a numerically keyed array (if I
remember correctly), or mysql_fetch_assoc($result), which returns a string
keyed array or hash. So, like this (more or less)...

if ($TechContact == ){
   $TechContact = '%';
}
$result = mysql_query (SELECT * FROM enet
 WHERE TechContact LIKE '$TechContact%');
// this part added...
while($row = mysql_fetch_assoc($result)){
print $row[TechContact];
print $row[SomeOtherColumnName];
print $row[YetAnotherColumnName];
print br\n;
}


On 2001.09.06 19:41:55 -0500 Devon wrote:
 Below is an example of my code which searches a table and prints the
 result,
 the problem is that it only displays the TechContact where I want it to
 display all the fields that associated with it in that row off the colum
 eg.
 Mobile, AdminContact etc etc  Any suggestions?
 
 if ($TechContact == )
 {$TechContact = '%';}
 $result = mysql_query (SELECT * FROM enet
  WHERE TechContact LIKE '$TechContact%');
 print $row[TechContact];
 
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]