Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-29 Thread Terion Miller
Hi Guys! Well I tried the INNER JOIN and still can not get it to echo the AdminID so I know it isn't working, (what kind of things should I think about that could make it not work) so far the only query that did work and return the AdminID was my original I believe it was referred to as hosed

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-29 Thread Shawn McKenzie
Terion Miller wrote: Hi Guys! Well I tried the INNER JOIN and still can not get it to echo the AdminID so I know it isn't working, (what kind of things should I think about that could make it not work) so far the only query that did work and return the AdminID was my original I believe it

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-29 Thread Terion Miller
Hi Again Here is the query and code I tried: $sql = SELECT * FROM workorders WHERE AdminID = (SELECT AdminID FROM admin WHERE UserName = ' . mysql_real_escape_string($_SESSION['user']) . '); $result2 = mysql_query ($sql); $row2 = mysql_fetch_assoc ($result2); $printrow =

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-29 Thread Shawn McKenzie
Terion Miller wrote: Hi Again Here is the query and code I tried: $sql = SELECT * FROM workorders WHERE AdminID = (SELECT AdminID FROM admin WHERE UserName = ' . mysql_real_escape_string($_SESSION['user']) . '); $result2 = mysql_query ($sql); $row2 = mysql_fetch_assoc

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-29 Thread Terion Miller
Well upon looking it was number 2, I had no orders in the workorder table, but here is an oddity I wonder if someone can explain if I run this simple query: $query = SELECT * FROM admin, workorders WHERE admin.UserName = '.$_SESSION['user'].' ; It returns adminID = 7 (my number is

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-29 Thread Shawn McKenzie
Terion Miller wrote: Well upon looking it was number 2, I had no orders in the workorder table, but here is an oddity I wonder if someone can explain if I run this simple query: $query = SELECT * FROM admin, workorders WHERE admin.UserName = '.$_SESSION['user'].' ; It returns

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-29 Thread Shawn McKenzie
Shawn McKenzie wrote: Terion Miller wrote: Well upon looking it was number 2, I had no orders in the workorder table, but here is an oddity I wonder if someone can explain if I run this simple query: $query = SELECT * FROM admin, workorders WHERE admin.UserName =

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie
Shawn McKenzie wrote: Terion Miller wrote: Well I'm stuck I have the AdminID but now I can't seem to use it to pull workorders with that AdminID . I couldn't get your block to work Andrew :( I think I'm just not using it right now that I have it...lol On Wed, Jan 28, 2009 at 2:26 PM,

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Terion Miller
On Wed, Jan 28, 2009 at 3:43 PM, Shawn McKenzie nos...@mckenzies.netwrote: Shawn McKenzie wrote: Terion Miller wrote: Well I'm stuck I have the AdminID but now I can't seem to use it to pull workorders with that AdminID . I couldn't get your block to work Andrew :( I think I'm just

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie
Terion Miller wrote: On Wed, Jan 28, 2009 at 3:43 PM, Shawn McKenzie nos...@mckenzies.netwrote: Shawn McKenzie wrote: Terion Miller wrote: Well I'm stuck I have the AdminID but now I can't seem to use it to pull workorders with that AdminID . I couldn't get your block to work Andrew :( I

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Terion Miller
On Wed, Jan 28, 2009 at 4:00 PM, Shawn McKenzie nos...@mckenzies.netwrote: Terion Miller wrote: On Wed, Jan 28, 2009 at 3:43 PM, Shawn McKenzie nos...@mckenzies.net wrote: Shawn McKenzie wrote: Terion Miller wrote: Well I'm stuck I have the AdminID but now I can't seem to use it to

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Terion Miller
On Wed, Jan 28, 2009 at 4:12 PM, Terion Miller webdev.ter...@gmail.comwrote: On Wed, Jan 28, 2009 at 4:00 PM, Shawn McKenzie nos...@mckenzies.netwrote: Terion Miller wrote: On Wed, Jan 28, 2009 at 3:43 PM, Shawn McKenzie nos...@mckenzies.net wrote: Shawn McKenzie wrote: Terion

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie
Here are my variables when I reveal them, I am picking up the right adminID I can't figure out why it's returning random orders though: $querySELECT admin.AdminID, workorders.AdminID FROM admin, workorders WHERE admin.UserName = 'tmiller' $result Resource id #5 $row key

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Chris
Here are my variables when I reveal them, I am picking up the right adminID I can't figure out why it's returning random orders though: $querySELECT admin.AdminID, workorders.AdminID FROM admin, workorders WHERE admin.UserName = 'tmiller' Please please please trim your posts to relevant

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Terion Miller
I'm not sure what you mean by trim the posts, please explain so I can spare folks from redundant text. Your post made perfect sense to me about the INNER JOIN , I looked it up but it is not returning the AdminID, maybe my syntax is wrong? $query = SELECT admin.AdminID , workorders.AdminID

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Chris
Terion Miller wrote: I'm not sure what you mean by trim the posts, please explain so I can spare folks from redundant text. Before you post, remove any text that you're not referencing (in this case I removed my suggestion). Your post made perfect sense to me about the INNER JOIN , I

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Terion Miller
Your post made perfect sense to me about the INNER JOIN , I looked it up but it is not returning the AdminID, maybe my syntax is wrong? $query = SELECT admin.AdminID , workorders.AdminID FROM admin INNER JOIN workorders ON AdminID(admin,

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Chris
Well I tried both ways and still cannot get it to pick up the AdminID, $query SELECT admin.AdminID , workorders.AdminID FROM admin INNER JOIN workorders on AdminID WHERE admin.UserName = 'tmiller' $result $row $SortBy WorkOrderID DESC $Page 1 $PerPage30 $StartPage 0 $sql

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie
Terion Miller wrote: Your post made perfect sense to me about the INNER JOIN , I looked it up but it is not returning the AdminID, maybe my syntax is wrong? $query = SELECT admin.AdminID , workorders.AdminID FROM admin

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Chris
The main problem is that you've never explained what you want to get from the query. The replies have used your code as an example and I'm pretty sure that's not what you want. Unless I totally mis-understand what you want, you have 2 options: 1. Use the 2 queries that I gave you in a

Re: [PHP] Making a Variable from different tables with Matching Dbfields?

2009-01-28 Thread Shawn McKenzie
Chris wrote: The main problem is that you've never explained what you want to get from the query. The replies have used your code as an example and I'm pretty sure that's not what you want. Unless I totally mis-understand what you want, you have 2 options: 1. Use the 2 queries that I