I got this code from a website and I am trying to tailor it to my test script. Instead of zip, city, state I want to display company_name. How can I modify this?
PHP:
$rs = mysql_query('select company_name from names_of_companies where
company_name like "'. mysql_real_escape_string($_REQUEST['term']) .'%"
order by company_name asc limit 0,10', $dblink);
$data = array();
if ( $rs && mysql_num_rows($rs) )
{
while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) )
{
//This is the part where instead of displaying zip, city, state
I only want company_name, how can i do that?
$data[] = array(
'label' => $row['zip'] .', '. $row['city'] .' '. $row['state'] ,
'value' => $row['zip']
);
}
}
I think that is what you want to have in the loop:
But if you had a hard time figuring this out, you will have hell of a time doing things right… I recommend stepping back, and getting familiar with PHP.