473,804 Members | 3,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query not returning any results...

Hi all -

Hope you can help me with this SQL / PHP problem.

I have the following tables with (in brackets) the following columns:

PLAYER (playerid, forename, surname, birthdate, birthplace)
PLAYERHISTORY (playerhistid, playerid, boughtfor, joined_date)
PLAYERAPPS (playerappsid, playerhistid, apps, goals)

In 'showplayers.ph p' I have a select box where users can select the
surname of a player. The next page will then (theoretically) show all
the players details.

I've managed to get data from the PLAYER table using the following SQL
query at the top of the PHP page:

$query = "SELECT *, DATE_FORMAT(bir thdate, '%d/%m/%Y') AS birth FROM
player WHERE playerid='{$_PO ST['interest']}'";
$result = mysql_query($qu ery)
or die ("Couldn't execute query");
$row = mysql_fetch_arr ay($result);

However, I'm running into troubles when I'm trying to get details from
the PLAYERHISTORY table. I've written another SQL query to select data
from the PLAYERHISTORY table, according to what player has been
selected.
$query2 = "SELECT *, DATE_FORMAT(joi ned, '%d/%m/%Y') AS joined FROM
playerhistory LEFT JOIN player ON playerhistory.p layerid =
player.playerid ";
$result2 = mysql_query($qu ery2)
or die ("Couldn't execute query2");
$row2 = mysql_fetch_arr ay($result2);

However, $query2 doesn't return any results - despite there being data
in the database it should be returning.

Can anyone advise whether there is a problem with my SQL query, or is
something else. I've double checked the PHP code, and this is fine.

Any help greatly appreciated.

Regards,

Chris
Jul 19 '05 #1
0 1479

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3436
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the new values are updated in all corresponding tables (the function of the pages in question). However, on the page that does the DB update, I also want to do some checks on the data before performing the update. Now, the problem that I am...
8
3378
by: Rigga | last post by:
Hi, I am new to mysql and need help on how to join tables. I have a database which contains 4 tables, the main table contains information by date order and the other 3 contain data also in date order. So I need to write a query that retrieves all the information for one record, lets say I want to query on the main table any entry that is for the 2004-01-06 and this date is also in a field called 'Date' in the other tables, how do I go...
8
3708
by: san | last post by:
Hi, I wanted to know if this is possible and if so, how do I do it. Say, I have a query "SELECT * FROM Table WHERE Column="some_value". This executes on a very large data set and I would like to return the results as they query executes rather than wait for the whole query to execute. Basically, I want to get the results as they are prepared by the database. Any way to do this?
3
4615
by: Tom Mitchell | last post by:
All: I'm stumped on a query. How do I find duplicates in a table where one of the duplicates has values is a certain field and the other doesn't. For example, I have the following table: tblItems ItemID ItemLabel
12
34840
by: Bookreader | last post by:
I tried Googling this but I get a whole lot of replies about running the SQL statement in VB via ADO. All I want to do is run an existing ACCESS 2000 query from VB with no information returned to VB. I am presuming that I would use Automation somehow. Thanks in advance.
4
3719
by: Macroman | last post by:
MS Access XP, running on Win XP, Processor 2.4Ghz , 512Mb RAM, 40Gb Hard drive Table 1 has 167,000 records and contains the following fields tblone_custID tblone_easting tblone_northing Table 2 has 423,000 records and contains the following fields tbltwo_custID
4
1863
by: Hemant Shah | last post by:
Folks, I am having problem with an application that uses static SQL, the application basically browses through the table given start and end key most of the time it is processed from begining to end. The db2expln tells me that there is no Data or Index prefetch. I am running DB2 UDB 8 on AIX 5.3, and I am using DMS tablespace on raw logical volumes on a SAN.
1
1766
by: thepresidentis | last post by:
here is my problem, i have a website that compiles concert listings for users to search for shows in their local area, i ran into a problem with returning search results due to an improper format of my query, So i formatted the query properly Thanks to steve Klein :) , and all worked fine because there was only 1 show in my data base, I tryed to search for the show and it returned properly, and then i searched for the show with a different...
1
1340
by: holmm | last post by:
Feel free to critise/comment. I've been slightly thrown in at the deep end! I'm building a query to count the number of test results that are unapproved, Out of spec, null etc per manufacturing site by Date(current month, last 12 months or all others). I have the query returning results correctly but the only problem is it won't return 0's for the manufacturng sites that have none of the above. Query: SELECT ...
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.