help needed.... i have 17 values in one row of a table, but i only wanted to retrieve 15 value from that row(FieldValue) the last two values was not needed. sorry for my bad english... and thank in advance.. <?php $con=mysql_connect("localhost","root",""); if(!$con) { die('Could not connect:'.mysql_error()); } mysql_select_db("kiperak",$con); $result = mysql_query("SELECT Fieldvalue FROM kid_rsform_submission_values WHERE SubmissionId IN (SELECT SubmissionId FROM kid_rsform_submission_values WHERE FieldValue = '850830126317')"); while($row= mysql_fetch_array($result)) { -->" this code will show all the values in the row(FieldValue)" echo $row[0]; } mysql_close($con); ?> Code (markup):
No, that won't work Bohra. I think you may be confused on what ZalFG is asking. There is a database a table a Row and a Field Value. The value is what he/she wants 15 out of. Only the first 15 characters of a 17 character value. They need to use substr(); From PHP.net If length is given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of string ). If length is given and is negative, then that many characters will be omitted from the end of string (after the start position has been calculated when a start is negative). If start denotes a position beyond this truncation, an empty string will be returned. If length is given and is 0, FALSE or NULL an empty string will be returned. Example #2 Using a negative length <?php $rest = substr("abcdef", 0, -1); // returns "abcde" ?> PHP: Also, you can access the string like an array with square brackets. $string = 'abcdef'; echo $string[0]; // a echo $string[3]; // d PHP: