Re: [PHP-DB] I can't seem to get Max() to work

2004-10-28 Thread Robby Russell
On Thu, 2004-10-28 at 01:05 -0400, Chris Payne wrote:
 Hi there everyone,
 
  
 
 I cant seem to get the below to work with PHP and MySQL:
 
  
 
 $sql = SELECT MAX(FoodItemNumber) FROM menuitemsubs;
 
  
 
 What am I doing wrong?  I need the highest number from the column
 FoodItemNumber, but it doesnt return anything unless I change the MAX() to
 a * and I dont want that I need it to be the MAX() number as it isnt an
 auto-increment field.


Is this an integer field?

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
* --- Now supporting PHP5 and PHP4 ---
/


signature.asc
Description: This is a digitally signed message part


RE: [PHP-DB] Re: I can't seem to get Max() to work

2004-10-28 Thread balwantsingh
can anybody advise if there is any command so that MAX can be found in the
data entered the columns.

i mean to say suppose i have three columns
col1 col2 col3 in a table
now the MAX value to find from col1, col2, col3.


with best wishes
balwant



-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 28, 2004 10:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: I can't seem to get Max() to work


On Thu, 28 Oct 2004 14:35, Chris Payne wrote:

 Hi there everyone,



 I can?t seem to get the below to work with PHP and MySQL:



 $sql = SELECT MAX(FoodItemNumber) FROM menuitemsubs;



 What am I doing wrong?  I need the highest number from the column
 FoodItemNumber, but it doesn?t return anything unless I change the MAX()
 to a * and I don?t want that I need it to be the MAX() number as it isn?t
 an auto-increment field.

Works a treat for me; au_linkid is a smallint which is not autoincrement, nd
not indexed at all.

mysql select max(au_linkid) from categ_link;
++
| max(au_linkid) |
++
|540 |
++
1 row in set (0.03 sec)

FoodItemNumber is an integer type?

--
David Robley

I Have To Stop Now, My Fingers Are Getting Hoarse!

--
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] Re:Subject: Finding the highest number in a column?

2004-10-28 Thread Neil Smith [MVP, Digital media]
Surely some monday morning light headedness Chris !
SELECT MAX(column_name) AS max_number FROM table
Make sure the column's indexed if you do it often !
Cheers - Neil
At 03:32 28/10/2004 +, you wrote:
Message-Id: [EMAIL PROTECTED]
From: Chris Payne [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Wed, 27 Oct 2004 23:33:02 -0400
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary==_NextPart_000__01C4BC7D.4D8C22E0
Subject: Finding the highest number in a column?
Hi there everyone,

I am working with a very complex system where not all numbers are assigned
1, 2, 3 …… etc …… so there could be a row with the number 1 and then the
next row could be 40 and so on ……

Is there a way with PHP and MySQL to find out what the highest number is in
a particular column easily when the numbers are auto-incremented so aren’t
necessarily one after the other?

I would really appreciate any help on this as it’s really bugging me.

Chris
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.783 / Virus Database: 529 - Release Date: 10/25/2004


CaptionKit http://www.captionkit.com : Production tools
for accessible subtitled internet media, transcripts
and searchable video. Supports Real Player, Quicktime
and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every
day at http://www.fresh-toast.net : NetMeeting solutions
for a connected world.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] I can't seem to get Max() to work

2004-10-28 Thread Bastien Koert
is it an iteger type datafield?
bastien

From: Chris Payne [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] I can't seem to get Max() to work
Date: Thu, 28 Oct 2004 01:05:46 -0400
Hi there everyone,

I can’t seem to get the below to work with PHP and MySQL:

$sql = SELECT MAX(FoodItemNumber) FROM menuitemsubs;

What am I doing wrong?  I need the highest number from the column
FoodItemNumber, but it doesn’t return anything unless I change the MAX() to
a * and I don’t want that I need it to be the MAX() number as it isn’t an
auto-increment field.

Chris
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.783 / Virus Database: 529 - Release Date: 10/25/2004
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


AW: [PHP-DB] I can't seem to get Max() to work

2004-10-28 Thread Lars Hilsebein
How about the following statement (Not the best way, but it could solve your
problem):

$sql = SELECT FoodItemNumber FROM menuitemsubs ORDER BY FoodItemNumber DESC
LIMIT 1



-Ursprüngliche Nachricht-
Von: Bastien Koert [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 28. Oktober 2004 15:00
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: RE: [PHP-DB] I can't seem to get Max() to work

is it an iteger type datafield?

bastien


From: Chris Payne [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] I can't seem to get Max() to work
Date: Thu, 28 Oct 2004 01:05:46 -0400

Hi there everyone,



I can't seem to get the below to work with PHP and MySQL:



$sql = SELECT MAX(FoodItemNumber) FROM menuitemsubs;



What am I doing wrong?  I need the highest number from the column
FoodItemNumber, but it doesn't return anything unless I change the MAX() to
a * and I don't want that I need it to be the MAX() number as it isn't an
auto-increment field.



Chris


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.783 / Virus Database: 529 - Release Date: 10/25/2004


-- 
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] slow connection 2 DB2 database on as400.

