php - Simple MySQL select query one field and return value -


i want return , display value 1 column id matches. simple if knew doing.

    <?php        if(isset($_get['cid'])) {       $id = mysql_real_escape_string($_get['cid']);       $query = "select c_t_o_r ctable c_id = '{$cid}'";       $results = mysql_query($query);       $rows = mysql_fetch_assoc($results);       $ctor = $rows;       echo $ctor;      } ?> 

you're close. mysql_fetch_assoc() fetches array results. need specify column (key) array:

<?php    if(isset($_get['cid'])) {   $cid = mysql_real_escape_string($_get['cid']);   $query = "select c_t_o_r ctable c_id = '{$cid}'";   $results = mysql_query($query);   $rows = mysql_fetch_assoc($results);   $ctor = $rows['c_t_o_r']; // <-- need    echo $ctor;  } ?> 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -