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-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']."' "; > >

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: > 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_

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 = p

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 i

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" qu

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 querie

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 previou

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
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" $PerPage"30" $StartPage

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 Admi

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 looke

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
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: $query"SELECT admin.AdminID, workorders.AdminID FROM admin, workorders WHERE admin.UserName = 'tmiller' " Please please please trim your posts to relevant stu

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: > $query"SELECT admin.AdminID, workorders.AdminID FROM admin, > workorders WHERE admin.UserName = 'tmiller' " > $result "Resource id #5" > $row

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 wrote: > > > On Wed, Jan 28, 2009 at 4:00 PM, Shawn McKenzie wrote: > >> Terion Miller wrote: >> > On Wed, Jan 28, 2009 at 3:43 PM, Shawn McKenzie > >wrote: >> > >> >> Shawn McKenzie wrote: >> >>> Terion Miller wrote: >> Well I'm stuck I have the

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 wrote: > Terion Miller wrote: > > On Wed, Jan 28, 2009 at 3:43 PM, Shawn McKenzie >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 > pull > workorders w

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 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 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 3:43 PM, Shawn McKenzie 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 pull > >> workorders with that AdminID . I couldn't get your block to work Andrew > :( > >> > >> I think I'm just not usi

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

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

2009-01-28 Thread Christoph Boget
> >> Because there is ambiguity w/r/t the columns you are selecting, you'll > >> need to use aliases. > >> http://dev.mysql.com/doc/refman/5.1/en/identifiers.html > >> In your code, when you are referencing the column, do so using the > >> alias. That should solve your problem. > > I just read it

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

2009-01-28 Thread Shawn McKenzie
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, Andrew Ballard wro

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

2009-01-28 Thread Andrew Ballard
On Wed, Jan 28, 2009 at 4:31 PM, Terion Miller wrote: > On Wed, Jan 28, 2009 at 3:22 PM, Christoph Boget > 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

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

2009-01-28 Thread Andrew Ballard
On Wed, Jan 28, 2009 at 4:22 PM, Christoph Boget 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 > > Because there is amb

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

2009-01-28 Thread Terion Miller
I just read it 3 times and I don't understand it. On Wed, Jan 28, 2009 at 3:22 PM, Christoph Boget 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

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

2009-01-28 Thread Christoph Boget
> 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 Because there is ambiguity w/r/t the columns you are selecting, you'll need to use

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

2009-01-28 Thread Terion Miller
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, Andrew Ballard wrote: > On Wed, Jan 28, 2009 at 3:18

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

2009-01-28 Thread Andrew Ballard
On Wed, Jan 28, 2009 at 3:18 PM, Terion Miller wrote: > Not sure if I'm wording this right, what I am trying to do is look in two > tables, match the ID to use to pull information > > Here's my code but it's not right, although it is picking up the user from > the session, I will also post wha

[PHP] Making a Variable from different tables with Matching Db fields?

2009-01-28 Thread Terion Miller
Not sure if I'm wording this right, what I am trying to do is look in two tables, match the ID to use to pull information Here's my code but it's not right, although it is picking up the user from the session, I will also post what my variable debugging lists: $query = "SELECT admin.Admi

Re: [PHP] Making a variable -Trim output

2001-02-26 Thread Clayton Dukes
Dan... You are the man, thanks! :-) - Original Message - From: "Dan Olsen" <[EMAIL PROTECTED]> To: "Clayton Dukes" <[EMAIL PROTECTED]> Sent: Monday, February 26, 2001 12:30 PM Subject: RE: [PHP] Making a variable -Trim output > > clayton

RE: [PHP] Making a variable -Trim output

2001-02-26 Thread Dan Olsen
{ $output .= $arrayoflines[i]; } } you’ll have to debug, but it should work. DanO -Original Message- From: Clayton Dukes [mailto:[EMAIL PROTECTED]] Sent: Monday, February 26, 2001 8:43 AM To: Dan Olsen; [EMAIL PROTECTED] Subject: Re: [PHP] Making a variable -Trim output

Re: [PHP] Making a variable -Trim output

2001-02-26 Thread Clayton Dukes
> -Original Message- > From: Clayton Dukes [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 26, 2001 8:17 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Making a variable > > > How can I make this a variable? > > ie: > > foreach (file("$file.txt"

Re: [PHP] Making a variable

2001-02-26 Thread Clayton Dukes
Thanks! - Original Message - From: "Dan Olsen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 26, 2001 11:39 AM Subject: RE: [PHP] Making a variable > > you can concatentate the variable inside the foreach loop. > > foreach (fil

RE: [PHP] Making a variable

2001-02-26 Thread Dan Olsen
IL PROTECTED]] Sent: Monday, February 26, 2001 8:17 AM To: [EMAIL PROTECTED] Subject: [PHP] Making a variable How can I make this a variable? ie: foreach (file("$file.txt") as $line) { print ("" . trim(str_replace("'", "''", $line)) . "\n&

[PHP] Making a variable

2001-02-26 Thread Clayton Dukes
How can I make this a variable?   ie:    foreach (file("$file.txt") as $line) {   print ("" . trim(str_replace("'", "''", $line)) . "\n");   }   changed to:   $data = foreach (file("$file.txt") as $line) {   print ("" . trim(str_replace("'", "''", $line)) . "\n");   }   Simply adding the $d