2004-10-28 Thread Ian . McGhee
Hi I have been trying to connect to a DB2 database on an IBM AS400 system. I
manage to get connected using ODBC however it is slow at connecting and
every time the page is refreshed it seems to have to connect again. Any help
would be appreciated.

I use the below code to connect.
In a file called AS400dbconnect.inc

?


$host = LAWSON01;
$username = MYUSERNAME;
$password = MYPASSWORD;


$link= odbc_connect($host, $username, $password,SQL_CUR_USE_ODBC)


or die (odbc_errormsg() );

?

Then in a file called as400.inc
The following cote is in it 


?PHP


include('includes/as400dbconnect.inc');




if ($link)
{
  echo odbc connectedbr;
  $sql =  select * from exrcvbuf; 
  
  //this function will execute the sql satametn in  
  //correspondance to the table in the db
   $exc=odbc_exec($link,$sql)
or (odbc_errormsg());
  
}
else
  echo odbc not connectedbr;
 
if($exc)
{

$Fields = odbc_num_fields($exc); 

print table border='1' width='100%'tr; 

// Build Column Headers 

 for ($i=1; $i = $Fields; $i++)
{ 
printf(th bgcolor='silver'%s/th, odbc_field_name(
$exc,$i)); 
}

// Table Body 

$Outer=0; 
while( odbc_fetch_row( $exc ))
{ 
$Outer++; 
print tr; 
   
for($i=1; $i = $Fields; $i++)
{ 
printf(td%s/td, odbc_result( $exc, $i
)); 
} 
 
print /tr; 
} 

print /table; 
print b Your request returned $Outer rows!/b; 



}

else
  echo selection failedbr;
?




It is running in and apache server with php set up using the .dll method.
Ian McGhee
Junior Analyst Programmer
Richard Lawson Autologistics Group
Telephone: 01382 560259
Email: [EMAIL PROTECTED]

J B Cartwright, G D Frost and R J Hunt have been appointed as joint
administrators of Richard Lawson Autologistics Limited, on 14th September
2004, to manage its affairs, business and property. As such they contract
without personal liability. Both J B Cartwright and G D Frost are
licensed to act as Insolvency Practitioners by the Institute of Chartered
Accountants of Scotland and R J Hunt is licensed to act as an Insolvency
Practitioner by the Institute of Chartered Accountants in England and Wales.


=

If you are not the intended recipient of this message, you should not
review, print, re-transmit, store or take any actions based on the content
of this e-mail or any attachments. Please contact the sender by e-mail and
delete the material from any computer.

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



[PHP-DB] returning inserted ids using load data local infile

2004-10-28 Thread blackwater dev
Is there anyway to get an array of the inserted id's generated when I
load data into mysql using an external data file???

Thanks!

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



RE: [PHP-DB] returning inserted ids using load data local infile

2004-10-28 Thread Bastien Koert
For bulk loads, its proably best to query the db for the max id number 
before the load starts and then do the same after...

last_insert_id only returns the last inserted id
Bastien

From: blackwater dev [EMAIL PROTECTED]
Reply-To: blackwater dev [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] returning inserted ids using load data local infile
Date: Thu, 28 Oct 2004 09:27:21 -0400
Is there anyway to get an array of the inserted id's generated when I
load data into mysql using an external data file???
Thanks!
--
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] Time Field

