RE: [PHP-DB] i am lost (php warning)

2005-01-18 Thread Earl Clare
Hey thanks guys, the email was the problem
I had emial instead of email

Thanks for the assistance.

-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 18, 2005 1:45 AM
To: Earl Clare; php-db@lists.php.net
Subject: RE: [PHP-DB] i am lost (php warning)

Hi


it means that the query did not  produce a result - usually this is because
of a problem with the query.

$sql_query = mysql_query(SELECT * FROM cm_customer WHERE emial='$user');

I am guessing you misspelt email and this should be

$sql_query = mysql_query(SELECT * FROM cm_customer WHERE email='$user');


if you add an error trap it makes this knd of thing easier to spot

$sql_query = mysql_query(SELECT * FROM cm_customer WHERE email='$user') or
die(mysql_error());


HTH

Peter











 -Original Message-
 From: Earl Clare [mailto:[EMAIL PROTECTED]
 Sent: 18 January 2005 06:59
 To: php-db@lists.php.net
 Subject: [PHP-DB] i am lost (php warning)
 Importance: High


 Hi ya'll,



 I am lost as to why I am getting this error in my script. Can
 anyone kindly
 explain why this is so.



 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
 resource in /home/cm/public_html/cell/login.php



 --
 --
 ---

   My script

 --
 --
 ---





 if($_POST['submit'] == 'Log In')

 {

 $user=$_POST[email];

 $pass=$_POST[pass];

 $sql_query = mysql_query(SELECT * FROM cm_customer WHERE
 emial='$user');

 $sql_query = mysql_num_rows($sql_query);



 if (($sql_query) 0)

 {

 $valid = $user;

 session_start();

 session_register(valid);

 }

 }



   if (session_is_registered(reg))

   {

   echo ok;

   }



   else

   {

  echo sorry;

   }





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] i am lost (php warning)

2005-01-17 Thread Earl Clare
Hi ya'll,

 

I am lost as to why I am getting this error in my script. Can anyone kindly
explain why this is so.

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /home/cm/public_html/cell/login.php

 


---

  My script


---

 

 

if($_POST['submit'] == 'Log In')

{

$user=$_POST[email];

$pass=$_POST[pass];

$sql_query = mysql_query(SELECT * FROM cm_customer WHERE
emial='$user');

$sql_query = mysql_num_rows($sql_query);

 

if (($sql_query) 0)

{ 

$valid = $user;

session_start();

session_register(valid);

}

}

 

  if (session_is_registered(reg))

  {

  echo ok;

  }

 

  else

  {

 echo sorry;

  }

 



Re: [PHP-DB] while - if - problem

2003-06-06 Thread Earl
Hey thanks Mike
that surly made a difference.

Earl
'
- Original Message -
From: Ford, Mike [LSS] [EMAIL PROTECTED]
To: 'Earl' [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 6:13 AM
Subject: RE: [PHP-DB] while - if - problem


  -Original Message-
  From: Earl [mailto:[EMAIL PROTECTED]
  Sent: 04 June 2003 22:04
  To: PHP-DB
 
  FYI
  this was beginning to bug me out... so I decided to try the
  trim function
  and walla... it worked.
 
  Thanks for ya'll assistance.

 I was going to say this even before you added the trim() calls in , but
this
 really does look like an excellent situation for using the switch
construct
 (just look at all those trim() calls and array accesses you save!):


 while($cols=ifx_fetch_row($eventQuery))
 {
   switch (trim($cols['out_type']))
   {
 case '0':
   $r_away['linetype']='L';
   $r_home['linetype']='L';
   break;

 case '1':
   $r_away['linetype']='H';
   $r_home['linetype']='H';
   break;
   }

   switch (trim($cols[s_acro]))
   {
 case 'CF':
 case 'PF':
   $r_away['sport']='1';
   $r_home['sport']='1';
   $s_lt='PS';
   $t_lt='TP';
   break;

 case 'PB':
 case 'CB':
   $r_away['sport']='2';
   $r_home['sport']='2';
   $s_lt='PS';
   $t_lt='TP';
   break;

 case 'B':
   $r_away['sport']='3';
   $r_home['sport']='3';
   $s_lt='ML';
   $t_lt='TM';
   break;

 case 'H':
   $r_away['sport']='4';
   $r_home['sport']='4';
   $s_lt='ML';
   $t_lt='TM';
   break;
   }

 Cheers!

 Mike

 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] while - if problem

2003-06-05 Thread Earl
Hey guys, I've got a problem with this piece of code
it is skipping the contents of the if and elseif statements and only printing the else 
values, even though the if or one of the elseif statements might be true.
what could possibly be the problem??


$eventQuery=ifx_query('select * from eventtable'
  .' where e_date = today '
  .' and e_status in (O,C) '
   .' and out_id is not null '
  .' order by s_acro, e_acro ',$db) or die (ifx_error());

while($cols=ifx_fetch_row($eventQuery)) 
 {
 if (($cols['s_acro']=='CF') || ($cols[s_acro]=='PF')) 
   {
$r_away['sport']='1';
$r_home['sport']='1';
$s_lt='PS';
$t_lt='TP';
   }

  elseif (($cols['s_acro']=='PB') || ($cols['s_acro']=='CB'))
   {
$r_away['sport']='2';
$r_home['sport']='2';
$s_lt='PS';
$t_lt='TP';
   }
  
  elseif ($cols['s_acro']=='B')
   {
$r_away['sport']='3';
$r_home['sport']='3';
$s_lt='ML';
$t_lt='TM';
   }
   
  else   {
$r_away['sport']='4';
$r_home['sport']='4';
$s_lt='ML';
$t_lt='TM';
   }

output is always:  4, ML, TM


thanks in advance



Re: [PHP-DB] while - if problem

2003-06-05 Thread Earl
Sorry about that I did not get the closing tag when i copied the code.
I did as you said and it still gave the same problem.
below is the complete code

$eventQuery=ifx_query('select * from event'
  .' where e_date = today '
  .' and e_status in (O,C) '
   .' and out_id is not null '
  .' order by s_acro, e_acro ',$db) or die (ifx_error());

while($cols=ifx_fetch_row($eventQuery))
 {
  if ($cols['out_type']=='0')
   {
$r_away['linetype']='L';
$r_home['linetype']='L';
   }

  elseif ($cols['out_type']=='1')
   {
$r_away['linetype']='H';
$r_home['linetype']='H';
   }

  if (($cols['s_acro']=='CF') || ($cols[s_acro]=='PF'))
   {
$r_away['sport']='1';
$r_home['sport']='1';
$s_lt='PS';
$t_lt='TP';
   }

  elseif (($cols['s_acro']=='PB') || ($cols['s_acro']=='CB'))
   {
$r_away['sport']='2';
$r_home['sport']='2';
$s_lt='PS';
$t_lt='TP';
   }

  elseif ($cols['s_acro']=='B')
   {
$r_away['sport']='3';
$r_home['sport']='3';
$s_lt='ML';
$t_lt='TM';
   }

  else
$r_away['sport']='4';
$r_home['sport']='4';
$s_lt='ML';
$t_lt='TM';


$r_away['rotation']=$cols['out_id'];
$r_home['rotation']=($r_away['rotation'] + 1);

echo .$r_away['rotation']. , .$r_home['rotation']. ,
.$r_away['linetype']. , .$r_home['linetype']. , .$r_away['sport']. ,
.$r_home['sport'].\n;
 }
-



- Original Message -
From: Becoming Digital [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:52 PM
Subject: Re: [PHP-DB] while - if problem


 You don't have a closing bracket on your while() loop and you should not
have
 the else comments bracketed.  Try this:

 while($cols=ifx_fetch_row($eventQuery))
 {
  if (($cols['s_acro']=='CF') || ($cols[s_acro]=='PF'))
{
 $r_away['sport']='1';
 $r_home['sport']='1';
 $s_lt='PS';
 $t_lt='TP';
}

   elseif (($cols['s_acro']=='PB') || ($cols['s_acro']=='CB'))
{
 $r_away['sport']='2';
 $r_home['sport']='2';
 $s_lt='PS';
 $t_lt='TP';
}

   elseif ($cols['s_acro']=='B')
{
 $r_away['sport']='3';
 $r_home['sport']='3';
 $s_lt='ML';
 $t_lt='TM';
}

   else
 $r_away['sport']='4';
 $r_home['sport']='4';
 $s_lt='ML';
 $t_lt='TM';
 }


 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com


 - Original Message -
 From: Earl [EMAIL PROTECTED]
 To: PHP-DB [EMAIL PROTECTED]
 Sent: Wednesday, 04 June, 2003 15:44
 Subject: [PHP-DB] while - if problem


 Hey guys, I've got a problem with this piece of code
 it is skipping the contents of the if and elseif statements and only
printing
 the else values, even though the if or one of the elseif statements might
be
 true.
 what could possibly be the problem??

 --
--
 
 $eventQuery=ifx_query('select * from eventtable'
   .' where e_date = today '
   .' and e_status in (O,C) '
.' and out_id is not null '
   .' order by s_acro, e_acro ',$db) or die (ifx_error());

 while($cols=ifx_fetch_row($eventQuery))
  {
  if (($cols['s_acro']=='CF') || ($cols[s_acro]=='PF'))
{
 $r_away['sport']='1';
 $r_home['sport']='1';
 $s_lt='PS';
 $t_lt='TP';
}

   elseif (($cols['s_acro']=='PB') || ($cols['s_acro']=='CB'))
{
 $r_away['sport']='2';
 $r_home['sport']='2';
 $s_lt='PS';
 $t_lt='TP';
}

   elseif ($cols['s_acro']=='B')
{
 $r_away['sport']='3';
 $r_home['sport']='3';
 $s_lt='ML';
 $t_lt='TM';
}

   else   {
 $r_away['sport']='4';
 $r_home['sport']='4';
 $s_lt='ML';
 $t_lt='TM';
}
 --
--
 
 output is always:  4, ML, TM


 thanks in advance




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] while - if - problem

2003-06-05 Thread Earl
FYI
this was beginning to bug me out... so I decided to try the trim function
and walla... it worked.

Thanks for ya'll assistance.

---
$eventQuery=ifx_query('select * from event'
  .' where e_date = today '
  .' and e_status in (O,C) '
   .' and out_id is not null '
  .' order by s_acro, e_acro ',$db) or die (ifx_error());

while($cols=ifx_fetch_row($eventQuery)) 
 {
  if (trim($cols['out_type'])=='0') 
   {
$r_away['linetype']='L';
$r_home['linetype']='L';
   }
  
  elseif (trim($cols['out_type'])=='1')
   {
$r_away['linetype']='H';
$r_home['linetype']='H';
   }
  
  if (trim($cols['s_acro'])=='CF' || trim($cols[s_acro])=='PF') 
   {
$r_away['sport']='1';
$r_home['sport']='1';
$s_lt='PS';
$t_lt='TP';
   }

  elseif (trim($cols['s_acro'])=='PB' || trim($cols['s_acro'])=='CB')
   {
$r_away['sport']='2';
$r_home['sport']='2';
$s_lt='PS';
$t_lt='TP';
   }
  
  elseif (trim($cols['s_acro'])=='B')
   {
$r_away['sport']='3';
$r_home['sport']='3';
$s_lt='ML';
$t_lt='TM';
   }
   
  elseif (trim($cols['s_acro'])=='H')
   {
$r_away['sport']='4';
$r_home['sport']='4';
$s_lt='ML';
$t_lt='TM';
   }

$r_away['rotation']=$cols['out_id'];
$r_home['rotation']=($r_away['rotation'] + 1);

echo .$r_away['rotation']. , .$r_home['rotation']. , .$r_away['linetype']. , 
.$r_home['linetype']. , .$r_away['sport']. , .$r_home['sport'].\n; 
 }

[PHP-DB] multiple checkbox selection for search form

2003-02-18 Thread Earl Clare
hey guys,

I need some assistance here...
I am toying with a search form that will allow the user to select 3 options from a set 
of checkboxes to search by (eg.)

[[ Select any 3 type ]]

[ ] option1   [ ] option2   [ ] option3
[ ] option4   [ ] option5   [ ] option6
[ ] option7   [ ] option8   [ ] option9

what I would like to do is to allow then to select only 3 options
then search the database for the 3 options selected.

thanks in advance.






[PHP-DB] using more that 2 conditions to obtain info from db

2002-09-26 Thread Earl Clare

hi everyone,

I am new to all php and mySQL.
What i am trying to do is to obtain information from the db using 3 conditions.
this is what i've got

$sql_num = mysql_query(SELECT * FROM siteinfo WHERE dive_operator = '1' AND status = 
'1',$db) or die (mysql_error());

the 3 conditions i need is

dive_operator=1
destination=whatever
status=1

how can i add destination=whatever to the mix?

thanks in advance for your assistance.