Retrieve Certain values

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zalFG
Forum Newbie
Posts: 4
Joined: Fri Feb 12, 2010 11:58 pm

Retrieve Certain values

Post by zalFG »

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. i have attach the screenshot of the table for refferences...

sorry for my bad english...

and thank in advance..

Code: Select all

<?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);
 
 ?>
Attachments
this is the table
this is the table
2-13-2010 11-52-08 AM.png (34.66 KiB) Viewed 42 times
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Retrieve Certain values

Post by social_experiment »

Code: Select all

<?php $result = mysql_query("SELECT Fieldvalue FROM kid_rsform_submission_values WHERE SubmissionId IN (SELECT SubmissionId FROM kid_rsform_submission_values WHERE FieldValue = '850830126317')"); ?>
In your query after 'SELECT' just add the fields you want to select, example Field1, Field2....Field15. Or you could use '*' and just use the values returned that you want.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
zalFG
Forum Newbie
Posts: 4
Joined: Fri Feb 12, 2010 11:58 pm

Re: Retrieve Certain values

Post by zalFG »

Thanks for the reply, It's Work like a charm!!!! :D
Post Reply