You are here: Re: build WHERE clause on demand « PHP SQL « IT news, forums, messages
Re: build WHERE clause on demand

Posted by Kiza on 10/13/24 11:31

ZeldorBlat U R right :P
I didn't think about that. Then just del 'if ....'

<?php
//collect vars&values :-D
foreach ( $_REQUEST as $key => $value ) {
$$key = $value;

$fruit_name0 = ("fruit_name like '$value'");

$sql = ("SELECT * FROM fruit_table where $fruit_name0");

$query = mysql_query($sql);

while ( $row = mysql_fetch_array($query) ) {

$fruit_name = $row["fruit_name"];
$price = $row["price"];

echo("$fruit_name = $price<br />");//if U wanth to echo selected data
:)
}
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация