I'm sorry but I must be missing something fundamental here. This is how my code looks,
and if the
SQL query yields nothing and emits no error (as it currently is) it simply reverts to
error.php:
$sql = "SELECT * FROM $table_users WHERE usrName='$username' AND
usrPswd=password('$password') AND affil_team RLIKE '$team+'";
$result = mysql_query($sql, $connection) or die(mysql_error());
$num = mysql_num_rows($result);
//User hasn't been found in DB with current details:
if ($num == 0) {
header("Location: error.php?err=n_player);
exit;
}
else {
while($row = mysql_fetch_array($result)) {
etc etc
Cheers again:
Russ
On Wed, 19 Sep 2001 09:26:07 -0500 Rick Emery <[EMAIL PROTECTED]> wrote:
> $query = "SELECT * FROM $table_users WHERE usrName='$username' AND
> usrPswd=password('$password') AND affil_team RLIKE '$team+'"
> print $query
>
> what were the contents of $query
>
> -----Original Message-----
> From: Russ Michell [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 19, 2001 9:19 AM
> To: Rick Emery
> Cc: [EMAIL PROTECTED]
> Subject: Re: RE: [PHP-DB] Query construction
>
>
> If you mean did the pattern I'm trying to match: $team, contain what I
> though it should:
> 'footballSat' then yes it did. I also receieve no error message from
> MySQl....
>
> The string in the table field I can view/alter in phpMyAdmin and I've tried
> matching $team in the
> query to the string as: footballSatfootballSun (etc etc) and also as:
> footballSat footballSun (etc
> etc)..
>
> Any ideas??
> Many thanks.
>
> Russ
>
> On Wed, 19 Sep 2001 09:12:36 -0500 Rick Emery <[EMAIL PROTECTED]> wrote:
>
> > When you printed-out the string variable containing the SELECT statement,
> > what did it look like?
> >
> > -----Original Message-----
> > From: Russ Michell [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, September 19, 2001 9:01 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Query construction
> >
> >
> > Hi there:
> >
> > Further to a previous submission (which can be ignored), I'd like the
> > following query to 'search' a
> > table field of different team names (stored as a single string), but it
> > does't seem to work!
> >
> > "SELECT * FROM $table_users WHERE usrName='$username' AND
> > usrPswd=password('$password') AND affil_team RLIKE '$team+'";
> > (I've also tried: RLIKE '$team?' )
> >
> > This should match the string found in the variable: '$team' with the some
> of
> > contents (string)
> > found in 'affil_team'.
> >
> > For example my test has been, trying to find 'footballSat', so $team =
> > 'footballSat'. 'footballSat'
> > exists as part of the string in the 'affil_team' field but the above query
> > refuses to find
> > 'footballSat'!! (No error is received though)
> >
> > I'm using MySQL 3.22.32 + php4.0.3pl1
> >
> > Cheers
> > Russ
> >
> > #-------------------------------------------------------#
> >
> > "Believe nothing - consider everything"
> >
> > Russ Michell
> > Anglia Polytechnic University Webteam
> > Room 1C 'The Eastings' East Road, Cambridge
> >
> > e: [EMAIL PROTECTED]
> > w: www.apu.ac.uk/webteam
> > t: +44 (0)1223 363271 x 2331
> >
> > www.theruss.com
> >
> > #-------------------------------------------------------#
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
> #-------------------------------------------------------#
>
> "Believe nothing - consider everything"
>
> Russ Michell
> Anglia Polytechnic University Webteam
> Room 1C 'The Eastings' East Road, Cambridge
>
> e: [EMAIL PROTECTED]
> w: www.apu.ac.uk/webteam
> t: +44 (0)1223 363271 x 2331
>
> www.theruss.com
>
> #-------------------------------------------------------#
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
e: [EMAIL PROTECTED]
w: www.apu.ac.uk/webteam
t: +44 (0)1223 363271 x 2331
www.theruss.com
#-------------------------------------------------------#
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]