私は、ナイトクラブや夜のイベントに専念するソーシャルネットワーキングサイトを構築しています。PHP mysqlマルチテーブルの検索行の後に異なるテーブルとフィールドのデータ行を返す
私はusersテーブル、eventsテーブル、establishmentsテーブルを持っています。
私は本当にFacebookが特定のユーザーだけでなく、ページ、広告などの行を照会して返すことができる方法に本当に興味を持っています。
search.php上の各テーブルの上の3つの別々のLIKE%検索%を実行します。イムは、これを読んでいるほとんどの人わからFacebookの検索に
を試してみましたが、私の質問は、私は必要があり、私の場合です。 search.php
で//query users table $query_user = "SELECT user_first_name, user_last_name, username, picture_thumb_url, avatar FROM users JOIN picture ON users.user_id = picture.user_id AND picture.avatar=1 ORDER BY users.user_id"; $result_users = mysql_query($query_user, $connections) or die(mysql_error()); $row_result_users = mysql_fetch_assoc($wid_updates); //query events table $query_event = "SELECT event_thumb_url, event_name, event_venue, event_date FROM event WHERE event_name LIKE '%".$search_value."%'"; $event = mysql_query($query_event, $connections) or die(mysql_error()); $row_event = mysql_fetch_assoc($event); $totalRows_event = mysql_num_rows($event); //query establishments table $query_establishment = "SELECT establishment_thumb_url, establishment_name, location_id, establishment_pricing FROM establishment WHERE establishment_name LIKE '%".$search_value."%'"; $establishment = mysql_query($query_establishment, $connections) or die(mysql_error()); $row_establishment = mysql_fetch_assoc($establishment); $totalRows_establishment = mysql_num_rows($establishment);
すなわち(同じsearch.phpに)空の折りたたまれ、関連するクエリに合致するものの結果を表示するために3つの別々のテーブルを描く
私のhtml:
<table max-width="500" name="users" border="0">
<tr>
<td width="50" height="50"></td>
<td width="150"></td>
<td width="150"></td>
<td width="150"></td>
</tr>
</table>
<table width="500" name="events" border="0">
<tr>
<td width="50" height="50"><a href="#profile.php"><img src="Images/<?php echo $row_event['event_thumb_url']; ?>"
border="0" height="50" width="50"/></a></td>
<td width="150"><?php echo $row_event['event_name']; ?></td>
<td width="150"><?php echo $row_event['event_venue']; ?></td>
<td width="150"><?php echo $row_event['event_date']; ?></td>
</tr>
</table>
<table width="500" name="establishments" border="0">
<tr>
<td width="50" height="50"><a href="#profile.php"><img src="Establishment_Images/<?php echo $row_establishment['establishment_thumb_url']; ?>"
border="0" height="50" width="50"/></a></td>
<td width="150"><?php echo $row_establishment['establishment_name']; ?></td>
<td width="150"><?php echo $row_establishment['location_id']; ?></td>
<td width="150"><?php echo $row_establishment['establishment_pricing']; ?></td>
</tr>
</table>
私はユーザテーブルのためのPHPエコーのを埋めていません。
これは、私が何をしようとしているのかを知るためのものです。どんな援助?