Re: Table Search ... HELP

From: Date: Fri, 07 Sep 2001 02:42:30 +0000
Subject: Re: Table Search ... HELP
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12238@lists.php.net to get a copy of this message
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: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#12238) next »