Please post under the other replies, it makes it easier to follow.
Terion Miller wrote:
Yep they both work separately ... can't believe I've been stuck on the
same thing all day, it seems like an easy thing...
From what you've shown us it should work.
Maybe post the output of:
show create ta
Yep they both work separately ... can't believe I've been stuck on the same
thing all day, it seems like an easy thing...
On Thu, Jan 29, 2009 at 5:09 PM, Chris wrote:
> Terion Miller wrote:
>
>> Actually I have tried EVERYTHING suggested and it just does not work, in
>> my last query here I put
Terion Miller wrote:
Actually I have tried EVERYTHING suggested and it just does not work, in
my last query here I put in a user I know has orders and still nothing :
$sql3 = "SELECT admin.AdminID, workorders.WorkOrderID,
workorders.DATE_FORMAT(CreatedDate,'%m/%e/%y') AS SubmitDate,
workorder
Actually I have tried EVERYTHING suggested and it just does not work, in my
last query here I put in a user I know has orders and still nothing :
$sql3 = "SELECT admin.AdminID, workorders.WorkOrderID,
workorders.DATE_FORMAT(CreatedDate,'%m/%e/%y') AS SubmitDate,
workorders.Location, workorders.Adm
Martin Zvarík wrote:
This will work:
$sql = "
SELECT admin.AdminID, workorders.WHAT_YOU_WANT
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='".$_SESSION['user']."'
";
Don't use having in this case - this should be a 'where' clause.
A 'having' clause
Terion Miller wrote:
Hi Everyone! I am having problems getting an INNER JOIN to work and need
some tips trouble shooting where the problem may be.
What I'm trying to do is match up AdminID's from two tables and display only
that users orders, sounds simple enough right...but I can't get it to re
SELECT adminID FROM admin WHERE username=" $username "
$adminid = mysql_fetch_row ...
SELECT * FROM workorders WHERE adminid = $adminid
Terion Miller napsal(a):
Yes I've already done that and checked the db etc and I've turned my
brain ON hours ago, I came to the list because I'm stumped and
Yes I've already done that and checked the db etc and I've turned my brain
ON hours ago, I came to the list because I'm stumped and have tried all
manners of different ways to tell mySql
if admin ID = session user then get workorders where orderID = admin ID
On Thu, Jan 29, 2009 at 1:28 P
Try that query in console or use Navicat/phpMyAdmin to run it. Remove
the HAVING part to see if the SELECT returns what you need.
Terion Miller napsal(a):
Thanks Martin, oddly enough that still doesn't pull any results, it won't
even print the variables if I try to list them to see, I know my d
Are you sure you have MORE than ONE [order + admin that belongs
together] in those tables?
Now, turn on your brain and don't wait for my instructions, you already
know what to do... test test test
Terion Miller napsal(a):
When I removed the WHERE admin.user... part it did return something,
When I removed the WHERE admin.user... part it did return something, granted
it returned one adminID and one order (which did belong together) but the
adminID was not mine so I don't know how it picked that one randomly ...is
there a way to do what I need using two queries one to find out the users
What I wrote with HAVING doesn't do any difference - replace back to WHERE.
Your query is OK.
Try: echo mysql_error();
And try to remove the condition "WHERE admin.user..." if that outputs
anything.
Martin
Terion Miller napsal(a):
Thanks Martin, oddly enough that still doesn't pull any re
Thanks Martin, oddly enough that still doesn't pull any results, it won't
even print the variables if I try to list them to see, I know my db
connection is good checked that, and can do really simple queries, would
something be preventing a JOIN from working?
When I Reveal my variables this query s
This will work:
$sql = "
SELECT admin.AdminID, workorders.WHAT_YOU_WANT
FROM admin
INNER JOIN workorders ON admin.AdminID=workorders.AdminID
HAVING admin.username='".$_SESSION['user']."'
";
Terion Miller napsal(a):
Hi Everyone! I am having problems getting an INNER JOIN to work and need
some t
Maybe LEFT instead of INNER?
Terion Miller napsal(a):
Hi Everyone! I am having problems getting an INNER JOIN to work and need
some tips trouble shooting where the problem may be.
What I'm trying to do is match up AdminID's from two tables and display only
that users orders, sounds simple enoug
Try this:
$sql =
"SELECT admin.AdminID AS adminID, workorders.AdminID AS workadmin
FROM admin
INNER JOIN
workorders ON
(admin.AdminID=workorders.AdminID)
WHERE admin.UserName = '".$_SESSION['user']."' ";
maybe you have to call with different na
Hi Everyone! I am having problems getting an INNER JOIN to work and need
some tips trouble shooting where the problem may be.
What I'm trying to do is match up AdminID's from two tables and display only
that users orders, sounds simple enough right...but I can't get it to return
the AdminID...
My
17 matches
Mail list logo