MYSQL WHERE clause in php -
i have php file display artists have in table, , working fine. trying display particalar artists specific condition, example displaying artists city baltimore. not @ php , help.
<?php $page_title = 'browse prints'; include ('includes/browse_style.html'); require ('../mydesigner/mysqli_connect.php'); // default query page: $q = "select artists.artist_id, concat_ws(' ', artist_name) artist, print_name, price, description, print_id artists, prints artists.artist_id = prints.artist_id order artists.artist_name asc, prints.print_name asc"; // looking @ particular artist? if (isset($_get['aid']) && filter_var($_get['aid'], filter_validate_int, array('min_range' => 1)) ) { // overwrite query: $q = "select artists.artist_id, concat_ws(' ', artist_name, artist_city, artist_type, artist_mobile) artist, print_name, price, description, print_id artists, prints artists.artist_id=prints.artist_id , prints.artist_id={$_get['aid']} order prints.print_name"; } // create table head: echo "<link rel='stylesheet' type='text/css' href='http://www.lectmohd.com/mydesigner/includes/css/table2.css' />"; echo '<table border="0" width="90%" cellspacing="3" cellpadding="3" align="center"> <tr> <th align="left" width="10%">السعر</b></th> <th align="right" width="40%">الوصف</th> <th align="right" width="20%">إسم التصميم</th> <th align="right" width="20%">المصمم</th> </tr>'; // display prints, linked urls: $r = mysqli_query ($dbc, $q); while ($row = mysqli_fetch_array ($r, mysqli_assoc)) { // display each record: echo "\t<tr> <td align=\"right\">\${$row['price']}</td> <td align=\"right\">{$row['description']}</td> <td align=\"right\"><a href=\"view_print.php?pid={$row['print_id']}\">{$row['print_name']}</a></td> <td align=\"right\"><a href=\"browse_prints.php?aid={$row['artist_id']}\">{$row['artist']}</a></td> </tr>\n"; } // end of while loop. echo '</table>'; mysqli_close($dbc); include ('includes/footer.html'); ?>
just add condition city
where artists.artist_id = prints.artist_id , artists.artist_city = 'baltimore'
Comments
Post a Comment