[PHP-DB] Comparing tables

2003-08-25 Thread Ron Allen
I would like to compare 2 tables in a database to determine which records
are different!!!  Any clues out there.  Thanks in advance!

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



[PHP-DB] Comparing 2 tables in the same database

2003-08-25 Thread Ron Allen
I would like to compare 2 tables in the same database so that I can find out
which records are different!

Thanks in advance!

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



[PHP-DB] Query problem

2003-07-22 Thread Ron Allen
I have done this in the past, but for some reason it isn't working now
(maybe a moron).  I am trying to select all of the empty or NULL fields in a
column.

This is what I have
select * from ticket where Type = 'Line' and Closeddate = ' empty space'
and have tried the following
select * from ticket where Type = 'Line' and Closeddate = 'Null'
select * from ticket where Type = 'Line' and Closeddate = 'NULL'

any clues 



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



[PHP-DB] Multiple same values only wanting one

2003-07-15 Thread Ron Allen
How do I select * from a table, but I do not want it to return the same
value if two fields are the same.  Example

test
test
test
test
new
new
new

Results that I want are just

test
new

Any suggestions?



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



[PHP-DB] Accessing MySql using Flash while using PHP as the middleware

2003-06-25 Thread Ron Allen
Does anybody have an idea how-to use Flash and PHP to access a MySql
database. I know how to use PHP and mysql with no problem to pull info, but
with Flash I am struggling.



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



[PHP-DB] Pulling from 2 databases

2002-04-22 Thread Ron Allen

I would like to pull from 2 different databases at the same time so that I
can have the relating information displayed together.
This is what I have so far.any suggestions?

$sqlquery = mysql_query(SELECT * FROM log, logtime WHERE log.ID=logtime.ID
order by log.logtime desc;);
$sqlquery1 = mysql_query(SELECT * FROM logtime, log WHERE logtime.ID=log.ID
order by logtime.logtimein desc;);

while ($query = mysql_fetch_array($sqlquery)) {
 $CCSD = $query[logccsd];
 $logtime = $query[logtime];
 $logid = $query[ID];
print ($CCSDBR$logtimeBR$logidBRBR);

while ($query1 = mysql_fetch_array($sqlquery1)) {
 $logtimein = $query1[logtimein];
 $logccsd = $query1[logccsd];
 $logid1 = $query1[ID];
print ($logccsdBR$logtimeinBR$logid1BRBR);


 // orginal time strings
 $logtimeun = $logtime;
 $logtimeinun = $logtimein;
// print ($logtimeinun br$logtimeunBR);
// convert to unix timestamps
 $logtimeunfo = strtotime($logtimeun);
 $logtimeinunfo = strtotime($logtimeinun);

// perform subtraction to get the difference (in seconds) between times
 $totaltimeseconds = ($logtimeinunfo-$logtimeunfo);

//echo out the difference
// printf (%d seconds BR,$totaltimeseconds);
$totaltimedays = round($totaltimeseconds /60 / 60 /24,0);
$totaltimehours = date('H', mktime(0,0,$totaltimeseconds));
$totaltimeminutes = date(i, mktime(0,0,$totaltimeseconds));
//$totaltimehms= date(H:i, mktime(0,0,$totaltimeseconds));
$totaltime = ($totaltimedays D $totaltimehours H $totaltimeminutes M);

 print ($logccsd was down for $totaltimeBR);

}
}

This is what it displays

TM05
2002-04-22 12:29:08
738

TM06
2002-04-26 12:09:36
718

TM06 was down for 4 D 23 H 40 M
TM05
2002-04-22 19:05:30
738

TM05 was down for 0 D 06 H 36 M
TM06
2002-04-19 12:09:30
718




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




[PHP-DB] appending new entry to old entries

2002-04-18 Thread Ron Allen

I would like to make it so that my helpdesk section can append entries in
their Master Station Log. Update replaces the entryany clues??



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




Re: [PHP-DB] appending new entry to old entries

2002-04-18 Thread Ron Allen

Thanks

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Thursday 18 April 2002 16:51, Ron Allen wrote:
  I would like to make it so that my helpdesk section can append entries
in
  their Master Station Log. Update replaces the entryany clues??

 You would have to get the original value, append the new stuff then do
UPDATE.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *


 /*
 There is very little future in being right when your boss is wrong.
 */



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




[PHP-DB] Re: Local to Global Variables

2002-04-11 Thread Ron Allen

guessing here, but have you tried to use include'filename.txt' in your if
statement?


Eat Pasta Type Fasta [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Not 100% DB related but soon

 I am processing a text file by looking for strings which later depending
 on the findings will be submitted to db

 my problems is that in one if statemant I find a piece of text and need
 another statment to use it later, but it seems that the variable declared
 to the found string remains local.

 Is there a way to set variables from within functions/if statements so
 they become available to all.

 Thnaks in advance

 R



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




[PHP-DB] Re: count

2002-04-11 Thread Ron Allen

I know how to get the results for the total number of records
select count(*) from $table
but how do I put them into a variable for me to use later???

David Robley [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] says...
  I would like to count all the total records from a database.  How would
I go
  about doing that???

 Do a COUNT * on each table and total the results? Although the results
 may actually not mean much depending on your DB structure. Or do you
 really mean count records in a _table_?

 --
 David Robley
 Temporary Kiwi!

 Quod subigo farinam



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




[PHP-DB] Re: count

2002-04-11 Thread Ron Allen

What is the Aliases used for???

 Aliases. SELECT COUNT(*) AS howmany FROM table

 Then use the variable $howmany

 --
 David Robley
 Temporary Kiwi!

 Quod subigo farinam



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




Re: [PHP-DB] Database Sorting by date

2002-04-05 Thread Ron Allen

I figured out the problemit was in my query statement

SELECT * FROM $table where DATE LIKE '$month%' ORDER BY DATE desc

This works perfectly, but in the effort to achieve greatness (won't ever
happen), is this the most efficient way?

Rick Emery [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Ron,

 This would indicate that $table was not set.  Or that the table indicated
in
 $table does not exist.  Print out $query; is it as you expected?
 Enter the SELECT at the mysql command prompt: what is the result?

 -Original Message-
 From: Allen, Ronald L CIV [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 04, 2002 8:41 AM
 To: Rick Emery
 Subject: RE: [PHP-DB] Database Sorting by date


 The query fails when I try to look at a month it says Query Failed

 Ronald L. Allen (MCSE NT, MCP, CCNA)
 SR. LAN/WAN Administrator
 SFOR - Hungary, Croatia
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 +36-82-50 ext. 22580
   DSN: 760-2000


 -Original Message-
 From: Rick Emery [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 04, 2002 16:43
 To: 'Ron Allen'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Database Sorting by date


 Ron,

 What problem are you having?  I'm looking at your code, and it's so clean,
I
 could eat off of it. My only suggestion would be that $month will NEVER ==
 NULL.  If you are testing for NULL, the test is: if ($month == NULL )

 Second, $month will be assigned a value, so it will never be NULL either.

 BTW, what is in drop.inc?

 -Original Message-
 From: Ron Allen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 04, 2002 8:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Database Sorting by date


 Here is the problem I want to be able to view all or search through the
 currency lists in the database by the month. Any help would be great!!!

 Here is the code

 TABLE
 FORM name=currency METHOD=POST ACTION=testtest.php
 TR HEIGHT=20TD COLSPAN=2FONT SIZE=+0 FACE=VERDANA BR TRTD
 ALIGN=LEFT BSelect a CCSD:/BBRselect name=month
 onChange=document.currency.submit()
 option value=NULLSELECT
 option value=NULLVIEW ALL
 option value=2002-03March 2002
 option value=2002-04April 2002
 option value=2002-05May 2002
 option value=2002-06June 2002
 option value=2002-07July 2002
 option value=2002-08August 2002
 option value=2002-09September 2002
 option value=2002-10October 2002
 option value=2002-11November 2002
 option value=2002-12December 2002
 /TD/tr
 /table
 ?


 include '..\drop.php';
 $DBName = currency;
 $table = currency;


 $db = mysql_connect($DBhost,$DBuser,$DBpass) or die(Problem
 connecting);
 mysql_select_db($DBName) or die(Problem selecting database); if
($month
 == NULL){  $query = SELECT * FROM $table;  $result =
mysql_query($query)
 or die (Query failed); //let's get the number of rows in our result so
we
 can use it in a for loop $numofrows = mysql_num_rows($result); } else {
 $query = SELECT * FROM $table where DATE = preg_match(Y-m,'$month'))
ORDER
 BY DATE; $result = mysql_query($query) or die (Query failed); //let's
get
 the number of rows in our result so we can use it in a for loop $numofrows
=
 mysql_num_rows($result); }

 ?

 ?
 echo TABLE BORDER=\1\\n;
 echo TR

bgcolor=\#709fff\TDcenterbDATE/b/center/TDTDcenterbEURO
 /b/center/TDTDcenterbEURO

RECONVERSION/b/center/TDTDcenterbKM/b/center/TDTDcenter
 bKM

RECONVERSION/b/center/TDTDcenterbHUF/b/center/TDTDcente
 rbKUNA/b/center/TD/TR\n;
 for($i = 0; $i  $numofrows; $i++) {
 $row = mysql_fetch_array($result); //get a row from our result set
 if($i % 2) { //this means if there is a remainder
 echo TR bgcolor=\#d3d3d3\\n;
 } else { //if there isn't a remainder we will do the else
 echo TR bgcolor=\#f0f0f0\\n;
 }
 echo

TD.$row['DATE']./TDTD.$row['EURO']./TDTD.$row['EURORECON'].

/TDTD.$row['KM']./TDTD.$row['KMRECON']./TDTD.$row['HUF'].
 /TDTD.$row['KUNA']./TD\n;
 echo /TR\n;
 }
 //now let's close the table and be done with it
 echo /TABLE\n;
 ?




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

2002-04-05 Thread Ron Allen

Does anybody out there know how to get the amount of time that a search took
and then display it on the webpage!!!



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




Re: [PHP-DB] Cosmetics

2002-04-05 Thread Ron Allen

Works like a champ..friggin sweet
Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Friday 05 April 2002 17:57, Ron Allen wrote:
  Does anybody out there know how to get the amount of time that a search
  took and then display it on the webpage!!!


   $TIMER_START = explode( , microtime());
   $TIMER_START = $TIMER_START[1] + $TIMER_START[0];

 ## Do some stuff here:

   $TIMER_END = explode( , microtime());
   $TIMER_END = $TIMER_END[1] + $TIMER_END[0];
   echo br, $TIMER_END - $TIMER_START,  secs;


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 Wouldn't this be a great world if being insecure and desperate were a
turn-on?
 -- Broadcast News
 */



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




[PHP-DB] Database Sorting by date

2002-04-04 Thread Ron Allen

Here is the problem I want to be able to view all or search through the
currency lists in the database by the month.
Any help would be great!!!

Here is the code

TABLE
FORM name=currency METHOD=POST ACTION=testtest.php
TR HEIGHT=20TD COLSPAN=2FONT SIZE=+0 FACE=VERDANA
BR
TRTD ALIGN=LEFT
BSelect a CCSD:/BBRselect name=month
onChange=document.currency.submit()
option value=NULLSELECT
option value=NULLVIEW ALL
option value=2002-03March 2002
option value=2002-04April 2002
option value=2002-05May 2002
option value=2002-06June 2002
option value=2002-07July 2002
option value=2002-08August 2002
option value=2002-09September 2002
option value=2002-10October 2002
option value=2002-11November 2002
option value=2002-12December 2002
/TD/tr
/table
?


include '..\drop.php';
$DBName = currency;
$table = currency;


$db = mysql_connect($DBhost,$DBuser,$DBpass) or die(Problem
connecting);
mysql_select_db($DBName) or die(Problem selecting database);
if ($month == NULL){
 $query = SELECT * FROM $table;
 $result = mysql_query($query) or die (Query failed);
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
} else {
$query = SELECT * FROM $table where DATE = preg_match(Y-m,'$month')) ORDER
BY DATE;
$result = mysql_query($query) or die (Query failed);
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
}

?

?
echo TABLE BORDER=\1\\n;
echo TR
bgcolor=\#709fff\TDcenterbDATE/b/center/TDTDcenterbEURO
/b/center/TDTDcenterbEURO
RECONVERSION/b/center/TDTDcenterbKM/b/center/TDTDcenter
bKM
RECONVERSION/b/center/TDTDcenterbHUF/b/center/TDTDcente
rbKUNA/b/center/TD/TR\n;
for($i = 0; $i  $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) { //this means if there is a remainder
echo TR bgcolor=\#d3d3d3\\n;
} else { //if there isn't a remainder we will do the else
echo TR bgcolor=\#f0f0f0\\n;
}
echo
TD.$row['DATE']./TDTD.$row['EURO']./TDTD.$row['EURORECON'].
/TDTD.$row['KM']./TDTD.$row['KMRECON']./TDTD.$row['HUF'].
/TDTD.$row['KUNA']./TD\n;
echo /TR\n;
}
//now let's close the table and be done with it
echo /TABLE\n;
?




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




[PHP-DB] Re: Date Question

2002-04-04 Thread Ron Allen

Steve is right you can do it that way, but I would put in the area where you
insert the information into the database. Either way is correct. but I find
this way easier and you don't take up any area on your from. (preferences)

mysql_select_db($DBName) or die(Unable to select
database $DBName);
$logtime = date(Y-m-j G:i:s);
$sqlquery = INSERT INTO $table
VALUES('$id','$logtime','$logccsd','$logevent','$logaction','$loginit');

From the PHP site:
  a.. a - am or pm

  b.. A - AM or PM

  c.. B - Swatch Internet time

  d.. d - day of the month, 2 digits with leading zeros; i.e. 01 to 31

  e.. D - day of the week, textual, 3 letters; i.e. Fri

  f.. F - month, textual, long; i.e. January

  g.. g - hour, 12-hour format without leading zeros; i.e. 1 to 12

  h.. G - hour, 24-hour format without leading zeros; i.e. 0 to 23

  i.. h - hour, 12-hour format; i.e. 01 to 12

  j.. H - hour, 24-hour format; i.e. 00 to 23

  k.. i - minutes; i.e. 00 to 59

  l.. I (capital i) - 1 if Daylight Savings Time, 0 otherwise.

  m.. j - day of the month without leading zeros; i.e. 1 to 31

  n.. l (lowercase 'L') - day of the week, textual, long; i.e. Friday

  o.. L - boolean for whether it is a leap year; i.e. 0 or 1

  p.. m - month; i.e. 01 to 12

  q.. M - month, textual, 3 letters; i.e. Jan

  r.. n - month without leading zeros; i.e. 1 to 12

  s.. O - Difference to Greenwich time in hours; i.e. +0200

  t.. r - RFC 822 formatted date; i.e. Thu, 21 Dec 2000 16:01:07 +0200
(added in PHP 4.0.4)

  u.. s - seconds; i.e. 00 to 59

  v.. S - English ordinal suffix for the day of the month, 2 characters;
i.e. th, nd

  w.. t - number of days in the given month; i.e. 28 to 31

  x.. T - Timezone setting of this machine; i.e. MDT

  y.. U - seconds since the epoch

  z.. w - day of the week, numeric, i.e. 0 (Sunday) to 6 (Saturday)

  aa.. W - ISO-8601 week number of year, weeks starting on monday (added in
PHP 4.1.0) (Saturday)

  ab.. Y - year, 4 digits; i.e. 1999

  ac.. y - year, 2 digits; i.e. 99

  ad.. z - day of the year; i.e. 0 to 365

  ae.. Z - timezone offset in seconds (i.e. -43200 to 43200). The offset
for timezones west of UTC is always negative, and for those east of UTC is
always positive.




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




[PHP-DB] Problem with the beginning variable

2002-04-03 Thread Ron Allen

I have a problem with the inital load of my page

When it loads it says that the variable is not defined. When I click on
search after that it works fine.

How do I get PHP to recognize a variable as a certain value without making
it a static value?



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