|
Posted by Scott Auge on 08/03/05 02:06
In article <icQHe.687950$Cl1.273185@fe03.news.easynews.com>,
Neal <pissed@comcast.net> wrote:
> JDS wrote:
> >
> >
> > You lost me.
> >
> > Post the results of
> >
> > DESCRIBE <tablename>
> >
> > for both tables. (i.e. what do the tables actually look like?)
> >
> > Also, what are the problems you are having? All you say is "but am having
> > problems". Just not enough info, hoss.
> >
>
> Sorry if I'm unclear. Basically, I'm giving unique passwords to schools
> in our district so they can post jobs. This part works and all the info
> gets put into a table called 'jobs'. But, I'm trying to make another
> page where they can login and only their school will show up (so I can
> later make it so they can delete their own entry if they fill their
> position).
>
> $sql = "SELECT * FROM login WHERE
> username = '$PHP_AUTH_USER' AND
> password = '$PHP_AUTH_PW'";
> $result = mysql_query( $sql )
> or die ( 'Unable to execute query.' );
> $X = mysql_fetch_array($result);
> $num = mysql_numrows( $result );
> if ( $num != 0 ) {
> $auth = true;
> }
> }
>
> if ( ! $auth ) {
>
> header( 'WWW-Authenticate: Basic realm="Private"' );
> header( 'HTTP/1.0 401 Unauthorized' );
> echo 'Authorization Required.';
> exit;
>
> } else {
>
> $school = "$X[school]";
> echo("$school");
> $S1 = "SELECT * FROM jobs WHERE school = '$school'";
> $S2 = mysql_query($S1);
> while($S3 = mysql_fetch_array($S2))
> {
> print("$S3[title] : $S3[school]");
> }
>
> I put that echo part just to test if I get the correct school according
> to the username and password (this part works). The problem I think is
> with the WHERE statement because when I take that out, I get ALL the
> entries from the jobs table printing the title field and the school
> field like it should. But with the above WHERE statement where I'm
> trying to limit it to one school only, I get just the school name from
> the echo.
That is how it is suppose to work.
>
> The login table has 3 fields: username, password, and school. The jobs
> table has a bunch of fields, one of them being schools that I'm trying
> to match to the login.
> Sorry, if I'm not more clear.
It sounds like that is what it is doing.
Maybe you can describe what you were hoping to get.
--
Available for Hire! http://amduus.com/Resumes/
Navigation:
[Reply to this message]
|