RE: [PHP-DB] Select Statement with output in different colors.

2003-06-17 Thread Christopher Lyon
Thank you for the heads up. I did notice that is must have a ; after
every variable case entry, e.g. $bg = 'blue'; in order to work right.

That was at least how I had to get it working.



> -Original Message-
> From: Becoming Digital [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 17, 2003 9:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Select Statement with output in different
colors.
> 
> Here's a slight alteration to Peter's code in "case" someone isn't
> familiar with
> switch statements.  Ooh, such a bad pun, as if there's any other kind.
> 
>  $query = 'SELECT * FROM table
> $mysql_result = mysql_query($query, $link);
> 
> while($row = mysql_fetch_array($mysql_result))
> {
> switch ($row["event"] )
> {
> case event_one:
> $bg = 'blue'
> break;
> case event_two:
> $bg = 'red'
> break;
> case event_three:
> $bg = 'green'
> break;
> default:
> $bg = 'white'
> }
> print '
> da da da  
> ';
> }// end while
> ?>
> 
> 
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
> 
> 
> - Original Message -
> From: "Peter Lovatt" <[EMAIL PROTECTED]>
> To: "Christopher Lyon" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, 17 June, 2003 17:42
> Subject: RE: [PHP-DB] Select Statement with output in different
colors.
> 
> 
> Try this
> 
> $query = 'SELECT * FROM table
> $mysql_result = mysql_query($query, $link);
> 
> while($row = mysql_fetch_array($mysql_result))
> {
> 
> 
>  switch ($row["event"] )
>  {
>  case event_one:
> $bg = 'blue'
>  break;
>  case event_one:
> $bg = 'red'
>  break;
>  case event_one:
> $bg = 'green'
>  break;
>  default:
> $bg = 'white'
> 
>  }
> 
> 
>  print '
>  da da da  
> ';
> 
> 
>  }// end while
> 
> 
> 
> 
> HTH
> 
> Peter
> 
> 
> 
> -Original Message-
> From: Christopher Lyon [mailto:[EMAIL PROTECTED]
> Sent: 17 June 2003 22:35
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Select Statement with output in different colors.
> 
> 
> I have a php script that does some select statements, on mysql, and
> outputs that to a table. I would like to change the color of the table
> row depending upon one of the fields. The select statements are from a
> syslog database that I have and I would like to highlight key events
by
> changing the colors for that row. Example would be MAJOR, yellow and
> INFO, green. Does anybody have any examples of how to do this?
> 
> 
> 
> 
> --
> 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 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



Re: [PHP-DB] Select Statement with output in different colors.

2003-06-17 Thread Becoming Digital
Here's a slight alteration to Peter's code in "case" someone isn't familiar with
switch statements.  Ooh, such a bad pun, as if there's any other kind.


da da da  
';
}// end while
?>


Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: "Peter Lovatt" <[EMAIL PROTECTED]>
To: "Christopher Lyon" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, 17 June, 2003 17:42
Subject: RE: [PHP-DB] Select Statement with output in different colors.


Try this

$query = 'SELECT * FROM table
$mysql_result = mysql_query($query, $link);

while($row = mysql_fetch_array($mysql_result))
{


 switch ($row["event"] )
 {
 case event_one:
$bg = 'blue'
 break;
 case event_one:
$bg = 'red'
 break;
 case event_one:
$bg = 'green'
 break;
 default:
$bg = 'white'

 }


 print '
 da da da  
';


 }// end while




HTH

Peter



-Original Message-
From: Christopher Lyon [mailto:[EMAIL PROTECTED]
Sent: 17 June 2003 22:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select Statement with output in different colors.


I have a php script that does some select statements, on mysql, and
outputs that to a table. I would like to change the color of the table
row depending upon one of the fields. The select statements are from a
syslog database that I have and I would like to highlight key events by
changing the colors for that row. Example would be MAJOR, yellow and
INFO, green. Does anybody have any examples of how to do this?




--
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Select Statement with output in different colors.

2003-06-17 Thread Peter Lovatt
Try this

$query = 'SELECT * FROM table  
$mysql_result = mysql_query($query, $link);

while($row = mysql_fetch_array($mysql_result)) 
{


 switch ($row["event"] )
 {
 case event_one:
$bg = 'blue'
 break;
 case event_one:
$bg = 'red'
 break;
 case event_one:
$bg = 'green'
 break;
 default:
$bg = 'white'

 }
 
 
 print '
 da da da  
';
 
 
 }// end while




HTH

Peter



-Original Message-
From: Christopher Lyon [mailto:[EMAIL PROTECTED]
Sent: 17 June 2003 22:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select Statement with output in different colors.


I have a php script that does some select statements, on mysql, and
outputs that to a table. I would like to change the color of the table
row depending upon one of the fields. The select statements are from a
syslog database that I have and I would like to highlight key events by
changing the colors for that row. Example would be MAJOR, yellow and
INFO, green. Does anybody have any examples of how to do this?


 

-- 
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] Select Statement with output in different colors.

2003-06-17 Thread Christopher Lyon
I have a php script that does some select statements, on mysql, and
outputs that to a table. I would like to change the color of the table
row depending upon one of the fields. The select statements are from a
syslog database that I have and I would like to highlight key events by
changing the colors for that row. Example would be MAJOR, yellow and
INFO, green. Does anybody have any examples of how to do this?


 

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



Re: [PHP-DB] Select statement drops 10th digit during table lookup?

2003-06-13 Thread Doug Thompson
Why not use the built-in conversion functions in mysql?

>From the manual:

INET_NTOA(expr) 
Given a numeric network address (4 or 8 byte), returns the dotted-quad representation 
of the address as a string: 
mysql> SELECT INET_NTOA(3520061480);
   ->  "209.207.224.40"

INET_ATON(expr) 
Given the dotted-quad representation of a network address as a string, returns an 
integer that represents the numeric value of the address. Addresses may be 4 or 8 byte 
addresses: 
mysql> SELECT INET_ATON("209.207.224.40");
   ->  3520061480


Doug



On Fri, 13 Jun 2003 10:19:32 +0100, Ronan Chilvers wrote:

>Here's how I did it when playing with this...
>
>Table definition:-
>
>CREATE TABLE ip_list (
>  ip_from double default NULL,
>  ip_to double default NULL,
>  country_code char(2) default NULL,
>  country_name varchar(100) default NULL,
>  KEY ip_from (ip_from,ip_to,country_code,country_name)
>) TYPE=MyISAM;
>
>Basic code to query it (takes a parameter 'ip' as GET paramter):-
>   /*
>   IP Lookup script
>   * prints a country code and name for an ip in the $_GET array
>   */
>
>   //Vars & Constants
>   define("HOST","myhost");
>   define("USER","myuser");
>   define("PASS","mypassword");
>   define("DB","ips");
>   define("IP",$_GET["ip"]);
>
>   // Functions
>   function dbconnect() {
>   if (($conn=mysql_pconnect(HOST,USER,PASS))===false) {
>   die("Couldn't connect to server");
>   }
>   if (!mysql_select_db(DB,$conn)) {
>   die("Couldn't select database");
>   }
>   return $conn;
>   }
>   function dbclose($conn) {
>   if (!mysql_close($conn)) {
>   die("Couldn't close database connection");
>   }
>   return true;
>   }
>   function dosql($SQL) {
>   if (($result=mysql_query($SQL))===false) {
>   die("Couldn't do sql : $SQL");
>   }
>   return $result;
>   }
>
>   //Core
>   $SQL = "SELECT COUNTRY_NAME AS cn, COUNTRY_CODE AS cc FROM ips.ip_list WHERE 
> IP_NUM BETWEEN ip_from AND ip_to";
>
>   $conn = dbconnect();
>
>   $ip = "127.0.0.1";
>
>   $QSQL = str_replace("IP_NUM",sprintf("%u",ip2long(IP)),$SQL);
>   
>   $result = dosql($QSQL);
>   $data = mysql_fetch_array($result);
>
>   echo "ip:".IP."";
>   echo "cn:".$data["cn"]."";
>   echo "cc:".$data["cc"];
>
>   dbclose($conn);
>?>
>
>HTH !!
>
>Ronan
>e: [EMAIL PROTECTED]
>t: 01903 739 997
>w: www.thelittledot.com
>
>The Little Dot is a partnership of
>Ronan Chilvers and Giles Webberley
>
>-- 
>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



Re: [PHP-DB] Select statement drops 10th digit during table lookup?

2003-06-13 Thread Ronan Chilvers
Here's how I did it when playing with this...

Table definition:-

CREATE TABLE ip_list (
  ip_from double default NULL,
  ip_to double default NULL,
  country_code char(2) default NULL,
  country_name varchar(100) default NULL,
  KEY ip_from (ip_from,ip_to,country_code,country_name)
) TYPE=MyISAM;

Basic code to query it (takes a parameter 'ip' as GET paramter):-
";
echo "cn:".$data["cn"]."";
echo "cc:".$data["cc"];

dbclose($conn);
?>

HTH !!

Ronan
e: [EMAIL PROTECTED]
t: 01903 739 997
w: www.thelittledot.com

The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley

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



Re: [PHP-DB] Select statement drops 10th digit during table lookup?

2003-06-13 Thread Jason Wong
On Friday 13 June 2003 15:48, G & E Holt wrote:
> I hope this is something easy I am overlooking but here goes:
>
> I have a table called:  country which has the following fields:
>
>  FieldType
>  ip_from  double(11,0)
>  ip_todouble(11,0)
>  country_code char(2)
>  country_name varchar(50)

Shouldn't you be using some INTEGER type instead of DOUBLE? An unsigned INT 
will just about handle it (2^32).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It seems like the less a statesman amounts to, the more he loves the flag.
*/


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



Re: [PHP-DB] Select statement drops 10th digit during table lookup?

2003-06-13 Thread Ronan Chilvers
On 13 Jun,2003 at  0:48 G & E Holt wrote:

> $resolved=$DB_site->query_first("SELECT * FROM country WHERE
> '$resolvingip' BETWEEN ip_from AND ip_to");

Don't think you should have the '' around the ip number.  Does that help?


Ronan
e: [EMAIL PROTECTED]
t: 01903 739 997
w: www.thelittledot.com

The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley

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



[PHP-DB] Select statement drops 10th digit during table lookup?

2003-06-13 Thread G & E Holt

I hope this is something easy I am overlooking but here goes:

I have a table called:  country which has the following fields:

 FieldType
 ip_from  double(11,0)
 ip_todouble(11,0)
 country_code char(2)
 country_name varchar(50)

IP_FROM  NUMERICAL (DOUBLE)Beginning of IP address range.
IP_TONUMERICAL (DOUBLE)Ending of IP address range.
COUNTRY_CODE CHAR(2)   Two-character country code based on
ISO 3166.
COUNTRY_NAME VARCHAR(50)   Country name based on ISO 31

Here are a few lines from the country table which starts at 33996344  and
ends at:
 ip_from  ip_to country_code  country_name
33996344 33996351 GB   UNITED KINGDOM
50331648 83886079 US   UNITED STATES
94585424 94585439 SE   SWEDEN

3714175488 3714175743 DK   DENMARK
3715104768 3715629055 JP   JAPAN
3717201920 3718840319 KR   KOREA, REPUBLIC OF

The IP_FROM and IP_TO fields of the database are numeric representations of
the dotted IP address.

The formula to convert an IP Address of the form A.B.C.D to an IP Number is:

 IP Number = A x (256*256*256) + B x (256*256) + C x 256 + D

So here is what I do in PHP:

$resolvingip=sprintf("%u",ip2long($ip));
$resolved=$DB_site->query_first("SELECT * FROM country WHERE '$resolvingip'
BETWEEN ip_from AND ip_to");
$resolvecountry = $resolved[country_code];

so I type in:  213.21.158.96  and $resolvingip shows as: 3574963808

when I check $resolved[ip_from] I find out the SELECT statement looks up
this line:

335544320 369098751 US UNITED STATES
instead of looking up this line:
3574956032 3574972415 IT ITALY

which really makes me think the SELECT statement is dropping the last
digit...

I tried ip:  10.25.215.30 and $resolvingip shows as 169465630 which looks up
correctly since it is only 9 digits.

When I try ip: 68.109.155.135 $resolvingip shows as 1148033927 but the
SELECT statement drops the last digit and goes to a 9 digit again:
114803392

Any help is greatly appreciated..

Thanks!









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



RE: [PHP-DB] select statement

2002-10-25 Thread Michael Hazelden
What's the error?

-Original Message-
From: Steve Dodkins [mailto:Steve.Dodkins@;ebm-ziehl.co.uk]
Sent: 25 October 2002 16:46
To: Php-Db (E-mail)
Subject: [PHP-DB] select statement




Hi

I get an error message with the following statement, if I remove the 'AND
works_order_part_no=parts_parts_no' I don't get an error message but also
get the wrong data ??
 
$link = mysql_connect($host, $user, $pass); 
mysql_select_db("DB_EDMsystem", $link); 
$result = mysql_query("SELECT * FROM labor, works_orders, parts where
labor_ord_no = works_orders_ord_no AND works_order_part_no =
parts_parts_no",$link); 
echo ""; 
echo"Works OrderPart NumberOrder
QtyMade QtyOptions"; 
while($myrow = mysql_fetch_array($result)) 


Regards

Steve Dodkins

IMPORTANT NOTICE The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended to
be relied upon by any person without subsequent written confirmation of its
contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
accuracy or completeness of this message as it has been transmitted over a
public network.   Furthermore, the content of this e-mail is the personal
view of the sender and does not represent the advice, views or opinion of
our company. Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation. In particular (but not
by way of limitation) our company disclaims all responsibility and accepts
no liability for any e-mails which are defamatory, offensive, racist or in
any other way are in breach of any third party's rights, including breach of
confidence, privacy or other rights. If you have received this e-mail
message in error, please notify me immediately by telephone. Please also
destroy and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.  If you have
received this E-mail in error, or suspect that the message may have been
intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
468555.
ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ




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


_
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control 
Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the "Company"). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all 
copies of this message. Please note that it is your responsibility to scan this 
message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*

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




[PHP-DB] select statement

2002-10-25 Thread Steve Dodkins


Hi

I get an error message with the following statement, if I remove the 'AND
works_order_part_no=parts_parts_no' I don't get an error message but also
get the wrong data ??
 
$link = mysql_connect($host, $user, $pass); 
mysql_select_db("DB_EDMsystem", $link); 
$result = mysql_query("SELECT * FROM labor, works_orders, parts where
labor_ord_no = works_orders_ord_no AND works_order_part_no =
parts_parts_no",$link); 
echo ""; 
echo"Works OrderPart NumberOrder
QtyMade QtyOptions"; 
while($myrow = mysql_fetch_array($result)) 


Regards

Steve Dodkins

IMPORTANT NOTICE The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended to
be relied upon by any person without subsequent written confirmation of its
contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
accuracy or completeness of this message as it has been transmitted over a
public network.   Furthermore, the content of this e-mail is the personal
view of the sender and does not represent the advice, views or opinion of
our company. Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation. In particular (but not
by way of limitation) our company disclaims all responsibility and accepts
no liability for any e-mails which are defamatory, offensive, racist or in
any other way are in breach of any third party's rights, including breach of
confidence, privacy or other rights. If you have received this e-mail
message in error, please notify me immediately by telephone. Please also
destroy and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.  If you have
received this E-mail in error, or suspect that the message may have been
intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
468555.
ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ




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




RE: [PHP-DB] SELECT statement problem

2002-08-15 Thread Miles Thompson

Assign the SELECT statement to a variable and then echo the variable. Does 
it contain values you expect? If the database is MySQL it can be  very 
silent about errors in the SELECT and simply returns no results.

Cheers - Miles

At 02:58 PM 8/15/2002 -0400, Evan S. Weiner wrote:
>It only outputs the first tech.  It worked fine until I tried to add the 
>end date ino it.
>
>Thanks for all teh help!
>
>// Get technician info
>$TECH_SQL = "SELECT * FROM employees";
>$TECH = MYSQL_QUERY( $TECH_SQL, $CONNECTION) OR DIE ( mysql_error() );
>
>while ( $row = mysql_fetch_array( $TECH ) )
>{
> $tech_id = $row["id"];
> $tech_name_last = $row["name_last"];
> $tech_name_first = $row["name_first"];
>
> $tech_initials_first = substr( $tech_name_first, 0, 1 );
> $tech_initials_last = substr( $tech_name_last, 0, 1);
> $tech_initials = "$tech_initials_first$tech_initials_last";
>
> $tech_name = "$tech_name_first $tech_name_last";
>
> echo "  \n";
> echo "   class=\"big\">$tech_name\n";
>
> // Reset counters for this tech
> $tech_hour = 0;
> $tech_cost = 0;
>
>
> // Start pulling ticket work
> $TICKET_WORK_SQL = "SELECT * FROM tickets_work
> WHERE employee_id = '$tech_id'
> AND start > '$start'
> AND end < '$end'
> ORDER BY start";
> $TICKET_WORK_INFO = MYSQL_QUERY( $TICKET_WORK_SQL, $CONNECTION ) 
> OR DIE ( mysql_error() );
>
> while ( $row = mysql_fetch_array( $TICKET_WORK_INFO ) )
> {
> $ticket_id = $row["ticket_id"];
> $start = $row["start"];
> $end = $row["end"];
> $total_hours = $row["total_hours"];
> $total_billable = $row["total_billable"];
>
>-Original Message-
>From: Miles Thompson [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, August 15, 2002 2:26 PM
>To: [EMAIL PROTECTED]
>Subject: Re: [PHP-DB] SELECT statement problem
>
>
>SELECT * FROM tickets_work
>WHERE employee_id = '$tech_id' AND
>  start > '$start' AND
>  end < '$end'
>ORDER BY start
>
>Which will select everything from tickets_work for a given employee between
>start and end. What is not working?
>
>Miles Thompson
>
>At 02:15 PM 8/15/2002 -0400, Evan S. Weiner wrote:
> >Hello all,
> >
> >I have this SQL statement I am trying to use and no matter what
> >combination I use, I cannot get it to work.  The start and end if clauses
> >need to be grouped together.
> >
> >SELECT * FROM tickets_work WHERE employee_id = '$tech_id' && ( start >
> >'$start' && end < '$end' ) ORDER BY start
> >
> >Anyone able to help me?
> >
> >Thanks!
> >
> >Evan
> >
> >
> >--
> >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 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




RE: [PHP-DB] SELECT statement problem

2002-08-15 Thread Evan S. Weiner

It only outputs the first tech.  It worked fine until I tried to add the end date ino 
it.

Thanks for all teh help!

// Get technician info
$TECH_SQL = "SELECT * FROM employees";
$TECH = MYSQL_QUERY( $TECH_SQL, $CONNECTION) OR DIE ( mysql_error() );

while ( $row = mysql_fetch_array( $TECH ) )
{
$tech_id = $row["id"];
$tech_name_last = $row["name_last"];
$tech_name_first = $row["name_first"];

$tech_initials_first = substr( $tech_name_first, 0, 1 );
$tech_initials_last = substr( $tech_name_last, 0, 1);
$tech_initials = "$tech_initials_first$tech_initials_last";

$tech_name = "$tech_name_first $tech_name_last";

echo "  \n";
echo "  $tech_name\n";

// Reset counters for this tech
$tech_hour = 0;
$tech_cost = 0;


// Start pulling ticket work
$TICKET_WORK_SQL = "SELECT * FROM tickets_work
WHERE employee_id = '$tech_id'
AND start > '$start'
AND end < '$end'
ORDER BY start";
$TICKET_WORK_INFO = MYSQL_QUERY( $TICKET_WORK_SQL, $CONNECTION ) OR DIE ( 
mysql_error() );

while ( $row = mysql_fetch_array( $TICKET_WORK_INFO ) )
{
$ticket_id = $row["ticket_id"];
$start = $row["start"];
$end = $row["end"];
$total_hours = $row["total_hours"];
$total_billable = $row["total_billable"];

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 2:26 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] SELECT statement problem


SELECT * FROM tickets_work
WHERE employee_id = '$tech_id' AND
 start > '$start' AND
 end < '$end'
ORDER BY start

Which will select everything from tickets_work for a given employee between 
start and end. What is not working?

Miles Thompson

At 02:15 PM 8/15/2002 -0400, Evan S. Weiner wrote:
>Hello all,
>
>I have this SQL statement I am trying to use and no matter what 
>combination I use, I cannot get it to work.  The start and end if clauses 
>need to be grouped together.
>
>SELECT * FROM tickets_work WHERE employee_id = '$tech_id' && ( start > 
>'$start' && end < '$end' ) ORDER BY start
>
>Anyone able to help me?
>
>Thanks!
>
>Evan
>
>
>--
>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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] SELECT statement problem

2002-08-15 Thread Hutchins, Richard

Can you echo out the sql going in and any errors you're getting when the
query doesn't work then post that info to this list? It'll help both you and
us diagnose what might be going wrong. In addition, what datatype are the
columns named start and end in your database?

(Assuming database is MySQL)

Rich

-Original Message-
From: Evan S. Weiner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 2:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SELECT statement problem


Hello all,

I have this SQL statement I am trying to use and no matter what combination
I use, I cannot get it to work.  The start and end if clauses need to be
grouped together.

SELECT * FROM tickets_work WHERE employee_id = '$tech_id' && ( start >
'$start' && end < '$end' ) ORDER BY start

Anyone able to help me?

Thanks!

Evan


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




Re: [PHP-DB] SELECT statement problem

2002-08-15 Thread Miles Thompson

SELECT * FROM tickets_work
WHERE employee_id = '$tech_id' AND
 start > '$start' AND
 end < '$end'
ORDER BY start

Which will select everything from tickets_work for a given employee between 
start and end. What is not working?

Miles Thompson

At 02:15 PM 8/15/2002 -0400, Evan S. Weiner wrote:
>Hello all,
>
>I have this SQL statement I am trying to use and no matter what 
>combination I use, I cannot get it to work.  The start and end if clauses 
>need to be grouped together.
>
>SELECT * FROM tickets_work WHERE employee_id = '$tech_id' && ( start > 
>'$start' && end < '$end' ) ORDER BY start
>
>Anyone able to help me?
>
>Thanks!
>
>Evan
>
>
>--
>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] SELECT statement problem

2002-08-15 Thread Evan S. Weiner

Hello all,

I have this SQL statement I am trying to use and no matter what combination I use, I 
cannot get it to work.  The start and end if clauses need to be grouped together.

SELECT * FROM tickets_work WHERE employee_id = '$tech_id' && ( start > '$start' && end 
< '$end' ) ORDER BY start

Anyone able to help me?

Thanks!

Evan


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




RE: [PHP-DB] SELECT statement does not return rows

2002-02-01 Thread Shrock, Court

oops.forgot a semicolon on the first line of the multi-line code
segment

> -Original Message-
> $row = mysql_fetch_array($result)
> echo 'columnvalue';
> while(list($key, $val) = each($row)) {
>   // $row has two key/value pairs per column -- one integer, 
> one string
>   if (is_string($key)) {
> echo "$key$val";
>   }
> }

-- 
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]




RE: [PHP-DB] SELECT statement does not return rows

2002-02-01 Thread Shrock, Court

I am assuming that this code is NOT the file "do_mod_job.php".

What happens if you do this next line right after you execute your query?:

echo 'num rows fetched: '.mysql_num_rows($result).'';

also, the while loop shouldn't really be necessary as the query should only
return one record if I understand the naming of your fields correctly.  Your
echo statements don't have to have the variable encapsulated with
double-quotes either--it is actually easier on PHP if they are not (if you
use single-quotes rather than double-quotes as well when appropriate).

If there is a row being returned from the query as discovered above, you
might try the following to make sure that what you are getting is what you
are expecting:

$row = mysql_fetch_array($result)
echo 'columnvalue';
while(list($key, $val) = each($row)) {
  // $row has two key/value pairs per column -- one integer, one string
  if (is_string($key)) {
echo "$key$val";
  }
}
echo '';
exit;

basically, you need to verify that $row['id'] is not empty.


> -Original Message-
> Todd Williamsen <[EMAIL PROTECTED]> said:
> 
> > Weird..
> > 
> > I want to be able to edit records, which I have done in the 
> past, and I
> > cannot see why it isn't working...  I have tried single 
> qoutes around the
> > $row =  and that doesn't work either.  here is the code:
> > 
> > $db = @mysql_select_db($db_name, $connection) or die("Could 
> not select
> > database");
> > $sql="SELECT * FROM Jobs WHERE id = '$id' ";
> > $result = mysql_query($sql,$connection) or die("Couldn't 
> execute query");
> > while ($row = mysql_fetch_array($result))
> > {
> > $id = $row["id"];
> > $Industry = $row["Industry"];
> > $Other = $row["Other"];
> > $JobTitle = $row["JobTitle"];
> > $Description = $row["Description"];
> > $Location = $row["Location"];
> > $Date = $row["Date"];
> > }
> > ?>
> > 
> > 
> > Edit Job Posting
> > 
> > 
> > Edit Job Posting
> > 
> > ">
> >   
> > 
> > Job Information and Location
> > Job Description
> > 
> > 
> > 
> > Job Title:
> > " size=50
> > maxlength=75>
> > Industry:
> > " size=50
> > maxlength=75>
> > Other:
> > " size=50
> > maxlength=75>
> > Location:
> > " size=50
> > maxlength=75>
> > Date:
> > " size=30
> > maxlength=40>
> > 
> > 
> > Description:
> >> "$Description"; ?>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 

-- 
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]




Re: [PHP-DB] SELECT statement does not return rows

2002-02-01 Thread biorn

Is your id an integer or a char/varchar?  If it is an integer, take the 
quotes off $id in your select statement.  

Todd Williamsen <[EMAIL PROTECTED]> said:

> Weird..
> 
> I want to be able to edit records, which I have done in the past, and I
> cannot see why it isn't working...  I have tried single qoutes around the
> $row =  and that doesn't work either.  here is the code:
> 
> $db = @mysql_select_db($db_name, $connection) or die("Could not select
> database");
> $sql="SELECT * FROM Jobs WHERE id = '$id' ";
> $result = mysql_query($sql,$connection) or die("Couldn't execute query");
> while ($row = mysql_fetch_array($result))
> {
> $id = $row["id"];
> $Industry = $row["Industry"];
> $Other = $row["Other"];
> $JobTitle = $row["JobTitle"];
> $Description = $row["Description"];
> $Location = $row["Location"];
> $Date = $row["Date"];
> }
> ?>
> 
> 
> Edit Job Posting
> 
> 
> Edit Job Posting
> 
> ">
>   
> 
> Job Information and Location
> Job Description
> 
> 
> 
> Job Title:
> " size=50
> maxlength=75>
> Industry:
> " size=50
> maxlength=75>
> Other:
> " size=50
> maxlength=75>
> Location:
> " size=50
> maxlength=75>
> Date:
> " size=30
> maxlength=40>
> 
> 
> Description:
>"$Description"; ?>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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]




RE: [PHP-DB] SELECT statement does not return rows

2002-02-01 Thread Rick Emery

Did you print out the value of $sql before executing it?  Was it as you
expected?
If so, did you print out mysql_num_rows() to verify it's greater than 0?

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SELECT statement does not return rows


Weird..

I want to be able to edit records, which I have done in the past, and I
cannot see why it isn't working...  I have tried single qoutes around the
$row =  and that doesn't work either.  here is the code:

$db = @mysql_select_db($db_name, $connection) or die("Could not select
database");
$sql="SELECT * FROM Jobs WHERE id = '$id' ";
$result = mysql_query($sql,$connection) or die("Couldn't execute query");
while ($row = mysql_fetch_array($result))
{
$id = $row["id"];
$Industry = $row["Industry"];
$Other = $row["Other"];
$JobTitle = $row["JobTitle"];
$Description = $row["Description"];
$Location = $row["Location"];
$Date = $row["Date"];
}
?>


Edit Job Posting


Edit Job Posting

">
  

Job Information and Location
Job Description



Job Title:
" size=50
maxlength=75>
Industry:
" size=50
maxlength=75>
Other:
" size=50
maxlength=75>
Location:
" size=50
maxlength=75>
Date:
" size=30
maxlength=40>


Description:
  
















-- 
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]




[PHP-DB] SELECT statement does not return rows

2002-02-01 Thread Todd Williamsen

Weird..

I want to be able to edit records, which I have done in the past, and I
cannot see why it isn't working...  I have tried single qoutes around the
$row =  and that doesn't work either.  here is the code:

$db = @mysql_select_db($db_name, $connection) or die("Could not select
database");
$sql="SELECT * FROM Jobs WHERE id = '$id' ";
$result = mysql_query($sql,$connection) or die("Couldn't execute query");
while ($row = mysql_fetch_array($result))
{
$id = $row["id"];
$Industry = $row["Industry"];
$Other = $row["Other"];
$JobTitle = $row["JobTitle"];
$Description = $row["Description"];
$Location = $row["Location"];
$Date = $row["Date"];
}
?>


Edit Job Posting


Edit Job Posting

">
  

Job Information and Location
Job Description



Job Title:
" size=50
maxlength=75>
Industry:
" size=50
maxlength=75>
Other:
" size=50
maxlength=75>
Location:
" size=50
maxlength=75>
Date:
" size=30
maxlength=40>


Description:
  
















-- 
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]




RE: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Rick Emery

It's worked for me.  

You'll note that I added a new column "id".  Did you put that in your
table??
What error did you get

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 2:18 PM
To: 'Rick Emery'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Select statement only returns 1 record


Nope, that doesn't work

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 30, 2002 1:01 PM
To: 'Todd Williamsen'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Select statement only returns 1 record


";
while( $row = mysql_fetch_array($result) )
{
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$id=$row['id'];
print "$LastName, $FirstName";
}
?>
print "";

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select statement only returns 1 record


I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the
table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL
statement at
the top of the page:





-- 
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]




RE: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Todd Williamsen

Nope, that doesn't work

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 30, 2002 1:01 PM
To: 'Todd Williamsen'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Select statement only returns 1 record


";
while( $row = mysql_fetch_array($result) )
{
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$id=$row['id'];
print "$LastName, $FirstName";
}
?>
print "";

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select statement only returns 1 record


I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the
table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL
statement at
the top of the page:





-- 
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]




Re: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread biorn

You will need to put the option tag in a loop to get all of the records in 
the table.

 (this can go anywhere but in while loop)

";
$i++;
}
?>

Also, without the value in the option tag, you will not be passing anything 
to the form.

HTH

Maureen Biorn


Todd Williamsen <[EMAIL PROTECTED]> said:

> I am trying to get data from two columns, FirstName and Last name and
> displaying all the records LastName, FirstName in a drop down menu.
> 
> The weird thing is that it only displays one record.  I thought the table
> was hosed, but its not.  I tried it through another database and still
> doesn't work.
> 
> Here is the code:
> 
>  $db = mysql_connect($dbserver, $dbuser, $dbpass);
> mysql_select_db($dbname,$db);
> $sortby = "name ASC";
> $sql="SELECT * FROM webl_players ORDER BY $sortby";
> $result=mysql_query($sql,$db);
> $row = mysql_fetch_array($result);
> $FirstName = $row["FirstName"];
> $LastName = $row["LastName"];
> ?>
> 
> 
>   
>   
>   
> 
> I would list the whole page but its long!  There is another SQL statement at
> the top of the page:
> 
>  
> $db = mysql_connect($dbserver, $dbuser, $$dbpass);
> mysql_select_db($dbname, $db);
> $sql = "SELECT * FROM Canidate SORT BY 'LastName'";
> $result = mysql_query($sql);
> ?>
> 
> 
> 
> -- 
> 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]




RE: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Rick Emery

";
while( $row = mysql_fetch_array($result) )
{
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$id=$row['id'];
print "$LastName, $FirstName";
}
?>
print "";

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select statement only returns 1 record


I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL statement at
the top of the page:





-- 
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]




Re: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Miles Thompson

Check the manual for the mysql_fetch_array() function, it shows you how to 
extract data from $result. You will use the while loop (as shown in the 
manual's example) to fill your combo box / selct list /drop down menu, 
whatever we're calling that creature today.

Miles

At 12:45 PM 1/30/2002 -0600, Todd Williamsen wrote:
>I am trying to get data from two columns, FirstName and Last name and
>displaying all the records LastName, FirstName in a drop down menu.
>
>The weird thing is that it only displays one record.  I thought the table
>was hosed, but its not.  I tried it through another database and still
>doesn't work.
>
>Here is the code:
>
>$db = mysql_connect($dbserver, $dbuser, $dbpass);
>mysql_select_db($dbname,$db);
>$sortby = "name ASC";
>$sql="SELECT * FROM webl_players ORDER BY $sortby";
>$result=mysql_query($sql,$db);
>$row = mysql_fetch_array($result);
>$FirstName = $row["FirstName"];
>$LastName = $row["LastName"];
>?>
>
>
>   
>   
>   
>
>I would list the whole page but its long!  There is another SQL statement at
>the top of the page:
>
>
>$db = mysql_connect($dbserver, $dbuser, $$dbpass);
>mysql_select_db($dbname, $db);
>$sql = "SELECT * FROM Canidate SORT BY 'LastName'";
>$result = mysql_query($sql);
>?>
>
>
>
>--
>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]




[PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Todd Williamsen

I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL statement at
the top of the page:





-- 
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]




Re: [PHP-DB] SELECT statement

2001-04-05 Thread Jeffrey A Schoolcraft

* Julio Cuz, Jr. ([EMAIL PROTECTED]) wrote:
> Ron,
> 
> Thanks for your help, but my problem still there even when I made the 
> following changes:
> 
> $sql = "SELECT * FROM \"Remodel\" WHERE Email=\"".$find."\"";

You don't have to quote the table name either.  You can probably get
away with something like this:

$sql = "SELECT * FROM Remodel WHERE Email=\"$find\" \n";

I put the \n at the end of my queries, at the end of every line if it's
a long query, just makes it easier for me to read if I need to do
debugging later, it won't affect your query.

Jeff


-- 
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]




Re: [PHP-DB] SELECT statement

2001-04-04 Thread Julio Cuz, Jr.

Ron,

Thanks for your help, but my problem still there even when I made the 
following changes:

$sql = "SELECT * FROM \"Remodel\" WHERE Email=\"".$find."\"";

By the way, you're correct when saying that "WO" and "Email" are column 
names and '"$find" is what the user entered when searching for a record.

At 03:39 PM 4/4/2001 -0700, you wrote:
>At 03:24 PM 4/4/2001 -0700, Julio Cuz, Jr. wrote:
>>Every time I run the following code, I get this error if I use a NUMBER 
>>for the 'Email' case:
>>"Warning: Unable to jump to row 0 on PostgreSQL result index 2 in 
>>/html/rccd/remodel/display2.php on line 35"
>
>The problem is that your query is equivalent to going:
>
>SELECT * FROM "Remodel" WHERE "WO" LIKE 1; // or some other numerical value
>
>The "WO" is a string because it is in quotes so you are saying:
>
>WHERE string = integer
>
>Ain't gonna happen so the result is always empty.  What you want probably 
>is (assuming WO is a column name):
>
>$sql = "SELECT * FROM \"Remodel\" WHERE WO=\"".$find."\"";
>
>It is equals since you are using an integer instead of a string (like is 
>for strings).
>
>>or, if I use a string (i.e. [EMAIL PROTECTED]), I get this error message:
>>"Warning: PostgreSQL query failed: ERROR: Attribute 'jcuz' not found in 
>>/html/rccd/remodel/display2.php on line 33"
>
>Same problem.  "EMAIL" means the string "EMAIL" not the column called "EMAIL".
>
>Cheers,
>
>Ron
>
>-
>Island Net AMT Solutions Group Inc.  Telephone:  250 383-0096
>1412 Quadra  Toll Free:1 800 331-3055
>Victoria, B.C.   Fax:250 383-6698
>V8W 2L1  E-Mail:[EMAIL PROTECTED]
>Canada   WWW:   http://www.islandnet.com/
>-
>


Julio Cuz, Jr.
Riverside Community College
[EMAIL PROTECTED] 


Re: [PHP-DB] SELECT statement

2001-04-04 Thread Ron Brogden

At 03:24 PM 4/4/2001 -0700, Julio Cuz, Jr. wrote:
>Every time I run the following code, I get this error if I use a NUMBER 
>for the 'Email' case:
>"Warning: Unable to jump to row 0 on PostgreSQL result index 2 in 
>/html/rccd/remodel/display2.php on line 35"

The problem is that your query is equivalent to going:

SELECT * FROM "Remodel" WHERE "WO" LIKE 1; // or some other numerical value

The "WO" is a string because it is in quotes so you are saying:

WHERE string = integer

Ain't gonna happen so the result is always empty.  What you want probably 
is (assuming WO is a column name):

$sql = "SELECT * FROM \"Remodel\" WHERE WO=\"".$find."\"";

It is equals since you are using an integer instead of a string (like is 
for strings).

>or, if I use a string (i.e. [EMAIL PROTECTED]), I get this error message:
>"Warning: PostgreSQL query failed: ERROR: Attribute 'jcuz' not found in 
>/html/rccd/remodel/display2.php on line 33"

Same problem.  "EMAIL" means the string "EMAIL" not the column called "EMAIL".

Cheers,

Ron

-
Island Net AMT Solutions Group Inc.  Telephone:  250 383-0096
1412 Quadra  Toll Free:1 800 331-3055
Victoria, B.C.   Fax:250 383-6698
V8W 2L1  E-Mail:[EMAIL PROTECTED]
Canada   WWW:   http://www.islandnet.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-DB] SELECT statement

2001-04-04 Thread Julio Cuz, Jr.

Hi--

Every time I run the following code, I get this error if I use a NUMBER for 
the 'Email' case:
"Warning: Unable to jump to row 0 on PostgreSQL result index 2 in 
/html/rccd/remodel/display2.php on line 35"

or, if I use a string (i.e. [EMAIL PROTECTED]), I get this error message:
"Warning: PostgreSQL query failed: ERROR: Attribute 'jcuz' not found in 
/html/rccd/remodel/display2.php on line 33"

Please help!

switch ($Search) {
case "WO":
 settype ($find,integer);
 $sql = "SELECT * FROM \"Remodel\" WHERE \"WO\" LIKE $find";
 break;

case "Email":
 $sql = "SELECT * FROM \"Remodel\" WHERE \"Email\" LIKE $find";
 break;
 }
--

Julio Cuz, Jr.
Riverside Community College
[EMAIL PROTECTED]