TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 06-15-2009, 04:06 PM   #1 (permalink)
The Wanderer
 
shoaibmunir's Avatar
 
Join Date: Jun 2009
Location: Dubai, UAE
Posts: 23
Thanks: 2
shoaibmunir is on a distinguished road
Default Search query multiple tables? (PHP, MySQL)

I'm working on a php project. i have a create a search product page. its contain multi table and working fine but exact problem is both table have some same column names i can't get the first table column value


Database Structure //I can't change must i've to create a script for getting result


tbl_products:-
rn //i want this value because i'm using as a product id
imagename


tbl_productsdetail

rn //i don't wana this value
pn //value coming from tbl_products rn column
name
description



Code:
$apshmquery="select p.*, pd.* from tbl_products p, tbl_productsdetail pd where p.code like '%" . $apshmreqcode .  "%' or pd.name like '%" . $apshmreqq .  "%' or pd.description like '%" . $apshmreqq .  "%' and p.rn=pd.pn ";


 $apshmsql = mysql_query($apshmquery);

$apshmrows = mysql_num_rows($apshmsql);

while ($apshmrecords = mysql_fetch_array($apshmsql)) {

echo ($apshmrecords["rn"]."</br>");//i want here tbl_products column value

echo ($apshmrecords["name"]."</br>");//its coming from productsdetail working fine

echo ($apshmrecords["description"]."</br>");//its coming from productsdetail working fine

}

have any good solution??

Thank's in advance :)
Send a message via MSN to shoaibmunir
shoaibmunir is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL query help sjaq Advanced PHP Programming 4 05-04-2009 10:33 AM
PHP & MySQL Inserting multiple entires from range. Acrylic Absolute Beginners 3 10-02-2008 02:27 AM
Building a MySQL search delayedinsanity MySQL & Databases 4 08-14-2008 04:21 AM
Securing your MySQL Queries with Sprintf Wildhoney General 26 03-18-2008 06:52 PM
Error in connecting to MySQL via PHP EyeDentify MySQL & Databases 0 01-03-2008 01:06 PM


All times are GMT. The time now is 04:02 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design