2004-10-28 Thread NIPP, SCOTT V \(SBCSI\)
Why would you not simply use a 'datetime' field type?  This gets
you exactly what you are looking for unless I am misreading what you are
doing here...

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-Original Message-
From: Bomgardner, Mark A [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 28, 2004 10:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Time Field


When creating a time field in MySQL, its purpose is for elapsed time,
not time of day.  Is it better to use this field or to combine it with
the date field when looking at inserting the start date and time of an
event? 

 

Mark A. Bomgardner 
Technology Specialist 
KLETC 

 

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



RE: [PHP-DB] Time Field

2004-10-28 Thread Bastien Koert
Best to use int field type and store the difference between the unix 
timestamp start time and the unix timestamp end time (both seconds since the 
epoch) which would be the number of seconds it took to complete the task. 
This number can then be manipulated with math to provide elapsed times in 
hours/minutes//seconds...

hth
Bastien

From: Bomgardner, Mark A [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Time Field
Date: Thu, 28 Oct 2004 10:10:19 -0500
When creating a time field in MySQL, its purpose is for elapsed time,
not time of day.  Is it better to use this field or to combine it with
the date field when looking at inserting the start date and time of an
event?

Mark A. Bomgardner
Technology Specialist
KLETC

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


[PHP-DB] error:attempt to write a readonly database

2004-10-28 Thread Aravalli Sai
hi
i am getting the following error when i try to run my
php program..i want to know wht is this error in
general

Warning: sqlite_query(): attempt to write a readonly
database in /home/saravall/.HTML/inv.php on line 26
error:attempt to write a readonly database

thanks
sai




__
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

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



RE: [PHP-DB] error:attempt to write a readonly database

2004-10-28 Thread Graham Cossey
[snip]
 hi
 i am getting the following error when i try to run my
 php program..i want to know wht is this error in
 general

 Warning: sqlite_query(): attempt to write a readonly
 database in /home/saravall/.HTML/inv.php on line 26
 error:attempt to write a readonly database

[snip]

Looks like you are connecting to the database with a userid that has only
read authority.

I don't use sqlite so can't help with the specifics, but I would check that
first.

HTH
Graham

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



[PHP-DB] PHP does not show errors

2004-10-28 Thread Andre Matos
Hi List,

I have developed some classes to access MySQL. When I was testing the
classes, I always got a blank page. I found some errors and fix them.
However, I realized that my PHP was not showing me the errors that occur
inside the classes. I have checked on php.ini and I have this setup:

error_reporting = E_ALL
display_errors = On

Does someone know what is happening?

Thanks for any help.

Andre

--
Andre Matos
[EMAIL PROTECTED] 

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



RE: [PHP-DB] PHP does not show errors

2004-10-28 Thread Bastien Koert
post code, what are we, mindreaders?
bastien

From: Andre Matos [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP does not show errors
Date: Thu, 28 Oct 2004 17:48:56 -0400
Hi List,
I have developed some classes to access MySQL. When I was testing the
classes, I always got a blank page. I found some errors and fix them.
However, I realized that my PHP was not showing me the errors that occur
inside the classes. I have checked on php.ini and I have this setup:
error_reporting = E_ALL
display_errors = On
Does someone know what is happening?
Thanks for any help.
Andre
--
Andre Matos
[EMAIL PROTECTED]
--
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] MySQL backup software

2004-10-28 Thread Leo G. Divinagracia III

Perry, Matthew (Fire Marshal's Office) wrote:
Does anyone know a free MySQL backup program to schedule regular backups?

mysql has the ADMINISTRATOR, well at least for win32...
does timed backups.
--
Leo G. Divinagracia III
[EMAIL PROTECTED]
z
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] using php to insert xml into database

2004-10-28 Thread mishin coleman
any ideas how to do this?
 
i can get the php to print out all the details of the xml but not sure how to input 
that data into a database. - maybe using some sort of array?
its an annoying postgresql database that i need to insert it into but any ideas on how 
to insert into any database would be helpful.
thanks  
 
 
// this function prints out a list of properties found in the xml file
function print_houses()
{
global $obj;
echo 'table width=' . $this-TableWidth . ' border=' . $this-TableBorder 
. ' cellpadding=' . $this-TableCellpadding . ' cellspacing=' . 
$this-TableCellspacing . ' class=' . $this-TableClass . '';
while (list($key, $val) = each($obj-xml-XMLDATA-PROPERTIES-PROPERTY)) {
echo tr\n;
echo td class= . $this-TableRow1Class . \n;
echo a href=\./property.php?id= . $val-attr['PROPERTYID'] . \ 
class=\ . $this-TableTxtProperties . \ . $val-SUBURB-data . , $ . 
$val-RENT-data . /a\n;
echo /td;
echo /tr\n;
} // while
echo '/table';
reset($obj-xml-XMLDATA-PROPERTIES-PROPERTY);
} 

 


-
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.

[PHP-DB] using php to insert xml data into database (text)

2004-10-28 Thread mishin coleman
sorry may have sent the html version last time

any ideas how to do this?
 
i can get the php to print out all the details of the
xml but not sure how to input that data into a
database. - maybe using some sort of array?
its an annoying postgresql database that i need to
insert it into but any ideas on how to insert into any
database would be helpful.
thanks  
 
 
// this function prints out a list of properties found
in the xml file
function print_houses()
{
global $obj;
echo 'table width=' . $this-TableWidth . '
border=' . $this-TableBorder . ' cellpadding=' .
$this-TableCellpadding . ' cellspacing=' .
$this-TableCellspacing . ' class=' .
$this-TableClass . '';
while (list($key, $val) =
each($obj-xml-XMLDATA-PROPERTIES-PROPERTY)) {
echo tr\n;
echo td class= . $this-TableRow1Class
. \n;
echo a href=\./property.php?id= .
$val-attr['PROPERTYID'] . \ class=\ .
$this-TableTxtProperties . \ . $val-SUBURB-data
. , $ . $val-RENT-data . /a\n;
echo /td;
echo /tr\n;
} // while
echo '/table';
   
reset($obj-xml-XMLDATA-PROPERTIES-PROPERTY);
} 

 




__
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 
http://messenger.yahoo.com

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