RE: [PHP-DB] MySql Help needed

2003-03-30 Thread Peter Lovatt
Hi

Try running a grant query

 GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
   ON database_name.*
   TO [EMAIL PROTECTED]
   IDENTIFIED BY 'mypassword';


which will probably fix it

Peter

-Original Message-
From: Sparky Kopetzky [mailto:[EMAIL PROTECTED]
Sent: 30 March 2003 04:12
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySql Help needed


Greetings!

I am building an application in PHP and am creating a global $connect_id for
MySql. I have MySql on a separate machine and am using the connect like
this:

$server = development.myservermachine.net;
$username = myname;
$password = mypassword;
$connect_id = mysql_connect($server, $username, $password);

All I get is 'Access denied for user '[EMAIL PROTECTED]' (Using password:YES)

Now, I know I'm in the DNS server for my system, and the username and
password are correct as I checked the User table.

Any thoughts, ideas, etc. toward fixing this problem??

I'd appreciate any help provided.

Robin Kopetzky
Black Mesa Computer/Internet Services





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



Re: [PHP-DB] multiple connections to MySQL in a single script example

2003-03-30 Thread Doug Thompson
You will use the mysql_select_db() function. It sets the currently active database.  
You will call this function each time you wish to change which database is being used 
prior to issuing a query. 

You need to open only one connection as long as the databases are on the same server.  
If you are using multiple servers, you will require a connection to each with unique 
resource link_identifiers.  Then you will have to include the desired resource link_id 
in each call to mysql_select_db().  There is no need to close and re-open connections 
between each use.

Doug


On Sat, 29 Mar 2003 19:09:28 -0800 (PST), Lonnie Cumberland wrote:

Hello All,

I am new to using PHP with MySQL and was wondering if anyone had a simple
example of how to have multiple active connections to two MySQL databases in a
single script?

I will have to access two different databases but am not sure how to keep the
active connections and make different queries to each one without having to
open one database, make a query, close it, then open the other database and 
make it's query.

This should be possible I think.

Any help would be greatly appreciated,
Lonnie Cumberland


__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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

2003-03-30 Thread Charles Kline
hi all,

i was just wondering if there are any naming conventions when creating 
database connections. most of my books use

$sql = SQL STRING;

and

$sth = $db-query() or $result = $db-query()

I have no idea what sth stands for in this case, but was curious how 
others name stuff.

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


Re: [PHP-DB] naming conventions

2003-03-30 Thread Paul Burney
on 3/30/03 9:52 AM, Charles Kline at [EMAIL PROTECTED] appended the
following bits to my mbox:

 i was just wondering if there are any naming conventions when creating
 database connections. most of my books use
 
 $sql = SQL STRING;
 
 and
 
 $sth = $db-query() or $result = $db-query()
 
 I have no idea what sth stands for in this case, but was curious how
 others name stuff.

I usually just use $query or $q for query, $res or $r for result, $row
or $s for the returned array, and $dbh for the database connection.  I got
the latter from the standard Perl database connection, dbh - Data Base
Handle.

If I recall correctly, the $sth also comes from the standard perl examples.
The standard PHP example, from http://www.php.net/manual/en/ref.mysql.php ,
uses $link for the connection, $query for the query, and $line for the
returned record array.

A lot of database classes use $db as the new object.

Hope that helps.

Sincerely,

Paul Burney
http://paulburney.com/

?php
while ($self != asleep) {
$sheep_count++;
}
?



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



Re: [PHP-DB] naming conventions

2003-03-30 Thread Roberto Plomp
In essence it doesn't matter so much which convention you use as long you
use a convention, use it consistently and the convention itself doesn't come
with too much complexity of it's own and is based on a clear philosophy.

The naming convention I use in any environment or language uses simple
prefixes and is based on two points:
1. the name should show the origin of the variable/function/table/query and
what
more;
2. it should show the functional context / meaning

In other words:
1. Where can I find it;
2. What does it mean.

Of course, the naming convention must be combined with structure
conventions.

Just thinking along ...
Roberto


- Original Message -
From: Paul Burney [EMAIL PROTECTED]
To: Charles Kline [EMAIL PROTECTED]; PHP Database List
[EMAIL PROTECTED]
Sent: Sunday, March 30, 2003 5:19 PM
Subject: Re: [PHP-DB] naming conventions


 on 3/30/03 9:52 AM, Charles Kline at [EMAIL PROTECTED] appended the
 following bits to my mbox:

  i was just wondering if there are any naming conventions when creating
  database connections. most of my books use
 
  $sql = SQL STRING;
 
  and
 
  $sth = $db-query() or $result = $db-query()
 
  I have no idea what sth stands for in this case, but was curious how
  others name stuff.

 I usually just use $query or $q for query, $res or $r for result, $row
 or $s for the returned array, and $dbh for the database connection.  I got
 the latter from the standard Perl database connection, dbh - Data Base
 Handle.

 If I recall correctly, the $sth also comes from the standard perl
examples.
 The standard PHP example, from http://www.php.net/manual/en/ref.mysql.php
,
 uses $link for the connection, $query for the query, and $line for the
 returned record array.

 A lot of database classes use $db as the new object.

 Hope that helps.

 Sincerely,

 Paul Burney
 http://paulburney.com/

 ?php
 while ($self != asleep) {
 $sheep_count++;
 }
 ?



 --
 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, PHP, and Dates

2003-03-30 Thread Jason Wong
On Sunday 30 March 2003 11:11, Bruce Feist wrote:

 I wonder why the PHP/MySql interface doesn't simply return dates as
 dates instead of strings.  *frowns*

How do you mean? PHP doesn't have a date type.

-- 
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
--
/*
Blutarsky's Axiom:
Nothing is impossible for the man who will not listen to reason.
*/


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



[PHP-DB] Resize pictures and store with MySQL

2003-03-30 Thread Frank McIsaac
Hi.  I want to use PHP and MySQL to help make it easier to put
pictures on a website.  What I want to do is make a page that allows the
client to submit a picture (or a bunch of pictures) and a caption for
each picture to me via a form of some sort.  Then, once the file gets
here, I would like it to resize the photo to a preset size and store it
with it's caption.  Is this possible?  If so, is there also a way to get
php to dynamically design a web page with each of these photos (complete
with their captions) on it?  I am using PHP 4.2 and MySql 3.23.  Thanks
in advance for any help.

Frank



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



[PHP-DB] Catch Errors

2003-03-30 Thread shaun
Hi,

Is it possible to catch the type of error message returned form a
mysql_query(); funtion

for example

if ($error == //duplicate row for table)
{
echo This row already exists in the table;
}



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



Re: [PHP-DB] Catch Errors

2003-03-30 Thread Leif K-Brooks
www.php.net/mysql-error

shaun wrote:

Hi,

Is it possible to catch the type of error message returned form a
mysql_query(); funtion
for example

if ($error == //duplicate row for table)
{
   echo This row already exists in the table;
}


 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Resize pictures and store with MySQL

2003-03-30 Thread Mike Brum
Just to illustrate how you'd go about doing this:

- User uploads image  description
- You resize image with GD functions (look at imagecopyresized())
- Store URL and description to the mySQL table you made

It's a very simple thing to do once you organize your file structure where
you're going to be storing the images. To retrieve them, you just need to
know the image's ID and query based upon that. From there, you can access
the image's URL or caption as you need.

You can very easily create a script to display the images by querying the DB
for X entries and displaying them per page.

What you're basically describing is the functionality that MANY blogs have.
You can probably find some free scripts online with a minimum amount of
searching.

-Mike

-Original Message-
From: Frank McIsaac [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 30, 2003 12:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Resize pictures and store with MySQL


Hi.  I want to use PHP and MySQL to help make it easier to put
pictures on a website.  What I want to do is make a page that allows the
client to submit a picture (or a bunch of pictures) and a caption for
each picture to me via a form of some sort.  Then, once the file gets
here, I would like it to resize the photo to a preset size and store it
with it's caption.  Is this possible?  If so, is there also a way to get
php to dynamically design a web page with each of these photos (complete
with their captions) on it?  I am using PHP 4.2 and MySql 3.23.  Thanks
in advance for any help.

Frank



--
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] Create table example

2003-03-30 Thread Sparky Kopetzky
Good afternoon!!

I have several (50+) tables I have to create in MySql. Is there a good PHP example on 
creating a table via PHP?? I will probably do all of the initial INSERTS that way, too.

Thanks!!

Robin Kopetzky
Black Mesa Computer/Internet Services
www.blackmesa-isp.net




RE: [PHP-DB] Create table example

2003-03-30 Thread John W. Holmes
 I have several (50+) tables I have to create in MySql. Is there a good
PHP
 example on creating a table via PHP?? I will probably do all of the
 initial INSERTS that way, too.

You don't create a table via PHP, you simply pass a query through the
mysql_query() function. If that query is a CREATE TABLE, then a table
will be created. It can also be a INSERT, SELECT, SHOW, UPDATE, etc...
All you're doing is passing a string through mysql_query() that MySQL is
going to attempt to run as a query.

So, for you, you'd need to use:

Mysql_query(CREATE TABLE ... );
Mysql_query(INSERT INTO ... VALUES ... );

Fill in the blanks... Now, if you have all of these queries in a file,
there may be an easier way to automate all of this, but you'll be doing
the same thing, essentially. You can only pass one query at a time with
mysql_query(). 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



[PHP-DB] Starting to hate MySql... thinking about using MS Sql Server instead...... :-(((((((((

2003-03-30 Thread Sparky Kopetzky
ARGGHHH!!!

Trying to use INFILE to load a small (125) entry block of data and all MqSql does is 
puke:

ERROR 1148: The used command is not allowed with this MySql version. (3.23.55)

If this command is no good, then what the hell am I supposed to use

At least with MS, you have a nice, GUI to use...

Robin Kopetzky
Black Mesa Computers/ISP


RE: [PHP-DB] Starting to hate MySql... thinking about using MS Sql Server instead...... :-(((((((((

2003-03-30 Thread Neil Lathwood
 At least with MS, you have a nice, GUI to use...

http://www.phpmyadmin.net/

Neil

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



RE: [PHP-DB] Starting to hate MySql... thinking about using MS Sql Server instead...... :-(((((((((

2003-03-30 Thread Joe Keenan
Hi; You could try mysqlimport with the following syntax:
mysqlimport -h localhost -u username -p -L dbname pathtofile
where' file' is tab delimited text held on local machine.
All the best,
Joe
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MySql, PHP, and Dates

2003-03-30 Thread Bruce Feist
Jason Wong wrote:
On Sunday 30 March 2003 11:11, Bruce Feist wrote:

I wonder why the PHP/MySql interface doesn't simply return dates as
dates instead of strings.  *frowns*
How do you mean? PHP doesn't have a date type.

Ummm That's a good reason!  As I said, I'm a newbie to PHP, and 
somewhere along the line I got the idea that there was an actual date 
data type.  I don't know where I got that idea; the book I've been using 
certainly doesn't say that it does, although I thought I did.

It's times like this that I wish that I had smaller feet or a larger 
mouth, to make it easier to remove the one from the other!

Thanks.

Bruce Feist

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


[PHP-DB] How to restrict maximum persistent connections for Oracle?

2003-03-30 Thread Jerry Tseng
Hi everybody,

In php.ini, I can set the maximum persistent connections for MySql or ODBC.
But I use Oracle 9i in my project. Who can tell me how to restrict maximum
persistent
connection for Oracle?

Thanks.

--Jerry



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



[PHP-DB] PHP and MySQL 4

2003-03-30 Thread Benjamin Higgins
Does PHP have support for MySQL 4?  If I install MySQL 4, and rebuild PHP
with --with-mysql, is that sufficient to get MySQL 4 support?

Ben



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



Re: [PHP-DB] PHP and MySQL 4

2003-03-30 Thread Jason Wong
On Monday 31 March 2003 04:46, Benjamin Higgins wrote:
 Does PHP have support for MySQL 4?  If I install MySQL 4, and rebuild PHP
 with --with-mysql, is that sufficient to get MySQL 4 support?

Yes.

-- 
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
--
/*
I often quote myself; it adds spice to my conversation.
-- G. B. Shaw
*/


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



RE: [PHP-DB] PHP and MySQL 4

2003-03-30 Thread Luke Woollard
Sure does - sure is.


-Original Message-
From: Benjamin Higgins [mailto:[EMAIL PROTECTED]
Sent: Monday, 31 March 2003 6:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP and MySQL 4


Does PHP have support for MySQL 4?  If I install MySQL 4, and rebuild PHP
with --with-mysql, is that sufficient to get MySQL 4 support?

Ben



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