BASIC join tables

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ansa1
Forum Newbie
Posts: 16
Joined: Sat Mar 27, 2004 9:19 am
Location: Ontario, Canada

BASIC join tables

Post by ansa1 »

Hi .


I am focusing a problem (with basic): mysql join tables. Since yesterday I reviewed a many posted answers regarding join tables, and mysql sources as well. Some how I did not found answer to my problem.

There are two tables, should “cooperate” together, but they don’t . LOL

Table one = Application:
apID ( INT)
apName (TEXT)

Table two=model:
mID (INT)
apID (INT)

the query : "SELECT * FROM model INNER JOIN application ON application.apID=model.apID

I expected to get: apID (numbers) - displayd in the “model” table but all what I got is only “0” . What am I doing wrong?


Thanks in advance
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Can you dump the array onto the screen and post the result?

Code: Select all

<?php
print_r($array);

?>
did you double check case?
ansa1
Forum Newbie
Posts: 16
Joined: Sat Mar 27, 2004 9:19 am
Location: Ontario, Canada

Post by ansa1 »

Regarding arrays – No, not really!

Case is ok.

Thanks
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Normally for this kind of SELECT you would simply use the following:

Code: Select all

SELECT * FROM model,application WHERE application.apID=model.apID
.

although inner join should work. Is the data correct ?
ansa1
Forum Newbie
Posts: 16
Joined: Sat Mar 27, 2004 9:19 am
Location: Ontario, Canada

Post by ansa1 »

I am still not done, but your suggestions give me a picture, what is wrong ( me LOL) .
GODER GOBIN said it should work - certainly it should work and as he/she suggests data …. codes ….. for sure . Query works, because I got an echo from both (joined) tables.

NEOPHYTE said : Can you dump the array onto the screen and post the result?
Not really LOL , but if I want my form works, I have to LOL.
This forum is an incredible sources of PHP and DB , and I am positive that soon I will find this what I need. At least… now, I know what I should looking for .

thank you for your time. :P
Post Reply