mysql - Truncating a SQL char value -


i hope can tell me doing wrong.

i query sql table , receive classid , classname.

the classid char(8) , holds values such 123.45l1 or 350.12.

i attempting shorten value receive 123 or 350 only.

here code:

    $classselect = "select left(classid , 3), classname class group classid";        $result = mysql_query($classselect);      echo "<td><select multiple size='10' name='class'>";      while ($row = mysql_fetch_array($result)) {          echo "<option value='choice'" . $row['classid'] . " - " . $row['classname'] . "'>" . $row['classid'] . " - " . $row['classname'] . "</option>";     }     echo "</select></td>"; 

select left(classid , 3) somename, classname 

and refer php $row['somename']


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -