Re: [PHP-DB] SELECT problem between MySQL 3.23 and MySQL 4

2004-07-02 Thread John W. Holmes
Chris Payne wrote:
  I'm using Booleans in my searches (New to it) but it works perfectly 
on my
local 3.23 version of MySQL, but on the main server which uses version 4 of
MySQL I get an error so there's an error in my Syntax.  Here's what I
currently use:
[snip]
LENGTH(REPLACE(LOWER(def),LOWER('as'),''))) 
[snip]
And here's the error I receive on the remote MySQL 4 server:

Warning: Bad arguments to implode() in
/var/www/html/www.planetoxygene.com/htdocs/funcs_mysql_boolean.php on line
45
You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ') -
LENGTH(REPLACE(LOWER(),LOWER('as'),''))) /LENGTH('as'
This is not a MySQL 3 vs. MySQL4 issue. If it was, this is the wrong 
list, anyhow.

Take a look at the line of the query you _say_ you're running that I've 
included above and take a look at the last line of the error that you're 
getting from MySQL.

See the difference? Good... now troubleshoot.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] new row object

2004-07-02 Thread John W. Holmes
Bob Lockie wrote:
I use $row = fetch_row_object, array_push($row) and I want to manually 
insert a row at the end of my array to indicate if there are more rows.

Is there a way to create a row object?
class row
{
  var $morerows = 'Yes';
}
$more = new row;
array_push($more);
about all there is too it, although I'm sure there is a better way to do 
whatever you're doing if you explained it more.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Date problem: data is current as of yesterday

2004-07-02 Thread Karen Resplendo
The database queries all the sources at night after everyone has gone home. That means 
the data was current as of yesterday. This little snippet below returns yesterday's 
date, except that the first day of the month returns 0 for the day. Now, I know why 
this is happening, but I can't find out how to fix it (in VBA or SQL Server I would 
just say, date()-1:
 
$today = getdate(); 
$month = $today['month'] ; 
$mday = $today['mday'] -1; 
$year = $today['year']; 
echo Data is current  as of  b$month $mday, $year/bbr;
 
 


-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

Re: [PHP-DB] Date problem: data is current as of yesterday

2004-07-02 Thread jeffrey_n_Dyke


accidentally replied only to karen.

 The database queries all the sources at night after everyone has gone
home. That means the data was current as of yesterday. This little snippet
below returns yesterday's date, except that the first day of the month
returns 0 for  the day. Now, I know why this is happening, but I can't
find out how to fix it (in VBA or SQL Server I would just  say,
date()-1:

 $today = getdate();
 $month = $today['month'] ;
 $mday = $today['mday'] -1;
 $year = $today['year'];
 echo Data is current  as of  b$month $mday, $year/bbr;

you can do the same thing with php.

I'd use a timestamp and subtract 86400 (24 hours of seconds)

$yesterday_at_this_time = date(Y-m-d H:i:s, time() - 86400);

hth
Jeff
-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

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



[PHP-DB] Multiple MSSQL Connections

2004-07-02 Thread Chris
I am currently writing code to write and read data to a Microsoft SQL 2000
database. At the same time I have sessions being recorded to another SQL
2000 database. Could these two database connections being open at the same
time cause an access violation by php on a windows 2003 server?

Thanks,
Chris

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



[PHP-DB] Query for Most Recent Entry

2004-07-02 Thread Thompson, Jimi
Hi,

 

I'm trying to figure out how to write a MySQL query that will return the
highest primary key a table.  

 

Thanks,

 

Ms. Jimi Thompson, CISSP

Manager, Web Operations

Cox School of Business

Southern Methodist University

 

What kind of peace do we seek? Not a 'Pax Americana' enforced on the
world by American weapons of war. Not the peace of the grave or the
security of a slave. I am talking about genuine peace, the kind of peace
that makes life on earth worth living, the kind that enables men and
nations to grow and to hope and to build a better life for their
children-not merely peace for Americans, but peace for all men and
women; not merely peace in our time, but peace for all time. - John F.
Kennedy

 

 

 



Re: [PHP-DB] Query for Most Recent Entry

2004-07-02 Thread John W. Holmes
Thompson, Jimi wrote:
I'm trying to figure out how to write a MySQL query that will return the
highest primary key a table.  
1) Why?
2) SELECT MAX(id) FROM table
3) If you're trying to find the key of the last row inserted to an 
auto_increment column, use mysql_insert_id() or LAST_INSERT_ID() in PHP 
and MySQL, respectively.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Query for Most Recent Entry

2004-07-02 Thread Chris
Is the primary key field numerical? If so then you can try to use an sql
statement like: SELECT MAX(field) AS max_field FROM table GROUP BY max_field

Chris

Jimi Thompson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,



I'm trying to figure out how to write a MySQL query that will return the
highest primary key a table.



Thanks,



Ms. Jimi Thompson, CISSP

Manager, Web Operations

Cox School of Business

Southern Methodist University



What kind of peace do we seek? Not a 'Pax Americana' enforced on the
world by American weapons of war. Not the peace of the grave or the
security of a slave. I am talking about genuine peace, the kind of peace
that makes life on earth worth living, the kind that enables men and
nations to grow and to hope and to build a better life for their
children-not merely peace for Americans, but peace for all men and
women; not merely peace in our time, but peace for all time. - John F.
Kennedy

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



Re: [PHP-DB] Multiple MSSQL Connections

2004-07-02 Thread Frank M. Kromann
That depends on the SAPI you are using. With CGI or FastCGI there is no
problem but with ISAPI or Apache module you might get problems, as the
DBLIB library used to build the extension is not thread safe.

- Frank


 I am currently writing code to write and read data to a Microsoft SQL
2000
 database. At the same time I have sessions being recorded to another
SQL
 2000 database. Could these two database connections being open at the
same
 time cause an access violation by php on a windows 2003 server?
 
 Thanks,
 Chris
 
 -- 
 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 5.0 Redhat

2004-07-02 Thread Cole S. Ashcraft
You need to compile PHP with MySQL support. There is a php-mysql.rpm 
package, but I'm not sure if it will work with MySQL 5. You might just 
have to recompile PHP (but probably not).

Cole
Iain Wiseman wrote:
Cole S. Ashcraft wrote:
They are at http://dev.mysql.com/downloads/mysql/5.0.html.
Iain Wiseman wrote:
Hi,
Sure this has been asked but I want to use the new mysql 5.0 rather 
than downgrade and I want to use a package installer so I can take 
it off if it does not work.

Are there rpms for Redhat 9.0 to enable PHP to work with MySql 5.0
I am assumming (and maybe incorrectly) that this is my problem for
Fatal error: Call to undefined function: mysql_connect() in 
/var/www/html/guestbook/guest.config.php on line 14

Thanks
Iain

I have dowloaded and installed
MySQL-shared-5.0.0-0
MySQL-server-5.0.0-0
MySQL-client-5.0.0-0
MySQL-devel-5.0.0-0
However I still get the error. I seems pretty common when I put it 
into google. There used to be a package call 
php-mysql-4.2.2-17.i386.rpm that seemed to do the neccesaries for PHP. 
Added a mysql.ini and put a library mysql.so into the php extension 
directory.

What does this for 5.0? And what steps do I need to do to analyze the 
error. Obviously I can connect to my database from the command prompt.

Thanks
Iain

--
This message has been scanned for viruses and
dangerous content by MailScanner on mail.ashcraftfamily.net, and is believed
to be clean.
Please report any deviance from this condition immediately to the AFN
Administrator at [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php