Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INNER JOIN not getting data from Mysql DB HELP!

Status
Not open for further replies.

silvergrey

Programmer
Feb 18, 2005
3
GB
Hi
I am trying to connect 2 tables (inward_stock) &(completed_jobs) using there jobid. When i load the page im not getting any data displayed, i have run the query in the Query Browser again no errors i can see the columns (inward_stock.prodserial) & (completed_jobs.timetested) but still no data is showing but the tables definatly have the data in them and both jobid's match, i have changed the query many times.

Be really cool if someone can shed some light on this been looking at this for days !!! Thanks


$query ="SELECT inward_stock.prodserial, completed_jobs.timetested FROM inward_stock INNER JOIN completed_jobs ON inward_stock.jobid = completed_jobs.jobid";
 
give us some sample data from both tables. If possible, also go to the Mysql prompt, run the query there, and see what it says
 
Thanks for your reply, yea i tried it in the my sql query browser and there was no errors i saw the columns i wanted but there was no data. Ill show you the tables below and 1 row of data in them. Hope you see somthing im missing



Table Inward_stock

Column Names Data Inputed

prodtype Plasma
prodmodel Hyundai
datetimearrive 18 Feb,2005 06:32 pm
faultreported Data Board
customertype General Public
prodserial DPDCK343422
jobid HyundaiDPDCK343422
customerid 222333NW17RJ

Table Completed_jobs

jobid HyundaiDPDCK343422
repaircarriedout Data board replaced
partsaused 34234324
partsbused None
partscused None
timetaken 30 Minutes
timetested 5 Hours
hourlycharge 40
customerid 222333NW17RJ

 
Have you tried:

Code:
$query ="SELECT inward_stock.prodserial, completed_jobs.timetested FROM inward_stock, completed_jobs WHERE inward_stock.jobid = completed_jobs.jobid";

It should work, so I am wondering if the inner join is causing problems. For instance, if you are using a version prior to 3.23, the inner join didn't take a join condition
 
Thanks man just tried it but still not getting any data out when i run it in the query browser i see; prodserial & timetested columns so the query is working to an extent but why no data! sigh. these are the versions im using;

Thanks

IIS 5.1
mysql-4.0.23-win
mysql-administrator-1.0.19-win
mysql-query-browser-1.1.5-win
php-4.3.10-installer

 
well, have you confirmed there are no extra characters in the fields like a space, newline, etc. that could break the relationship. That is common with non-numeric fields being used as a key field.

That's one of the most basic sql statements possible, so I it's gotta be something stupid (as I always say).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top