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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -