marksie1988 Posted June 11, 2007 Share Posted June 11, 2007 Could someone tell me how i get a column from a row and if that column has yes to show it but if not then dont show it? basically if(['sold'] == yes){ show any rows with yes in the sold column } else{ show nothing } i basically want to show sold items and then have another script the other way around which shows available ones so ones with no in the sold column please help with me starting it off all i need is the first bit then ill figure it out Thanks Steve Quote Link to comment https://forums.phpfreaks.com/topic/55027-solved-php-mysql-help/ Share on other sites More sharing options...
AndyB Posted June 11, 2007 Share Posted June 11, 2007 Why not just select the rows you need? SELECT * from table_name WHERE sold = 'yes' (and vice versa for the no case) Quote Link to comment https://forums.phpfreaks.com/topic/55027-solved-php-mysql-help/#findComment-272014 Share on other sites More sharing options...
redarrow Posted June 11, 2007 Share Posted June 11, 2007 dont forget to use $_POST['']; <?php // select database // query database $query="select * from colum"; // result query $result=mysql_query($query)or die("mysql_error()"); // while loop with $x being the array while($x=mysql_fetch_assoc($result)){ // if condition match condition if($x['solid']=="yes"){ echo $x['what_ever']; // if condition dosent match }else{} // repeated the same ok. if( $x['solid']=="no"){ echo $x['what_ever']; }else{} // end while loop } ?> agree with andy why do it the long way round lol. Quote Link to comment https://forums.phpfreaks.com/topic/55027-solved-php-mysql-help/#findComment-272016 Share on other sites More sharing options...
marksie1988 Posted June 11, 2007 Author Share Posted June 11, 2007 well good i didnt know how to do that thankyou for teaching me that im learning so much from this site its great Quote Link to comment https://forums.phpfreaks.com/topic/55027-solved-php-mysql-help/#findComment-272028 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.