Re: [PHP-DB] mysql, php error

2005-03-07 Thread Martin Norland
James wrote:
I'm pretty new to this...I've set this book example up on my PC and it's 
fine.
I've attempted this on two Macs...

Here's the error I get when I try to run the application.  What does the 
error mean?

UNHANDLED ERROR on line 84 in 
/Library/WebServer/Documents/wda2-winestore/index.php.
[PHP Error 20050307145950]Error: Non-static method DB::connect() should 
not be called statically (error #2048).
[snip]
You're calling a classes method statically when it cannot be called as 
such - the function makes references to $this, or has otherwise been 
shown to be non-static.

You need to create an instance of the object, then call the method 
through it.

E.G. instead of:
DB::connect('some','variables');
you have to use:
$mydb = new DB;
$mydb-connect('some','variables');
Without the exact code, I can only give you examples of about how it 
should look - but that's the gist of it.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


[PHP-DB] MySQL Result

2005-03-06 Thread Wendell Frohwein
Hello all,
 
Have a question for you, don't know how simple this is. I want the
output that mysql sends to arranged a certain way and I don't know if it
is possible.
 
Here is the select statement:
 
SELECT cart_search.id, cart_search.year, cart_makes.thename as makename,
cart_models.thename as modelname, cart_versions.thename as versionname
FROM cart_search, cart_makes, cart_models, cart_versions WHERE
cart_search.rand='PYYKjQFXRBa3PkYMpsnY' AND
cart_makes.id=cart_search.make AND cart_models.id=cart_search.model AND
cart_versions.id=cart_search.version ORDER BY cart_makes.thename,
cart_models.thename, cart_search.year;
 
cart_search.rand='PYYKjQFXRBa3PkYMpsnY' is what I use to call up a group
to a specified product.
 
Here is the output from above:
 
++--+--+---+-+
| id | year | makename | modelname | versionname |
++--+--+---+-+
|  9 | 1992 | Acura| Integra   | RS  |
| 10 | 1993 | Acura| Integra   | RS  |
|  1 | 1994 | Acura| Integra   | GSR |
|  2 | 1995 | Acura| Integra   | GSR |
|  3 | 1996 | Acura| Integra   | GSR |
|  4 | 1997 | Acura| Integra   | GSR |
|  5 | 1998 | Acura| Integra   | GSR |
|  6 | 1999 | Acura| Integra   | GSR |
|  7 | 2000 | Acura| Integra   | GSR |
|  8 | 2001 | Acura| Integra   | GSR |
++--+--+---+-+
 
 
I wanted to know if it would be possible for it to output it like so:
 
+--+---+-+--+
| makename | modelname | versionname |years |
+--+---+-+--+
| Acura| Integra   | RS  | 92,93|
| Acura| Integra   | GSR | 94,95,96,97,98,99,01 |
+--+---+-+--+
 
 
Thank you all once again for your help.
 
 
-Wendell Frohwein
 


Re: [PHP-DB] MySQL Result

2005-03-06 Thread Micah Stevens

Just reorder your list of selected fields. 

SELECT fieldnames in order to be returned from tablename WHERE 
requirements

-Micah 


On Sunday 06 March 2005 01:10 pm, Wendell Frohwein wrote:
 Hello all,

 Have a question for you, don't know how simple this is. I want the
 output that mysql sends to arranged a certain way and I don't know if it
 is possible.

 Here is the select statement:

 SELECT cart_search.id, cart_search.year, cart_makes.thename as makename,
 cart_models.thename as modelname, cart_versions.thename as versionname
 FROM cart_search, cart_makes, cart_models, cart_versions WHERE
 cart_search.rand='PYYKjQFXRBa3PkYMpsnY' AND
 cart_makes.id=cart_search.make AND cart_models.id=cart_search.model AND
 cart_versions.id=cart_search.version ORDER BY cart_makes.thename,
 cart_models.thename, cart_search.year;

 cart_search.rand='PYYKjQFXRBa3PkYMpsnY' is what I use to call up a group
 to a specified product.

 Here is the output from above:

 ++--+--+---+-+

 | id | year | makename | modelname | versionname |

 ++--+--+---+-+

 |  9 | 1992 | Acura| Integra   | RS  |
 | 10 | 1993 | Acura| Integra   | RS  |
 |  1 | 1994 | Acura| Integra   | GSR |
 |  2 | 1995 | Acura| Integra   | GSR |
 |  3 | 1996 | Acura| Integra   | GSR |
 |  4 | 1997 | Acura| Integra   | GSR |
 |  5 | 1998 | Acura| Integra   | GSR |
 |  6 | 1999 | Acura| Integra   | GSR |
 |  7 | 2000 | Acura| Integra   | GSR |
 |  8 | 2001 | Acura| Integra   | GSR |

 ++--+--+---+-+


 I wanted to know if it would be possible for it to output it like so:

 +--+---+-+--+

 | makename | modelname | versionname |years |

 +--+---+-+--+

 | Acura| Integra   | RS  | 92,93|
 | Acura| Integra   | GSR | 94,95,96,97,98,99,01 |

 +--+---+-+--+


 Thank you all once again for your help.


 -Wendell Frohwein

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



Re: [PHP-DB] MySQL Result

2005-03-06 Thread Micah Stevens
As a kind soul pointed out, I missed the string joining you need to do, so I 
feel tasked with addressing this further.. 

Simple answer: I don't see a way to do this with a single query unless you're 
using a DB with subqueries.. in which case you might be able to figure 
something out, but without a server to try this on, I can't say for sure. 

You could however break it down into two queries and use PHP to patch the data 
together:

query1: get the make/model
query2: get the years

That type of thing.. Hope that helps.
-Micah 


On Sunday 06 March 2005 06:18 pm, Micah Stevens wrote:
 Just reorder your list of selected fields.

 SELECT fieldnames in order to be returned from tablename WHERE
 requirements

 -Micah

 On Sunday 06 March 2005 01:10 pm, Wendell Frohwein wrote:
  Hello all,
 
  Have a question for you, don't know how simple this is. I want the
  output that mysql sends to arranged a certain way and I don't know if it
  is possible.
 
  Here is the select statement:
 
  SELECT cart_search.id, cart_search.year, cart_makes.thename as makename,
  cart_models.thename as modelname, cart_versions.thename as versionname
  FROM cart_search, cart_makes, cart_models, cart_versions WHERE
  cart_search.rand='PYYKjQFXRBa3PkYMpsnY' AND
  cart_makes.id=cart_search.make AND cart_models.id=cart_search.model AND
  cart_versions.id=cart_search.version ORDER BY cart_makes.thename,
  cart_models.thename, cart_search.year;
 
  cart_search.rand='PYYKjQFXRBa3PkYMpsnY' is what I use to call up a group
  to a specified product.
 
  Here is the output from above:
 
  ++--+--+---+-+
 
  | id | year | makename | modelname | versionname |
 
  ++--+--+---+-+
 
  |  9 | 1992 | Acura| Integra   | RS  |
  | 10 | 1993 | Acura| Integra   | RS  |
  |  1 | 1994 | Acura| Integra   | GSR |
  |  2 | 1995 | Acura| Integra   | GSR |
  |  3 | 1996 | Acura| Integra   | GSR |
  |  4 | 1997 | Acura| Integra   | GSR |
  |  5 | 1998 | Acura| Integra   | GSR |
  |  6 | 1999 | Acura| Integra   | GSR |
  |  7 | 2000 | Acura| Integra   | GSR |
  |  8 | 2001 | Acura| Integra   | GSR |
 
  ++--+--+---+-+
 
 
  I wanted to know if it would be possible for it to output it like so:
 
  +--+---+-+--+
 
  | makename | modelname | versionname |years |
 
  +--+---+-+--+
 
  | Acura| Integra   | RS  | 92,93|
  | Acura| Integra   | GSR | 94,95,96,97,98,99,01 |
 
  +--+---+-+--+
 
 
  Thank you all once again for your help.
 
 
  -Wendell Frohwein

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



Re: [PHP-DB] MYSQL row position.. is it possible (urgent)

2005-03-06 Thread Tatang Widyanto
how about :
SELECT (count( b.unique_id ) + 1) ranking
FROM table_name a, table_name b
WHERE a.unique_id = '4' AND b.score  a.score
Mike wrote:
Let's say I have a database and I want to find the position of a row when it is 
ordered by a specific column
before a sort:
UNIQUE ID   | SCORE
1   | 100
2   | 50
3   | 30
4   | 80
5   | 50
after sort:
UNIQUE ID   | SCORE
1   | 100
4   | 80
2   | 50
5   | 50
3   | 30
is it posible to find the position of 4 with a query or mysql function?
Normally I'd just 'SELECT unique_id FROM table ORDER DESC' then loop through 
the results looking for a matching id, however my table contains thousands of 
entries, and it's simply not possible do do it that way.
Thanks
Mike

--
Tatang Widyanto
Unit Pengkajian dan Penerapan Teknologi Informasi
Universitas Brawijaya
http://www.brawijaya.ac.id
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MYSQL row position.. is it possible (urgent)

2005-03-04 Thread Mike
Let's say I have a database and I want to find the position of a row when it is 
ordered by a specific column

before a sort:

UNIQUE ID   | SCORE
1   | 100
2   | 50
3   | 30
4   | 80
5   | 50

after sort:

UNIQUE ID   | SCORE
1   | 100
4   | 80
2   | 50
5   | 50
3   | 30

is it posible to find the position of 4 with a query or mysql function?

Normally I'd just 'SELECT unique_id FROM table ORDER DESC' then loop through 
the results looking for a matching id, however my table contains thousands of 
entries, and it's simply not possible do do it that way.

Thanks
Mike


[PHP-DB] MySQL: Top $num results

2005-02-13 Thread ioannes
If you use LIMIT row_count with ORDER BY, MySQL ends the sorting as soon as 
it has found the first row_count lines rather than sorting the whole table. 


http://dev.mysql.com/doc/mysql/en/limit-optimization.html
I need to get the top $num results from a completely sorted table (eg sorted 
on ID, ie the $num latest inserted rows).  Which functions should I be 
considering?

John 

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


Re: [PHP-DB] MySQL: Top $num results

2005-02-13 Thread John Holmes
ioannes wrote:
If you use LIMIT row_count with ORDER BY, MySQL ends the sorting as 
soon as it has found the first row_count lines rather than sorting the 
whole table. 

http://dev.mysql.com/doc/mysql/en/limit-optimization.html
I need to get the top $num results from a completely sorted table (eg 
sorted on ID, ie the $num latest inserted rows).  Which functions should 
I be considering?
LIMIT works that way, the write-up is just confusing. If you ORDER BY 
id DESC LIMIT 10, then you'll get the 10 highest values of id in the 
result. The write-up just means that MySQL isn't going to bother sorting 
the rest of the table after it finds the 10 highest (or whatever your 
limit is). Is that what you're after?

--
---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] MySQL PHP hosting

2005-02-09 Thread Marcus Joyce
You could also try www.vitalspeeds.com they dont host any microsoft 
stuff like .Net or ASP but they are reliable and cheap. Hope this helps.

Regards,
Marcus Joyce
J. Connolly wrote:
Is there a site that someone could recommend that does PHP, Mysql 
hosting? If they do .NET that would be good also. This is for practice 
and development not for a company so I am looking to keep the costs 
down. There are so many sites, I thought maybe someone here might have 
a good solution.

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


Re: [PHP-DB] MySQL PHP hosting

2005-02-09 Thread Robby Russell
On Tue, 2005-02-08 at 16:07 -0500, J. Connolly wrote:
 Is there a site that someone could recommend that does PHP, Mysql 
 hosting? If they do .NET that would be good also. This is for practice 
 and development not for a company so I am looking to keep the costs 
 down. There are so many sites, I thought maybe someone here might have a 
 good solution.
 
 jzf
 

http://www.planetargon.com/hosting/



-- 
/***
* 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 hosting Ruby on Rails Apps ---
/

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



[PHP-DB] MySQL PHP hosting

2005-02-08 Thread J. Connolly
Is there a site that someone could recommend that does PHP, Mysql 
hosting? If they do .NET that would be good also. This is for practice 
and development not for a company so I am looking to keep the costs 
down. There are so many sites, I thought maybe someone here might have a 
good solution.

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


RE: [PHP-DB] MySQL PHP hosting

2005-02-08 Thread Bastien Koert
i buy my hosting on ebay. haven't had a problem
bastien
From: J. Connolly [EMAIL PROTECTED]
To: PHP list php-db@lists.php.net
Subject: [PHP-DB] MySQL PHP hosting
Date: Tue, 08 Feb 2005 16:07:47 -0500
Is there a site that someone could recommend that does PHP, Mysql hosting? 
If they do .NET that would be good also. This is for practice and 
development not for a company so I am looking to keep the costs down. There 
are so many sites, I thought maybe someone here might have a good solution.

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

2005-02-08 Thread J. Connolly
joe,
 thanks for the advicei just can't host where i work and trying to 
develop only on my laptop only at work is becoing tedious. The sys admin 
is not happy about me running iis or apache on my laptop here. But at 
least I didn't ask how you how to configure my php and mysql

richard,
 thanks for ipower that look kind of like what i am looking for
jozef

Joe Harman wrote:
Hey J.
I really like both of these companies
http://www.spinweb.net
http://www.rochen.com
both are big with PHP... both have top notch service and great
pricing... spinweb is great if you are into editing your confige
files...
Good Luck!
Joe
PS... people here on this board don't like these kinds of question..
just a FYI for you!
On Tue, 08 Feb 2005 16:07:47 -0500, J. Connolly [EMAIL PROTECTED] wrote:
 

Is there a site that someone could recommend that does PHP, Mysql
hosting? If they do .NET that would be good also. This is for practice
and development not for a company so I am looking to keep the costs
down. There are so many sites, I thought maybe someone here might have a
good solution.
jzf
--
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] MySQL Error 1251 / phpMyAdmin

2005-02-07 Thread GH
I just installed phpMyAdmin 2.6.1 on my Windows Laptop with PHP
Version 4.3.10  [Build Date  Dec 14 2004 17:46:48] and mySql 4.1.8

I am receiving the enclosed error  when I attempt to go into
phpMyAdmin and do not know how to solve the issue...

Any assistance would be greatful.

Thank you
Gary


//## ERROR RECIEVED //

Welcome to phpMyAdmin 2.6.1

phpMyAdmin tried to connect to the MySQL server, and the server
rejected the connection. You should check the host, username and
password in config.inc.php and make sure that they correspond to the
information given by the administrator of the MySQL server.

Error 
MySQL said:  

#1251 - Client does not support authentication protocol requested by server

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



Re: [PHP-DB] mysql table join

2005-02-06 Thread franciccio
You may try to create a VIEW. In this case the tables will be dynamically 
linked, that is when some values change in both tales the views 
automatically update itself each time you call it.



CPT John W. Holmes [EMAIL PROTECTED] ha scritto nel messaggio 
news:[EMAIL PROTECTED]
 From: Roger Miranda (Sumac) [EMAIL PROTECTED]

 Is there a way to permanently join/link two mysql tables?

 Not without creating another table.

 CREATE TABLE MyTable SELECT ... FROM Table1 JOIN Table2 ON ... WHERE ...

 Although I have to wonder about your schema if you need to do this.

 ---John Holmes... 

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



[PHP-DB] mysql 4.1-4.0

2005-02-02 Thread blackwater dev
Why is this query handled differently in 4.1?

4.0
select lower(concat(last_name,id)) from client where prim_id=1
returns johnson1

4.1
same query returns Johnson1

Why don't the lower work in 4.1 when you concatonate with a number?

Thanks!

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



Re: [PHP-DB] mysql 4.1-4.0

2005-02-02 Thread Martin Norland
blackwater dev wrote:
Why is this query handled differently in 4.1?
4.0
select lower(concat(last_name,id)) from client where prim_id=1
returns johnson1
4.1
same query returns Johnson1
Why don't the lower work in 4.1 when you concatonate with a number?
No idea.
select concat(lower(last_name),id) from client where prim_id=1;
Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] mysql 4.1-4.0

2005-02-02 Thread blackwater dev
yeah, that is what I did to fix it...just curious why the problem was
there in the first place.


On Wed, 02 Feb 2005 14:40:55 -0600, Martin Norland
[EMAIL PROTECTED] wrote:
 blackwater dev wrote:
  Why is this query handled differently in 4.1?
 
  4.0
  select lower(concat(last_name,id)) from client where prim_id=1
  returns johnson1
 
  4.1
  same query returns Johnson1
 
  Why don't the lower work in 4.1 when you concatonate with a number?
 No idea.
 
 select concat(lower(last_name),id) from client where prim_id=1;
 
 Cheers,
 --
 - Martin Norland, Database / Web Developer, International Outreach x3257
 The opinion(s) contained within this email do not necessarily represent
 those of St. Jude Children's Research Hospital.
 
 --
 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 4.1-4.0

2005-02-02 Thread Bastien Koert
precedence of function order may have changed
bastien
From: blackwater dev [EMAIL PROTECTED]
Reply-To: blackwater dev [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: Re: [PHP-DB] mysql 4.1-4.0
Date: Wed, 2 Feb 2005 15:46:25 -0500
yeah, that is what I did to fix it...just curious why the problem was
there in the first place.
On Wed, 02 Feb 2005 14:40:55 -0600, Martin Norland
[EMAIL PROTECTED] wrote:
 blackwater dev wrote:
  Why is this query handled differently in 4.1?
 
  4.0
  select lower(concat(last_name,id)) from client where prim_id=1
  returns johnson1
 
  4.1
  same query returns Johnson1
 
  Why don't the lower work in 4.1 when you concatonate with a number?
 No idea.

 select concat(lower(last_name),id) from client where prim_id=1;

 Cheers,
 --
 - Martin Norland, Database / Web Developer, International Outreach x3257
 The opinion(s) contained within this email do not necessarily represent
 those of St. Jude Children's Research Hospital.

 --
 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] mysql 4.1-4.0

2005-02-02 Thread Bastien Koert
try
select concat(lower(last_name),id) from client where prim_id=1
bastien

From: blackwater dev [EMAIL PROTECTED]
Reply-To: blackwater dev [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] mysql 4.1-4.0
Date: Wed, 2 Feb 2005 15:35:08 -0500
Why is this query handled differently in 4.1?
4.0
select lower(concat(last_name,id)) from client where prim_id=1
returns johnson1
4.1
same query returns Johnson1
Why don't the lower work in 4.1 when you concatonate with a number?
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


[PHP-DB] mysql - image storing

2005-01-18 Thread mel list_php
Hi list,
I try to store/retrieve pictures into MySQL.
I know that a lot of people will say this is not a good practice, so here 
are briefly my reasons:
-I want to protect that pictures (restricted access)
-I don't want to use htaccess as I want my users to be able to modify their 
password whenever they want, and I don't want to modify dynamically an 
htaccess file.
-I could store them on the filesystem (my actual solution), but I have only 
few pictures, so I would like to give the MySQL option a trial.

I found on the web a lot of tutorials on how to do that, they almost all 
look like this one
http://www.phpbuilder.com/columns/florian19991014.php3?page=1

I went through a lot of forums, saw a lot of problems and still am unable to 
make it work for me.

Here are my scripts
-for the upload into mysql I suppose all is ok as I am able to visualize the 
pictures through phpMyAdmin
-for the retrieval

?require (./connexion.php);
$result = mysql_query(select * from images_binaires where id=1;) or 
die(mysql_error());
while( $row = mysql_fetch_array($result  ) )
{
$donnees=stripslashes($row[donnees_binaires]);
$type=$row[type_fichier];
$taille_fichier=$row[taille_fichier];
}

if ($donnees) {
   header('Content-Type: image/png');
   header('Content-Length: $taille_fichier');
   echo $donnees;
}
else {
   echo 'error';
}
?
and the calling script:
?
require (./connexion.php);
echoimg src='./afficher_image_public.php';
?
what I can say:
-no problem with connexion, it retrieves data (echo of $donnees without 
header)
-when I retrieve the data without the header, they look normal, no excess 
of slashes for example.
-I tried to open the file with rb for upload (even if it's supposed to be 
by default now)
-I tried to put the header on top of the script
-I tried different combinations with addslashes/stripslashes, trim in case 
of spaces, mysql_real_escape_string...
-I also tried with imagecreatefromstring(), even if I saw that it shouldn't 
be necessary.
-I think I shouldn't need the GD library, but it's installed anyway

If somebody can help?
Thanks!
_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

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


RE: [PHP-DB] mysql - image storing

2005-01-18 Thread Bastien Koert
so what exactly is the problem?
bastien
From: mel list_php [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] mysql - image storing
Date: Tue, 18 Jan 2005 11:30:12 +
Hi list,
I try to store/retrieve pictures into MySQL.
I know that a lot of people will say this is not a good practice, so here 
are briefly my reasons:
-I want to protect that pictures (restricted access)
-I don't want to use htaccess as I want my users to be able to modify their 
password whenever they want, and I don't want to modify dynamically an 
htaccess file.
-I could store them on the filesystem (my actual solution), but I have only 
few pictures, so I would like to give the MySQL option a trial.

I found on the web a lot of tutorials on how to do that, they almost all 
look like this one
http://www.phpbuilder.com/columns/florian19991014.php3?page=1

I went through a lot of forums, saw a lot of problems and still am unable 
to make it work for me.

Here are my scripts
-for the upload into mysql I suppose all is ok as I am able to visualize 
the pictures through phpMyAdmin
-for the retrieval

?require (./connexion.php);
$result = mysql_query(select * from images_binaires where id=1;) or 
die(mysql_error());
while( $row = mysql_fetch_array($result  ) )
{
$donnees=stripslashes($row[donnees_binaires]);
$type=$row[type_fichier];
$taille_fichier=$row[taille_fichier];
}

if ($donnees) {
   header('Content-Type: image/png');
   header('Content-Length: $taille_fichier');
   echo $donnees;
}
else {
   echo 'error';
}
?
and the calling script:
?
require (./connexion.php);
echoimg src='./afficher_image_public.php';
?
what I can say:
-no problem with connexion, it retrieves data (echo of $donnees without 
header)
-when I retrieve the data without the header, they look normal, no excess 
of slashes for example.
-I tried to open the file with rb for upload (even if it's supposed to be 
by default now)
-I tried to put the header on top of the script
-I tried different combinations with addslashes/stripslashes, trim in case 
of spaces, mysql_real_escape_string...
-I also tried with imagecreatefromstring(), even if I saw that it shouldn't 
be necessary.
-I think I shouldn't need the GD library, but it's installed anyway

If somebody can help?
Thanks!
_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

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

2005-01-18 Thread Jason Wong
On Tuesday 18 January 2005 19:30, mel list_php wrote:

[snip]

 $donnees=stripslashes($row[donnees_binaires]);

[snip]

 -I tried different combinations with addslashes/stripslashes, trim in case
 of spaces, mysql_real_escape_string...

I haven't looked at your code in detail but stripslashes() should never be 
used on data retrieved from the DB (that is assuming your data was inserted 
correctly in the first place).

-- 
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
--
New Year Resolution: Ignore top posted posts

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



RE: [PHP-DB] mysql - image storing

2005-01-18 Thread mel list_php
The problem is that I just display the image broken link icon.
As I told before the image is displayed fine into phpMyAdmin, so I think the 
problem is really in the retrieval script, but I can't see where...
I tried with several browser, so that's not the question either...I also 
tried with several header option as I thought it may be the problem as if I 
just echo the data without the header they look like normal  data for a 
picture...
Thanks for the reply.

From: Bastien Koert [EMAIL PROTECTED]
To: [EMAIL PROTECTED], php-db@lists.php.net
Subject: RE: [PHP-DB] mysql - image storing
Date: Tue, 18 Jan 2005 10:46:50 -0500
so what exactly is the problem?
bastien
From: mel list_php [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] mysql - image storing
Date: Tue, 18 Jan 2005 11:30:12 +
Hi list,
I try to store/retrieve pictures into MySQL.
I know that a lot of people will say this is not a good practice, so here 
are briefly my reasons:
-I want to protect that pictures (restricted access)
-I don't want to use htaccess as I want my users to be able to modify 
their password whenever they want, and I don't want to modify dynamically 
an htaccess file.
-I could store them on the filesystem (my actual solution), but I have 
only few pictures, so I would like to give the MySQL option a trial.

I found on the web a lot of tutorials on how to do that, they almost all 
look like this one
http://www.phpbuilder.com/columns/florian19991014.php3?page=1

I went through a lot of forums, saw a lot of problems and still am unable 
to make it work for me.

Here are my scripts
-for the upload into mysql I suppose all is ok as I am able to visualize 
the pictures through phpMyAdmin
-for the retrieval

?require (./connexion.php);
$result = mysql_query(select * from images_binaires where id=1;) or 
die(mysql_error());
while( $row = mysql_fetch_array($result  ) )
{
$donnees=stripslashes($row[donnees_binaires]);
$type=$row[type_fichier];
$taille_fichier=$row[taille_fichier];
}

if ($donnees) {
   header('Content-Type: image/png');
   header('Content-Length: $taille_fichier');
   echo $donnees;
}
else {
   echo 'error';
}
?
and the calling script:
?
require (./connexion.php);
echoimg src='./afficher_image_public.php';
?
what I can say:
-no problem with connexion, it retrieves data (echo of $donnees without 
header)
-when I retrieve the data without the header, they look normal, no 
excess of slashes for example.
-I tried to open the file with rb for upload (even if it's supposed to 
be by default now)
-I tried to put the header on top of the script
-I tried different combinations with addslashes/stripslashes, trim in case 
of spaces, mysql_real_escape_string...
-I also tried with imagecreatefromstring(), even if I saw that it 
shouldn't be necessary.
-I think I shouldn't need the GD library, but it's installed anyway

If somebody can help?
Thanks!
_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

--
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
_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

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


Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Joseph Crawford
Jason, can you explain why stripslashes should not be used on data
taken from the db? when you store data in the db i thought it was good
practice to addslashes, when you retrieve from the db, you will need
to use stripslashes to remove the extra \


-- 
Joseph Crawford Jr.
Codebowl Solutions
[EMAIL PROTECTED]

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



Re: [PHP-DB] mysql - image storing

2005-01-18 Thread dpgirago
   Jason, can you explain why stripslashes should not be used on data
 taken from the db? when you store data in the db i thought it was good
 practice to addslashes, when you retrieve from the db, you will need
 to use stripslashes to remove the extra \

If I may step in...

Assuming a MySQL db, using mysql_escape_string obviates the need for using 
either stripslashes or addslashes for db 
inserts and selects. I'm not sure of the underlying mechanism, but if you 
use mysql_escape_string on a string, the  \'s and' s, etc... all get 
escaped automagically 
before the insert. If you then take a look at the inserted data using the 
mysql client, you will see that the full unescaped text has been inserted. 
So there is no need to use stripslashes when selecting it out. 

Personally, this is counterintuitive, but that's the way it works.

David

Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Martin Norland
Joseph Crawford wrote:
Jason, can you explain why stripslashes should not be used on data
taken from the db? when you store data in the db i thought it was good
practice to addslashes, when you retrieve from the db, you will need
to use stripslashes to remove the extra \
The slashes are added for the database, not to be stored with the data.
for e.g. - to store:  I've just eaten.
you do: INSERT INTO status (hunger) values ('I\'ve just eaten.');
which stores: I've just eaten.
It's not good practice - it's required (if you're not using a mechanism 
that already handles this - such as the latest mysqli bind functions) - 
otherwise the query is invalid.

You may be thinking of running 'htmlentities' when retrieving data - 
which is necessary in some cases, depending on where you're using it 
(most notably - in html where you don't want html output).

Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Jason Wong
On Wednesday 19 January 2005 01:51, [EMAIL PROTECTED] wrote:
Jason, can you explain why stripslashes should not be used on data
  taken from the db? when you store data in the db i thought it was good
  practice to addslashes, when you retrieve from the db, you will need
  to use stripslashes to remove the extra \

 If I may step in...

 Assuming a MySQL db, using mysql_escape_string obviates the need for using
 either stripslashes or addslashes for db inserts and selects. I'm not sure
 of the underlying mechanism, but if you use mysql_escape_string on a
 string, the  \'s and' s, etc... all get escaped automagically before
 the insert. If you then take a look at the inserted data using the mysql
 client, you will see that the full unescaped text has been inserted. So
 there is no need to use stripslashes when selecting it out.

Additionally, it should be noted that whether you need to use stripslashes() 
on data retrieved from the database depends on the setting of 
magic_quotes_runtime. The recommended setting is to have it disabled which 
means you do not need stripslashes().

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Jochem Maas
Martin Norland wrote:
Joseph Crawford wrote:
Jason, can you explain why stripslashes should not be used on data
taken from the db? when you store data in the db i thought it was good
practice to addslashes, when you retrieve from the db, you will need
to use stripslashes to remove the extra \

The slashes are added for the database, not to be stored with the data.
for e.g. - to store:  I've just eaten.
you do: INSERT INTO status (hunger) values ('I\'ve just eaten.');
I was always under the impression that single quotes (assuming you are 
delineating you args with single quotes) should (officially) be escaped 
with another single quote - although backslash also works:

INSERT INTO status (hunger) values ('I''ve just eaten.');
...alot of really old code of mine is full of stuff like:
$var = str_replace(','',$var);
but maybe that just MTAM(tm) working for me - (thats a reference to a 
bit of humour from another thread btw - MTAM is not a technology :-)

which stores: I've just eaten.
It's not good practice - it's required (if you're not using a mechanism 
that already handles this - such as the latest mysqli bind functions) - 
otherwise the query is invalid.
nice to learn that mysqli is getting it 'right' :-) [makes mental note 
to look into it!]

You may be thinking of running 'htmlentities' when retrieving data - 
which is necessary in some cases, depending on where you're using it 
(most notably - in html where you don't want html output).

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


RE: [PHP-DB] mysql - image storing

2005-01-18 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 18 January 2005 17:11, Joseph Crawford wrote:

 Jason, can you explain why stripslashes should not be used on data
 taken from the db? when you store data in the db i thought it was good
 practice to addslashes, when you retrieve from the db, you will need
 to use stripslashes to remove the extra \

It's simple.  Suppose you have a script that looks a bit like this (but
hopefully with more input validation and error checking!):


$value = addslashes($_POST['text']); // magic_quotes_gpc off

$sql = INSERT INTO tbl SET fld = '$value';

database_execute($sql);

Now suppose the user types this into the 'text' form field:

Here's an apostrophe

Here's what happens:

  PHP does this:

$value is set to: Here\'s an apostrophe

$sql becomes: INSERT INTO tbl SET fld = 'Here\'s an apostrophe'

Which is sent to the database via database_execute()

  The DATABASE now does this:

Receives the SQL statement: INSERT INTO tbl SET fld = 'Here\'s an
apostrophe'

(Note how the \ escape is required here to stop the field
value from terminating prematurely -- but this escape is
aimed at the *database*, and is not a PHP escape.  A lot of
confusion seems to arise here for databases which use the
same \ escape character as PHP.)

Extracts the value:   Here\'s an apostrophe
and de-escapes it to give:Here's an apostrophe

Which gets inserted into the database.

So the value inserted into the database is the unescaped original, and on
retrieval there are no \ characters in the retrieved value to be
stripslashes()ed.

Hope that's clearer than mud, and helps you understand what's going on
better.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Jochem Maas
Joseph Crawford wrote:
Jason, can you explain why stripslashes should not be used on data
taken from the db? when you store data in the db i thought it was good
although 'slashing' text works pretty much all of the time (possibly the 
guys using exotic encodings all day will say different :-) but the data 
you are storing in the DB is binary - stripping and slashing will 
probably do weird things to the data:

try creating some image data and run it thru add_slashes() and 
stripslashes() and compare the output of each with the original.

practice to addslashes, when you retrieve from the db, you will need
why is it good practice? (anyone)? sounds like pure overhead to me.
you could look up 'magic quotes' in relation to this, its often where 
the trouble starts!

on a side note:
-
me I use the ibase/firebird php extension which has parameterized 
queries - so I can say goodbye to mysql_escape_arg() (or whatever the 
damn function is called) and having to hand craft lots of arg checks -
but alas you may not have access to a firebird DB.


to use stripslashes to remove the extra \

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


Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Simon Rees
On Tuesday 18 January 2005 19:18, Jochem Maas wrote:
 I was always under the impression that single quotes (assuming you are
 delineating you args with single quotes) should (officially) be escaped
 with another single quote - although backslash also works:

I think it depends on the database that you are using. Oracle and MS-SQL 
both require quotes to be escaped with another quote, MySQL uses 
backslashes.
I seem to recall that two quotes is the standard...

Of course it is even better to use bind vars and then you don't need to 
escape the quotes (or worry about sql injection attacks)...

cheers Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Martin Norland
Jochem Maas wrote:
I was always under the impression that single quotes (assuming you are 
delineating you args with single quotes) should (officially) be escaped 
with another single quote - although backslash also works:

INSERT INTO status (hunger) values ('I''ve just eaten.');
...alot of really old code of mine is full of stuff like:
$var = str_replace(','',$var);
but maybe that just MTAM(tm) working for me - (thats a reference to a 
bit of humour from another thread btw - MTAM is not a technology :-)
AFAIK - for Sybase and CSV yes, otherwise no (in general).  Maybe it's a 
compatibility option?  Still, there are perfectly valid reasons to have 
multiple ''s.  (why, there's one now - sort of...)

Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Jochem Maas
Simon Rees wrote:
On Tuesday 18 January 2005 19:18, Jochem Maas wrote:
I was always under the impression that single quotes (assuming you are
delineating you args with single quotes) should (officially) be escaped
with another single quote - although backslash also works:

I think it depends on the database that you are using. Oracle and MS-SQL 
both require quotes to be escaped with another quote, MySQL uses 
backslashes.
I seem to recall that two quotes is the standard...

Of course it is even better to use bind vars and then you don't need to 
escape the quotes (or worry about sql injection attacks)...
did I mention I have been using firebird and the php-extension for the 
last year and a half ;-)

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


Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Jochem Maas
Martin Norland wrote:
Jochem Maas wrote:
I was always under the impression that single quotes (assuming you are 
delineating you args with single quotes) should (officially) be 
escaped with another single quote - although backslash also works:

INSERT INTO status (hunger) values ('I''ve just eaten.');
...alot of really old code of mine is full of stuff like:
$var = str_replace(','',$var);
but maybe that just MTAM(tm) working for me - (thats a reference to a 
bit of humour from another thread btw - MTAM is not a technology :-)

AFAIK - for Sybase and CSV yes, otherwise no (in general).  Maybe it's a 
compatibility option?  Still, there are perfectly valid reasons to have 
multiple ''s.  (why, there's one now - sort of...)
ok - cheers, just for the record If I wanted to insert your sentence:
'Still, there are perfectly valid reasons to have multiple s'
:-)
Cheers,
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySQL db sync

2005-01-15 Thread Kris Geens
Hi,

I need some help. Does anyone know a good tool to synchronize MySQL databases?
Thanks in advance for your help

Regards,
Kris

RE: [PHP-DB] MySQL db sync

2005-01-15 Thread Bastien Koert
sqlyog is a great tool
bastien
From: Kris Geens [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL db sync
Date: Sat, 15 Jan 2005 14:06:50 +0100
Hi,
I need some help. Does anyone know a good tool to synchronize MySQL 
databases?
Thanks in advance for your help

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


[PHP-DB] MySQL ENCRYPT help!

2005-01-09 Thread Kevin the Linux User
To the PHP Database Mailing-List:

I joined the mailing list for this one question I just can't figure 
out. I used the phpMyAdmin to create table. I placed one row in this table, I 
used the ENCRYPT function. How do I De-Crypt the data I just encrypted to use 
in my PHP code. I encrypted it, for security.

If it's not a bother, can you also give a sniplet of example code, on 
just the part of de-crypting it, I know everything about connecting, and 
displaying, it's just the de-crypting I am having trouble with.

-- 
Thanks,
Kevin the Linux User
Linux! Working together, we build it BETTER!
-- Quote from book, The Joy of Linux/2001

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



Re: [PHP-DB] MySQL ENCRYPT help!

2005-01-09 Thread Jochem Maas
Kevin the Linux User wrote:
To the PHP Database Mailing-List:
	I joined the mailing list for this one question I just can't figure out. 
nice, we help you and then you bugger off? - community spirit are go!
I used the phpMyAdmin to create table. I placed one row in this table, I used 
the ENCRYPT function. How do I De-Crypt the data I just encrypted to use in my 
PHP code. I encrypted it, for security.
If it's not a bother, can you also give a sniplet of example code, on 
just the part of de-crypting it, I know everything about connecting, and 
displaying, it's just the de-crypting I am having trouble with.
the mysql manual states:
ENCRYPT() ignores all but the first eight characters of str, at least 
on some systems. 

this is probably not what you want, besides which AFAICS its one way 
encryption.

---
as you don't state what it is your trying to achieve (e.g. storing a 
passwd - in which there is NO reason to want to decrypt it - instead you 
should test a user given value against the DB by encrypting the user 
value), you also don't state what version of MySQL your using therefore 
its impossible to determine which encryption functions you have at your 
disposal in MySQL.

here is a couple of pairs of enc/dec funcs that might help:
AES_ENCRYPT(str,key_str)
AES_DECRYPT(crypt_str,key_str)
DECODE(crypt_str,pass_str)
ENCODE(str,pass_str)
try reading this page:
http://dev.mysql.com/doc/mysql/en/Encryption_functions.html
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MySQL Auto PK

2005-01-06 Thread Andrew Kreps
On Wed, 05 Jan 2005 18:11:23 -0500, John Holmes
[EMAIL PROTECTED] wrote:
 OOzy Pal wrote:
  Is it possible to have mysql at an ID as 20050105-1 as
  (MMDD-1), -2, etc.
 
 automatically? No. But you can always just use
 
 SELECT CONCAT(date_column,'-',pk_column) AS fixed_id ...
 
 if you _really_ need something like this. Or just join them together in
 PHP.

I think the only downside to that solution is that the primary key
will continue to increment regardless of the day, and I think the
original poster wanted:

20050105-1
20050105-2
20050106-1
...etc.

This would be a great place for a stored procedure, but I don't know
if I can recommend running MySQL 5 to you.  The most platform-safe way
I can think of is to get a count(*) of the number of rows with today's
date, add 1 to it, and stick that number on the end of the string
you've created to insert into a varchar field.  It's an extra query
per insert, but it'd do the job.

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



Re: [PHP-DB] MySQL Auto PK

2005-01-06 Thread Jason Wong
On Friday 07 January 2005 02:29, Andrew Kreps wrote:

 This would be a great place for a stored procedure, but I don't know
 if I can recommend running MySQL 5 to you.  The most platform-safe way
 I can think of is to get a count(*) of the number of rows with today's
 date, add 1 to it, and stick that number on the end of the string
 you've created to insert into a varchar field.  It's an extra query
 per insert, but it'd do the job.

Don't forget to WRITE lock the table before counting, and only unlock after 
inserting the new id.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



RE: [PHP-DB] MySQL Auto PK

2005-01-06 Thread Norland, Martin
 -Original Message-
 From: Andrew Kreps [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 06, 2005 12:30 PM
 Subject: Re: [PHP-DB] MySQL Auto PK
 
 On Wed, 05 Jan 2005 18:11:23 -0500, John Holmes
[EMAIL PROTECTED] wrote:
  OOzy Pal wrote:
   Is it possible to have mysql at an ID as 20050105-1 as
(MMDD-1), 
   -2, etc.
  
  automatically? No. But you can always just use
  SELECT CONCAT(date_column,'-',pk_column) AS fixed_id ...
  if you _really_ need something like this. Or just join them together
in PHP.
 
 I think the only downside to that solution is that the primary key
will continue to increment regardless of the day, and I think the
original poster wanted:
 
 20050105-1
 20050105-2
 20050106-1
 ...etc.
 
 This would be a great place for a stored procedure, but I don't know
if I can recommend running MySQL 5 to you.  The most platform-safe way I
can think of is to get a count(*) of the number of rows with today's
date, add 1 to it, and stick that number on the end of the string you've
created to insert into a varchar field.  It's an extra query per insert,
but it'd do the  job.

Doing a count and tagging the number on the back could result in race
conditions with a much larger window than one would prefer (albeit still
small).  Wouldn't tagging the time on the end of the date accomplish the
overall goal?  You can pull them from the database as is (with their
full date/time - ordered by such) and then trim the date out (mysql
could even do this for you) and tag on -$rownum.  Still, no atomicity
for guarantee of uniqueness.

The primary key should be used solely for unique identification
purposes, how it looks visually should be of little concern/interest -
at least, given the data I've seen so far (e.g. it's just based on
date/time).  This really seems like a perfect candidate for an
autoincrement and a separate date / datetime field.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] MySQL Auto PK

2005-01-06 Thread Jochem Maas
Andrew Kreps wrote:
...
20050105-1
20050105-2
20050106-1
...etc.
This would be a great place for a stored procedure, but I don't know
if I can recommend running MySQL 5 to you.  The most platform-safe way
an open source alternative that does offer this enterprise level 
functionality (stored procedures) is firebird. and its based on proven 
tech. (interbase), not to mention its not bleeding edge (firebird stayed 
in beta so long that if it had been a microsoft product it would have 
gone gold, shipped, and been put to pasture ;-).

but firebird is a little more difficult to get into than MySQL and you 
may not have access to hosting that provides it.

I can think of is to get a count(*) of the number of rows with today's
date, add 1 to it, and stick that number on the end of the string
you've created to insert into a varchar field.  It's an extra query
per insert, but it'd do the job.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySQL Auto PK

2005-01-05 Thread OOzy Pal
Dears,

Is it possible to have mysql at an ID as 20050105-1 as
(MMDD-1), -2, etc.

OOzy

=
Regards,
OOzy

What is the purpose of life?



__ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

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



Re: [PHP-DB] MySQL Auto PK

2005-01-05 Thread Jochem Maas
OOzy Pal wrote:
Dears,
Is it possible to have mysql at an ID as 20050105-1 as
(MMDD-1), -2, etc.
probably, possibly, maybe. take your pick.
as Martin Norland already pointed out to someone else; this is not 
[EMAIL PROTECTED] (that beauty of a comment is forever burned 
into my neo-cortex! :-)

i.e. try a little more info...
OOzy
=
Regards,
OOzy
What is the purpose of life?
		
__ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

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


Re: [PHP-DB] MySQL Auto PK

2005-01-05 Thread John Holmes
OOzy Pal wrote:
Is it possible to have mysql at an ID as 20050105-1 as
(MMDD-1), -2, etc.
automatically? No. But you can always just use
SELECT CONCAT(date_column,'-',pk_column) AS fixed_id ...
if you _really_ need something like this. Or just join them together in 
PHP.

--
---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] MySQL database converter ?

2005-01-04 Thread Jochem Maas
Nayyar Ahmed wrote:
Hello All:
Is there any tool available for conversion of M$ Access, Oracle etc Databases
to MySQL database ?
google will probably give you more answers than this list (try also 
searching for the term 'datapump' and variations on it)

IBExpert is one tool that will allow you to reverse engineer an existing 
DB and then use the model that is created to generate SQL to create a 
new DB in the format of your choice (the 3 you mention are supported)

also bare in mind that not all features of each database can be 
translated to the others.

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


[PHP-DB] MySQL version issue

2005-01-04 Thread Mark Benson
As some of you will recall, I enquired on this list about versions of MySQL and 
PHP a while back regarding and issue wit using the 'ON DUPLICATE KEY UPDATE' 
command in MySQL INSERT queries. Having upgraded our in-house system to PHP5 
and MySQL 4 the issue was no longer a problem.

However I have subsequently enquired with our out-of-house web host and they 
are still using PHP 4.1.2 and MySQL 3.25.58. As one of the purposes of asking 
them was to establish if I could easily upload from my database to the remote 
database, I now have a problem. I was planning to use a compare and update 
script that used 'ON DUPLICATE KEY UPDATE' command in MySQL INSERT queries to 
add or change items on the remote server. However I can't, as it's a MySQL4 
feature and the database to which I am writing ain't using MySQL4!

Any ideas about how I can create a MySQL3 compliant substitute for the 'ON 
DUPLICATE KEY UPDATE' Query action?

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



RE: [PHP-DB] MySQL database converter ?

2005-01-04 Thread Bastien Koert
DB Designer4 from fabforce (www.fabforce.net/dbdesigner4/)
bastien
From: Nayyar Ahmed [EMAIL PROTECTED]
Reply-To: Nayyar Ahmed [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL database converter ?
Date: Tue, 4 Jan 2005 10:36:20 +0500
Hello All:
Is there any tool available for conversion of M$ Access, Oracle etc 
Databases
to MySQL database ?

TIA:
--
Nayyar Ahmad
Lecturer
Faculty Of Computer Science,
Institute Of Management Sciences,
Hayat Abad Peshawar , Pakistan.
Office : 92-091-9217404 , 9217452
Cell :  92-0333-9139461
--
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 version issue

2005-01-04 Thread Bastien Koert
Hi Mark,
I guess the best way would be to use some php and sql and let the 
application do the checking. First run a query to acertain if the key is 
present, if yes then update the main record else insert a new record. 
bascially you just need to bring the SQL logic into the app logic.

Bastien
From: Mark Benson [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL version issue
Date: Tue, 04 Jan 2005 14:43:48 +
As some of you will recall, I enquired on this list about versions of MySQL 
and PHP a while back regarding and issue wit using the 'ON DUPLICATE KEY 
UPDATE' command in MySQL INSERT queries. Having upgraded our in-house 
system to PHP5 and MySQL 4 the issue was no longer a problem.

However I have subsequently enquired with our out-of-house web host and 
they are still using PHP 4.1.2 and MySQL 3.25.58. As one of the purposes of 
asking them was to establish if I could easily upload from my database to 
the remote database, I now have a problem. I was planning to use a compare 
and update script that used 'ON DUPLICATE KEY UPDATE' command in MySQL 
INSERT queries to add or change items on the remote server. However I 
can't, as it's a MySQL4 feature and the database to which I am writing 
ain't using MySQL4!

Any ideas about how I can create a MySQL3 compliant substitute for the 'ON 
DUPLICATE KEY UPDATE' Query action?

--
Mark Benson
http://homepage.mac.com/markbenson
--
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 version issue

2005-01-04 Thread Doug Thompson
It seems to me that the _mysql manual_ gives a most straightforward and useful 
explanation:
If you specify the ON DUPLICATE KEY UPDATE clause (new in MySQL 4.1.0), and a 
row is inserted that would cause a duplicate value in a UNIQUE index or PRIMARY KEY, 
an UPDATE of the old row is performed. For example, if column a is declared as 
UNIQUE and already contains the value 1, the following two statements have identical 
effect:
mysql INSERT INTO table (a,b,c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE c=c+1;
mysql UPDATE table SET c=c+1 WHERE a=1;
The rows-affected value is 1 if the row is inserted as a new record and 2 if an 
existing record is updated.
Note: If column b is unique too, the INSERT would be equivalent to this UPDATE 
statement instead:
mysql UPDATE table SET c=c+1 WHERE a=1 OR b=2 LIMIT 1;
If a=1 OR b=2 matches several rows, only one row is updated! In general, you should 
try to avoid using the ON DUPLICATE KEY clause on tables with multiple UNIQUE 
keys.
Or, you might find a more interesting answer on a MySQL list.
Doug
Mark Benson wrote:
As some of you will recall, I enquired on this list about versions of MySQL and 
PHP a while back regarding and issue wit using the 'ON DUPLICATE KEY UPDATE' 
command in MySQL INSERT queries. Having upgraded our in-house system to PHP5 
and MySQL 4 the issue was no longer a problem.
However I have subsequently enquired with our out-of-house web host and they 
are still using PHP 4.1.2 and MySQL 3.25.58. As one of the purposes of asking 
them was to establish if I could easily upload from my database to the remote 
database, I now have a problem. I was planning to use a compare and update 
script that used 'ON DUPLICATE KEY UPDATE' command in MySQL INSERT queries to 
add or change items on the remote server. However I can't, as it's a MySQL4 
feature and the database to which I am writing ain't using MySQL4!
Any ideas about how I can create a MySQL3 compliant substitute for the 'ON 
DUPLICATE KEY UPDATE' Query action?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MySQL database converter ?

2005-01-03 Thread Manoj Kumar
Hi Everybody , 
 
 Daffodil DB Migration tool provide import/export from a database to
another. It is available at http://www.daffodildb.com/download/index.jsp and

comes with One$DB and DaffodilDB . Use DaffodilDB Browser to import and
export purpose. 


Regards,
Manoj Kr. Sheoran 
www.daffodildb.com 



-Original Message-
From: Nayyar Ahmed [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 04, 2005 11:06 AM
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL database converter ?

Hello All:

Is there any tool available for conversion of M$ Access, Oracle etc
Databases
to MySQL database ?

TIA:

-- 
Nayyar Ahmad

Lecturer
Faculty Of Computer Science,
Institute Of Management Sciences,
Hayat Abad Peshawar , Pakistan.
Office : 92-091-9217404 , 9217452
Cell :  92-0333-9139461

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

2004-12-22 Thread Miles Thompson
Balwant,
Right now this is an algorithm question, not a PHP or MySQL problem.
Define exactly what you want to see as output, what you have as inputs, and 
what process you would have to follow to achieve the output.
But don't suppose - be specific.

Then it's possible to fit it to a language: maybe all the processing could 
be done in the SELECT statement, maybe some will have to be done after the 
results are returned.

Regards - Miles Thompson
At 12:42 AM 12/22/2004, Balwant Singh wrote:
hi to all,
may somebody guide me on the following:
I want to retrieve data from MYSQL and then want that PHP do calculation
- substract a particular field from its previous row. i.e. suppose i
have two field named DATE, STOCK and have 10 rows. Now i want that STOCK
on the 10th row should be substracted from 9th and so on.  May pls. help
me.
with best wishes
balwant
--
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

2004-12-22 Thread Jochem Maas
Balwant Singh wrote:
 hi to all,

 may somebody guide me on the following:

 I want to retrieve data from MYSQL and then want that PHP do calculation
let hope your not asking how to connect to the DB. and perform a query...
 - substract a particular field from its previous row. i.e. suppose i
 have two field named DATE, STOCK and have 10 rows. Now i want that STOCK
 on the 10th row should be substracted from 9th and so on.  May pls. help
 me.
image you have an array of rows of data already retrieved from the DB 
(and each row has two items, say DATE and STOCK), lets assume that the 
order of the items is such that row 10 is first, row 9 second (easy to 
do with the ORDER BY clause of the SQL query, use ASC/DESC on the 
required field as required).

e.g. $rows.
?
// here is a fake array to simulate the data from mysql
$rows = array(
   array('STOCK' = 2), // 10
   array('STOCK' = 4), // 9
   array('STOCK' = 8), // 8
   array('STOCK' = 16),// 7
   array('STOCK' = 32),// 6
   array('STOCK' = 64),// 5
   array('STOCK' = 128),   // 4
   array('STOCK' = 256),   // 3
   array('STOCK' = 512),   // 2
   array('STOCK' = 1024),   // 2
);
$calcStockVals = $origStockVals = array();
foreach ($rows as $row) {
   $prevRow = isset($prevRow)
? $row['STOCK'] - $prevRow
: $row['STOCK'];
   $origStockVals[] = $row['STOCK'];
   $calcStockVals[] = $prevRow;
}
var_dump(array_reverse( $origStockVals ));
echo \n  \n;
var_dump(array_reverse( $calcStockVals ));
?
hope that gives you an idea.


 with best wishes
 balwant

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


[PHP-DB] MYSQL

2004-12-21 Thread Balwant Singh
hi to all,

may somebody guide me on the following:

I want to retrieve data from MYSQL and then want that PHP do calculation
- substract a particular field from its previous row. i.e. suppose i
have two field named DATE, STOCK and have 10 rows. Now i want that STOCK
on the 10th row should be substracted from 9th and so on.  May pls. help
me. 


with best wishes
balwant

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



[PHP-DB] mysql to access

2004-12-17 Thread Perry, Matthew (Fire Marshal's Office)
Does anyone know of a FREE program that exports MySQL to access?  The trial
versions of the ones I have downloaded do not export all the records of the
database.

- Matthew 



RE: [PHP-DB] mysql to access

2004-12-17 Thread Norland, Martin
 -Original Message-
 From: Perry, Matthew (Fire Marshal's Office)
[mailto:[EMAIL PROTECTED] 
 
 Does anyone know of a FREE program that exports MySQL to access?  The
trial versions of the
 ones I have downloaded do not export all the records of the database.

If you can get a .csv export of your database, you should be able to
bring that into access no problem.  phpMyAdmin is able to generate such
a beast (access would probably prefer the 'excel csv export' - what with
microsoft and all) - and I'm sure many other programs can easily
generate csv exports.

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


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



RE: [PHP-DB] mysql to access

2004-12-17 Thread Bastien Koert
why not just link the mysql to access?
bastien
From: Perry, Matthew (Fire Marshal's Office) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql to access
Date: Fri, 17 Dec 2004 09:33:39 -0600
Does anyone know of a FREE program that exports MySQL to access?  The trial
versions of the ones I have downloaded do not export all the records of the
database.
- Matthew
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] mysql to access

2004-12-17 Thread Perry, Matthew (Fire Marshal's Office)
Here is the problem:

I am currently using MySQL and PHP for this application but have realized
recently that the bulk of my work is setting up three forms (add, view,
modify) for each table I create.  It takes hours for each table with MySQL
and PHP but takes only minutes with Access.  Also, other office
administrators have been trained in Access instead of MySQL and will not be
able to update my tables directly or set up new forms if I only use MySQL
and PHP.

On the other hand, PHP and ASP are easier and more flexible with user
control options.  Also, directly entering SQL can be much more efficient
than using Access's embedded SQL applications.  

I really would like to exploit the advantages of both databases but do not
know the best means by which to do this.  We are creating a standard that
will be followed by everyone in our department and need the best and most
efficient solution possible.  People move around from different positions
constantly and it seems we are making radical changes to our system every
year.  Here are three questions with which I still need help:

1) Would it really make sense to split the data management between two
linked databases (Access and MySQL) or would this just cause problems?
2) If I must use Access, should I use ASP(grrr) instead of PHP?
3) If I must use Access, should I use MS SQL Server(grrr) instead of MySQL?

Thank you all for your time and patience.

- Matthew


-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 17, 2004 10:01 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access

it would depend on what you need the app to do...if you are looking to use 
access to do reporting and/ or act as a front end, then it may be 
feasible...

more details, if you care to share them, may help in this consideration

bastien

From: Perry, Matthew (Fire Marshal's Office) [EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access
Date: Fri, 17 Dec 2004 09:59:25 -0600

You mean link the tables?  I haven't yet considered this.
- Matthew

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Friday, December 17, 2004 9:42 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access

why not just link the mysql to access?

bastien

 From: Perry, Matthew (Fire Marshal's Office) 
[EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] mysql to access
 Date: Fri, 17 Dec 2004 09:33:39 -0600
 
 Does anyone know of a FREE program that exports MySQL to access?  The 
trial
 versions of the ones I have downloaded do not export all the records of 
the
 database.
 
 - Matthew
 




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



RE: [PHP-DB] mysql to access

2004-12-17 Thread Miles Thompson
Use ODBC to use MySQL from either Access or VB  (or any other language!)
MT
At 12:25 PM 12/17/2004, Perry, Matthew (Fire Marshal's Office) wrote:
Here is the problem:
I am currently using MySQL and PHP for this application but have realized
recently that the bulk of my work is setting up three forms (add, view,
modify) for each table I create.  It takes hours for each table with MySQL
and PHP but takes only minutes with Access.  Also, other office
administrators have been trained in Access instead of MySQL and will not be
able to update my tables directly or set up new forms if I only use MySQL
and PHP.
On the other hand, PHP and ASP are easier and more flexible with user
control options.  Also, directly entering SQL can be much more efficient
than using Access's embedded SQL applications.
I really would like to exploit the advantages of both databases but do not
know the best means by which to do this.  We are creating a standard that
will be followed by everyone in our department and need the best and most
efficient solution possible.  People move around from different positions
constantly and it seems we are making radical changes to our system every
year.  Here are three questions with which I still need help:
1) Would it really make sense to split the data management between two
linked databases (Access and MySQL) or would this just cause problems?
2) If I must use Access, should I use ASP(grrr) instead of PHP?
3) If I must use Access, should I use MS SQL Server(grrr) instead of MySQL?
Thank you all for your time and patience.
- Matthew
-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Friday, December 17, 2004 10:01 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access
it would depend on what you need the app to do...if you are looking to use
access to do reporting and/ or act as a front end, then it may be
feasible...
more details, if you care to share them, may help in this consideration
bastien
From: Perry, Matthew (Fire Marshal's Office) [EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access
Date: Fri, 17 Dec 2004 09:59:25 -0600

You mean link the tables?  I haven't yet considered this.
- Matthew

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Friday, December 17, 2004 9:42 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access

why not just link the mysql to access?

bastien

 From: Perry, Matthew (Fire Marshal's Office)
[EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] mysql to access
 Date: Fri, 17 Dec 2004 09:33:39 -0600
 
 Does anyone know of a FREE program that exports MySQL to access?  The
trial
 versions of the ones I have downloaded do not export all the records of
the
 database.
 
 - Matthew
 



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

2004-12-17 Thread Bastien Koert
see embedded comments
bastien
From: Perry, Matthew (Fire Marshal's Office) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access
Date: Fri, 17 Dec 2004 10:25:09 -0600
Here is the problem:
I am currently using MySQL and PHP for this application but have realized
recently that the bulk of my work is setting up three forms (add, view,
modify) for each table I create.  It takes hours for each table with MySQL
and PHP but takes only minutes with Access.  Also, other office
administrators have been trained in Access instead of MySQL and will not be
able to update my tables directly or set up new forms if I only use MySQL
and PHP.
Add / Edit should be the same page. You can add a little code to make some 
field uneditable if they should not be. You need to find ways to speed up 
the process. There is code available that will take your table structure and 
dump all the fields and sql statements, to initialize the variables with 
defaults. (get it here (http://www.weberdev.com/get_example-3978.html)). 
Then its mainly a matter of creating the forms and plugging it all together. 
Using a web form is even easier than using an access form, since all the 
code for menus and stuff is hiddedn away and links and form provide the 
navigation


On the other hand, PHP and ASP are easier and more flexible with user
control options.  Also, directly entering SQL can be much more efficient
than using Access's embedded SQL applications.
The other thing is that to install this based on browser technology (ie 
ASP/PHP) you only need to install in one place, on the server. Otherwise 
you'll need to install it on every computer where the user is (time, travel 
and VERSIONING considerations here). Its easy and quicker to make those 
changes on a webserver than going around to all the users and making sure 
that they use the correct access application.


I really would like to exploit the advantages of both databases but do not
know the best means by which to do this.  We are creating a standard that
will be followed by everyone in our department and need the best and most
efficient solution possible.  People move around from different positions
constantly and it seems we are making radical changes to our system every
year.  Here are three questions with which I still need help:


1) Would it really make sense to split the data management between two
linked databases (Access and MySQL) or would this just cause problems?
NO SPLITTING! Splitting the data is askng for a data management 
nightmare. Synchronicity will become a major problem as data changes in one 
place and not another.


2) If I must use Access, should I use ASP(grrr) instead of PHP?
DO NOT USE ACCESS, its not nearly robust enought to handle the application, 
lack of ability to handle multiple users, security etc


3) If I must use Access, should I use MS SQL Server(grrr) instead of MySQL?
not unless you have big dollars to spend? Its just not worth it.
Thank you all for your time and patience.
- Matthew
-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Friday, December 17, 2004 10:01 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access
it would depend on what you need the app to do...if you are looking to use
access to do reporting and/ or act as a front end, then it may be
feasible...
more details, if you care to share them, may help in this consideration
bastien
From: Perry, Matthew (Fire Marshal's Office) 
[EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access
Date: Fri, 17 Dec 2004 09:59:25 -0600

You mean link the tables?  I haven't yet considered this.
- Matthew

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Friday, December 17, 2004 9:42 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql to access

why not just link the mysql to access?

bastien

 From: Perry, Matthew (Fire Marshal's Office)
[EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] mysql to access
 Date: Fri, 17 Dec 2004 09:33:39 -0600
 
 Does anyone know of a FREE program that exports MySQL to access?  The
trial
 versions of the ones I have downloaded do not export all the records of
the
 database.
 
 - Matthew
 




--
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 Maximum Time Exceeded

2004-12-16 Thread aNNa
 This not be what you need, but I think there are some squiggle brackets
missing.

The curly brackets aren't the problem as they're not needed for just
one statement.

Examples at: 
http://www.php.net/manual/en/language.control-structures.php#control-structures.if

anna

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



RE: [PHP-DB] mysql Index table

2004-12-16 Thread Bastien Koert
for inserts , yes, it does
for lots of update, deletes it might be worth to periodically drop and 
rebuild the indeces

bastien
From: Yemi Obembe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql Index table
Date: Thu, 16 Dec 2004 04:59:40 -0800 (PST)
just want to know if mysql automatically update an index table if new datas 
are inserted into the original table. for example, if i insert a row of 
data to a table I'have already created an index table for, would mysql add 
the row to the table?


-
A passion till tomorrow,
Opeyemi Obembe | ng.clawz.com


-
Do you Yahoo!?
 Yahoo! Mail - 250MB free storage. Do more. Manage less.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] mysql Index table

2004-12-16 Thread Yemi Obembe
just want to know if mysql automatically update an index table if new datas are 
inserted into the original table. for example, if i insert a row of data to a 
table I'have already created an index table for, would mysql add the row to the 
table?



-

A passion till tomorrow,
Opeyemi Obembe | ng.clawz.com






-
Do you Yahoo!?
 Yahoo! Mail - 250MB free storage. Do more. Manage less.

RE: [PHP-DB] MYSQL Maximum Time Exceeded

2004-12-15 Thread Jason Walker


This not be what you need, but I think there are some squiggle brackets
missing.

$conexion = mysql_connect(servername,username,password);

?php

If (!$conexion){
Echo Error connecting.;
}

?

Again, I don't think this is the root of the problem but it's the first
thing that popped out to me without knowing much more about your system.

Have you been able to connect to your mySQL instance with PHP before? With
no root password?

BTW - I have installed PHP and mySQL on WinXP in the past and it worked
fine. One caveat is that I recall using Apache not IIS. 

-Original Message-
From: PHPDiscuss - PHP Newsgroups and mailing lists
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 15, 2004 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MYSQL Maximum Time Exceeded

Hi.

I am running MySQL 4.0 and PHP 4.3.9 (MySQL Client Version 3.9.23) in
Windows XP.  I get this error when I try to connect to mysql:

Fatal error: Maximum execution time of 60 seconds exceeded in
c:\inetpub\wwwroot\index.php on line 4

My PHP script is:

html
body
?php
$conexion = mysql_connect( localhost, root,  );
if (!$conexion )
  echo Error Connecting.

?
/body
/html

I also tried installing newer PHP versios and newer MySQL but it's the
same.  Can anybody help me, please ?  Is WinXP incomaptible with MySQL or
what ?

Thanks in advance.

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



-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004

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



RE: [PHP-DB] MYSQL Maximum Time Exceeded

2004-12-15 Thread Bastien Koert
no, mysql will work fine with iis, use it at work and use it at home that 
way, though have recently switched to apache

what web server are you running?
try
$conexion = mysql_connect( localhost, root,  ) or die (can't 
connect.mysql_error);
to give more info about the connection


From: Jason Walker [EMAIL PROTECTED]
To: 'PHPDiscuss - PHP Newsgroups and mailing lists' 
[EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: RE: [PHP-DB] MYSQL Maximum Time Exceeded
Date: Wed, 15 Dec 2004 19:06:01 -0700


This not be what you need, but I think there are some squiggle brackets
missing.
$conexion = mysql_connect(servername,username,password);
?php
If (!$conexion){
Echo Error connecting.;
}
?
Again, I don't think this is the root of the problem but it's the first
thing that popped out to me without knowing much more about your system.
Have you been able to connect to your mySQL instance with PHP before? With
no root password?
BTW - I have installed PHP and mySQL on WinXP in the past and it worked
fine. One caveat is that I recall using Apache not IIS.
-Original Message-
From: PHPDiscuss - PHP Newsgroups and mailing lists
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 15, 2004 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MYSQL Maximum Time Exceeded
Hi.
I am running MySQL 4.0 and PHP 4.3.9 (MySQL Client Version 3.9.23) in
Windows XP.  I get this error when I try to connect to mysql:
Fatal error: Maximum execution time of 60 seconds exceeded in
c:\inetpub\wwwroot\index.php on line 4
My PHP script is:
html
body
?php
$conexion = mysql_connect( localhost, root,  );
if (!$conexion )
  echo Error Connecting.
?
/body
/html
I also tried installing newer PHP versios and newer MySQL but it's the
same.  Can anybody help me, please ?  Is WinXP incomaptible with MySQL or
what ?
Thanks in advance.
--
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MySQL error...

2004-12-13 Thread Norland, Martin
 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] 
   No...  That is just some strange error generated by the cut and
paste.  The IS NOT NU LL that is...
   The other issue with 'tablename'...  I simply typed 'tablename'
in the e-mail because I didn't remember the exact tablename when I was
typing the e-mail.  It does actually provide the name of the table that
the script is working with.

It's very hard to diagnose a problem - unless it's blindingly obvious -
without the exact error, as well as any code which could be contributing
to it.  It's best to cut and paste wherever possible - and if anything
must be 'hidden' to obviously hide it and make note of the replacement.
Just like Johan K# would do.

* K# name has been changed to protect the guilty - in my 'code' it
is typed normally.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MySQL error...

2004-12-10 Thread Norland, Martin
 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] 
   I have been using a PHP page to update a database table for a
long time now.  
 Unfortunately, I have noticed that frequently when I perform an update
I get back an error
 saying Table 'tablename' doesn't exist.  This is becoming more and
more annoying.
[snip]
 $query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime
IS NOT NU LL AND ctime 
 IS NULL ORDER BY rtime ASC; $result = mysql_query($query, $Prod) or
die(mysql_error()); ?
snip

Strange behavior, can't say I've ever heard of/seen it - however...

IS NOT NU LL is not, strictly speaking, valid sql.  If that's not just
a weird line wrapping issue - that may point to part of your problem.

If the error you're getting back is literally Table 'tablename' doesn't
exist - then you're looking in the wrong code, and somewhere you have
code that says tablename instead of $tablename.  You may want to
grep for tablename to try to track that down.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] MySQL error...

2004-12-10 Thread NIPP, SCOTT V \(SBCSI\)
No...  That is just some strange error generated by the cut and
paste.  The IS NOT NU LL that is...
The other issue with 'tablename'...  I simply typed 'tablename'
in the e-mail because I didn't remember the exact tablename when I was
typing the e-mail.  It does actually provide the name of the table that
the script is working with.
Thanks for the feedback.

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



-Original Message-
From: Norland, Martin [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 10, 2004 2:34 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL error...


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] 
   I have been using a PHP page to update a database table for a
long time now.  
 Unfortunately, I have noticed that frequently when I perform an update
I get back an error
 saying Table 'tablename' doesn't exist.  This is becoming more and
more annoying.
[snip]
 $query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime
IS NOT NU LL AND ctime 
 IS NULL ORDER BY rtime ASC; $result = mysql_query($query, $Prod) or
die(mysql_error()); ?
snip

Strange behavior, can't say I've ever heard of/seen it - however...

IS NOT NU LL is not, strictly speaking, valid sql.  If that's not just
a weird line wrapping issue - that may point to part of your problem.

If the error you're getting back is literally Table 'tablename' doesn't
exist - then you're looking in the wrong code, and somewhere you have
code that says tablename instead of $tablename.  You may want to
grep for tablename to try to track that down.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

-- 
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] MySQL error...

2004-12-10 Thread NIPP, SCOTT V \(SBCSI\)
I have been using a PHP page to update a database table for a
long time now.  Unfortunately, I have noticed that frequently when I
perform an update I get back an error saying Table 'tablename' doesn't
exist.  This is becoming more and more annoying.  The table obviously
exists as the page that I hit the update button on is populated from
this same page.  Additionally, if I backout and reload the page most of
the time it will work.  Any help would be greatly appreciated.

Mysql   3.23.49
PHP 4.2.3

?php require_once('useraccounts.lib.php');
session_start();
if (!isset($_SESSION['valid_user']))
{
  echo You must be logged in to use this application.  br;
  $return_url = $_SERVER['PHP_SELF'];
  session_register(return_url);
  echo Please a href=\../sa_login.php\ login/a now.  br;
  exit();
} else {
  $sbcuid = $valid_user;
}
while(isset($entry[0])) {
  $tmp = $entry[0];
  $update = UPDATE accounts SET ctime=NOW() WHERE id_sys='.$tmp.';
  $results = mysql_query($update, $Prod) or die(mysql_error());
  array_shift($entry);
}
mysql_select_db($database, $Prod);
$query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime
IS NOT NU
LL AND ctime IS NULL ORDER BY rtime ASC;
$result = mysql_query($query, $Prod) or die(mysql_error());
?

html
head
titleSBCLD User Account Request System/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body bgcolor=#CC
p align=centerfont color=#0033CC
size=6strongAdministration/strong
/font/p
p align=centerfont size=4Here are the details for the accounts
approved
and pending creation:/font/p
p align=center

form method=post action=account_details.php
table width=90% bgcolor=#CC cellspacing=0
  tr bordercolor=#CC
td width=20% height=23div align=centerfont
color=#CC size=
3Requesting
  User/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCSyste
m/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCPrima
ry Group/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCD
efault Shell/font/div/td
td width=30% valign=topdiv align=centerfont
color=#CCReque
st Time/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCC
ompleted/font/div/td
  /tr

?php
  do {
$entry = $list['id_sys'];
$id = split('-', $list['id_sys']);
$sbcuid = $id[0];
$sys = $id[1];
if (isset($list['id_sys'])) {
  echo trtd width=\20%\div
align=\center\.$sbcuid./div/t
d;
  echo td width=\10%\div
align=\center\.$sys./div/td;
  echo td width=\15%\div
align=\center\.$list['gid']./div/
td;
  echo td width=\15%\div
align=\center\.$list['shell']./div
/td;
  echo td width=\30%\div
align=\center\.$list['atime']./div
/td;
  echo td width=\10%\div align=\center\input
name=\entry[]\
type=\checkbox\ value=$entry/div/td/tr;
}
  } while ($list = mysql_fetch_assoc($result));
?

/table

  p align=centerPlacing a check in the completed box will update the
databas
e entry for
this request with a completed time and remove this entry from this
page upon
clicking the Update button below./p
  div align=center
  input type=submit value=Update
  /div
/form

/body
/html

Thanks in advance.  This is really beginning to bug the crap out
of me.

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

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


[PHP-DB] mySQL - can connect with mysqlcc but not PHP code

2004-12-03 Thread Bryan Green
So here's the problem: I can connect to a mySQL database on localhost just
fine with a PHP test script I've written, but I cannot connect to a remote
server, even though I can connect to the remote server just fine with
mySQL Control Center. Anybody have any suggestions? Here's a snippet of my
code, if it helps:

--- 
@ $db = mysql_pconnect($myhost, $myuser, $mypass); 
if (!$db) 
{
echo Error: could not connect to DB.; exit;
}
mysql_select_db(test);
echo Connection established!;
--- 

And I have verified that the variables $myhost, $myuser, and $mypass
contain the correct connection data.

Thanks a million!
Bryan Green

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



RE: [PHP-DB] mySQL - can connect with mysqlcc but not PHP code

2004-12-03 Thread Bastien Koert
do you have the same user with the same permissions as the mysql cc user?
bastien
From: Bryan Green [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mySQL - can connect with mysqlcc but not PHP code
Date: Fri, 03 Dec 2004 12:52:53 -0800
So here's the problem: I can connect to a mySQL database on localhost just
fine with a PHP test script I've written, but I cannot connect to a remote
server, even though I can connect to the remote server just fine with
mySQL Control Center. Anybody have any suggestions? Here's a snippet of my
code, if it helps:
---
@ $db = mysql_pconnect($myhost, $myuser, $mypass);
if (!$db)
{
   echo Error: could not connect to DB.; exit;
}
mysql_select_db(test);
echo Connection established!;
---
And I have verified that the variables $myhost, $myuser, and $mypass
contain the correct connection data.
Thanks a million!
Bryan Green
--
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 db dump with php

2004-11-17 Thread Nate Nielsen
I tried this but to no avail.  What I surmise is that one of the following
is holding this up from being an option.

1) I'm on a shared server so I will have to specify the location of the file
to save in order to get to it afterwards.  I tried specifying the path and
the file name in the examples below but didn't get the resulting file as I
expected.

2) Its possible that the web server does not have the command available as
the mysql server is on another box, thus I won't be able to execute it.  I
am not familiar with mysql, so I'm not sure if this could be the case, is it
possible to have the drivers and not the supporting utilities installed?

3) Somehow shell execution is not enabled (exec()).  I do not think this is
the case as I am not thrown an error.  It would be possible though I would
think that the php script process doesn't have access to execute that
process maybe?

Any suggestions or another method? 

Thanks a ton!

Nate 
[EMAIL PROTECTED]


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 17, 2004 12:11 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql db dump with php

On Wednesday 17 November 2004 13:51, Nate Nielsen wrote:

 i need a script that will connect to a db with a username and password,
and
 then export to the screen scripts to both recreate the database structure
 (the create table commands) and then create insert statements to populate
 that information into the database.  then of course, i need to run those
 scripts on the other server to create the db and populate it.

From the command line of the system holding source database:

  mysqldump --opt -u username -p password nameofdatabase 
nameofdatabase.sql

Now take the created file nameofdatabase.sql and place onto the system
holding 
destination database. Then from the command line of the system holding 
destination database:

  mysql -u username -p password  nameofdatabase.sql

If you don't have direct access to the command line use php's program 
execution functions.

 if you can hook me up i'll paypal you $20 bucks to buy you and yours a few
 pints of your favorite ale on me.

Donate it to your local Red Cross/Red Crescent or equivalent.

-- 
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
--
/*
Logoff in progress...
*/

-- 
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 db dump with php

2004-11-17 Thread dpgirago
Nate,

Don't know if this is the case or not, but the destination database has to 
already exist on the upload server.

dave






Nate Nielsen [EMAIL PROTECTED]

11/17/2004 10:08 AM



 

To:
[EMAIL PROTECTED]
cc:





Subject:
RE: [PHP-DB] mysql db dump with php



I tried this but to no avail.  What I surmise is that one of the following
is holding this up from being an option.

1) I'm on a shared server so I will have to specify the location of the 
file
to save in order to get to it afterwards.  I tried specifying the path and
the file name in the examples below but didn't get the resulting file as I
expected.

2) Its possible that the web server does not have the command available as
the mysql server is on another box, thus I won't be able to execute it.  I
am not familiar with mysql, so I'm not sure if this could be the case, is 
it
possible to have the drivers and not the supporting utilities installed?

3) Somehow shell execution is not enabled (exec()).  I do not think this 
is
the case as I am not thrown an error.  It would be possible though I would
think that the php script process doesn't have access to execute that
process maybe?

Any suggestions or another method? 

Thanks a ton!

Nate 
[EMAIL PROTECTED]


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 17, 2004 12:11 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql db dump with php

On Wednesday 17 November 2004 13:51, Nate Nielsen wrote:

 i need a script that will connect to a db with a username and password,
and
 then export to the screen scripts to both recreate the database 
structure
 (the create table commands) and then create insert statements to 
populate
 that information into the database.  then of course, i need to run those
 scripts on the other server to create the db and populate it.

From the command line of the system holding source database:

  mysqldump --opt -u username -p password nameofdatabase 
nameofdatabase.sql

Now take the created file nameofdatabase.sql and place onto the system
holding 
destination database. Then from the command line of the system holding 
destination database:

  mysql -u username -p password  nameofdatabase.sql

If you don't have direct access to the command line use php's program 
execution functions.

 if you can hook me up i'll paypal you $20 bucks to buy you and yours a 
few
 pints of your favorite ale on me.

Donate it to your local Red Cross/Red Crescent or equivalent.

-- 
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
--
/*
Logoff in progress...
*/

-- 
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 db dump with php

2004-11-17 Thread Bastien Koert
if you have access to phpmyadmin, use that to dump the table and then 
re-import the created files in the server

bastien

From: Nate Nielsen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] mysql db dump with php
Date: Wed, 17 Nov 2004 10:08:43 -0600
I tried this but to no avail.  What I surmise is that one of the following
is holding this up from being an option.
1) I'm on a shared server so I will have to specify the location of the 
file
to save in order to get to it afterwards.  I tried specifying the path and
the file name in the examples below but didn't get the resulting file as I
expected.

2) Its possible that the web server does not have the command available as
the mysql server is on another box, thus I won't be able to execute it.  I
am not familiar with mysql, so I'm not sure if this could be the case, is 
it
possible to have the drivers and not the supporting utilities installed?

3) Somehow shell execution is not enabled (exec()).  I do not think this is
the case as I am not thrown an error.  It would be possible though I would
think that the php script process doesn't have access to execute that
process maybe?
Any suggestions or another method?
Thanks a ton!
Nate
[EMAIL PROTECTED]
-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 17, 2004 12:11 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql db dump with php
On Wednesday 17 November 2004 13:51, Nate Nielsen wrote:
 i need a script that will connect to a db with a username and password,
and
 then export to the screen scripts to both recreate the database 
structure
 (the create table commands) and then create insert statements to 
populate
 that information into the database.  then of course, i need to run those
 scripts on the other server to create the db and populate it.

From the command line of the system holding source database:
  mysqldump --opt -u username -p password nameofdatabase 
nameofdatabase.sql
Now take the created file nameofdatabase.sql and place onto the system
holding
destination database. Then from the command line of the system holding
destination database:
  mysql -u username -p password  nameofdatabase.sql
If you don't have direct access to the command line use php's program
execution functions.
 if you can hook me up i'll paypal you $20 bucks to buy you and yours a 
few
 pints of your favorite ale on me.

Donate it to your local Red Cross/Red Crescent or equivalent.
--
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
--
/*
Logoff in progress...
*/
--
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-DB] MySQL Data Not Returned

2004-11-13 Thread Wendell Frohwein
Hi all, I have this really strange problem. Apache 2.0.50, MySQL 4.1.4a,
and PHP 5.0.2.
 
I have about 7000 records in a table called mailinglist, I will show you
the sql to build the table:
 
CREATE TABLE `mailinglist` (
  `id` int(20) NOT NULL auto_increment,
  `active` char(1) NOT NULL default '1',
  `sent` char(1) NOT NULL default '0',
  `isp` varchar(2) NOT NULL default '0',
  `fname` varchar(30) NOT NULL default '',
  `lname` varchar(30) NOT NULL default '',
  `office` varchar(100) NOT NULL default '',
  `fax` varchar(30) NOT NULL default '',
  `cellular` varchar(30) NOT NULL default '',
  `type` varchar(20) NOT NULL default '',
  `office_name` varchar(100) NOT NULL default '',
  `address` varchar(255) NOT NULL default '',
  `suite` varchar(20) NOT NULL default '',
  `city` varchar(255) NOT NULL default '',
  `state` varchar(2) NOT NULL default '',
  `zip` mediumint(5) unsigned zerofill NOT NULL default '0',
  `email` varchar(255) NOT NULL default '',
  `new_id` int(20) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
So now that you know the details, here is the problem.
 
I search the list like so:
 
$email=[EMAIL PROTECTED];
$query=mysqli_query($cnn,SELECT * FROM mailinglist WHERE
email='$email');
 
When I do:
 
Echo mysqli_num_rows($query);
 
I get 0 back, The address I am searching is in the database, I have
triple checked it with phpmyadmin.
The only way I can get it to return the record I am looking for is to do
this.
 
$email=[EMAIL PROTECTED];
$query=mysqli_query($cnn,SELECT * FROM mailinglist WHERE email like
'$email%');
 
Then this finally returns 1. I have tried many different email
addresses; nothing comes back, not even from the SQL query window within
phpmyadmin v. 2.6.0-rc2
 
This has been puzzling me for hours on end. If anyone can provide any
help, that would be great
 
 
-Wendell Frohwein


Re: [PHP-DB] MySQL problem..

2004-11-10 Thread Leo G. Divinagracia III
okay.. i'm stumped.  what client libraries?
using php 5, so is it php_mysql.dll???
i'm using a canned script, so i have to make the changes there too?
i checked out the mysql help link.  i even started the mysqld with the 
--old-passwords parameter...

still getting the error...
thanks...
Bastien Koert wrote:
Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If 
so you need to update the client libraries that come with mysql. There 
are significant protocol changes from 4.0x to  4.1.

Bastien
From: ian [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem..
Date: Mon, 08 Nov 2004 17:02:53 +
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
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] MySQL problem..

2004-11-08 Thread ian
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15

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



RE: [PHP-DB] MySQL problem..

2004-11-08 Thread Bastien Koert
Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If so 
you need to update the client libraries that come with mysql. There are 
significant protocol changes from 4.0x to  4.1.

Bastien
From: ian [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem..
Date: Mon, 08 Nov 2004 17:02:53 +
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15
--
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 problem..

2004-11-08 Thread Doug Thompson
ian wrote:
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15
http://dev.mysql.com/doc/mysql/en/Old_client.html
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MySQL problem..

2004-11-08 Thread ian
thnx ya'll... :)

On Mon, 2004-11-08 at 17:52, Bastien Koert wrote:
 Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If so 
 you need to update the client libraries that come with mysql. There are 
 significant protocol changes from 4.0x to  4.1.
 
 Bastien
 
 From: ian [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MySQL problem..
 Date: Mon, 08 Nov 2004 17:02:53 +
 
 Any body met this error?
 Warning: mysql_connect(): Client does not support authentication
 protocol requested by server; consider upgrading MySQL client in
 /usr/local/apache2/html/poems/browse.php on line 15
 
 --
 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] MySQL data harvester

2004-11-02 Thread Perry, Matthew (Fire Marshal's Office)
My office purchased 21 fascinating cell phones that have GPS locaters and
bar codes.  

 

When we scan a bar code with one of these cell phones, the data is sent to a
third party company; information about this scan is stored on their
database.  

I have installed a harvester on my pc that downloads this data off of the
third party database into my own MySQL database.

I want to link this data with my other tables to modify my inventory
information.

 

What is the best way to continuously update all tables when new transactions
occur?  With MS SQL Server or ORACLE I would write a stored procedure or
trigger that could do this.  

What tools can I use with MySQL instead of procedures or triggers?

 

Matthew



RE: [PHP-DB] MySQL data harvester

2004-11-02 Thread Bastien Koert
write a script that will access the information, then use a CRON to schedule 
the collection at whatever intervals suite your needs.

Bastien
From: Perry, Matthew (Fire Marshal's Office) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL data harvester
Date: Tue, 2 Nov 2004 10:05:50 -0600
My office purchased 21 fascinating cell phones that have GPS locaters and
bar codes.

When we scan a bar code with one of these cell phones, the data is sent to 
a
third party company; information about this scan is stored on their
database.

I have installed a harvester on my pc that downloads this data off of the
third party database into my own MySQL database.
I want to link this data with my other tables to modify my inventory
information.

What is the best way to continuously update all tables when new 
transactions
occur?  With MS SQL Server or ORACLE I would write a stored procedure or
trigger that could do this.

What tools can I use with MySQL instead of procedures or triggers?

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


[PHP-DB] Mysql Function to display number of records

2004-11-02 Thread Jovan Ross
I have a query that uses a LIMIT clause. Let's say it looks like this:
SELECT * FROM blah WHERE something0 LIMIT 5;
Ok, now my table really has 20 rows that satisfy the WHERE statement but I 
only retrieved 5. There was a function/statement that I could use to find 
out the total number of rows that would have been returned had I not used 
the LIMIT clause. Does anyone know what the statement was? I forget.

Yes, I'm using PHP btw.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Mysql Function to display number of records

2004-11-02 Thread Bastien Koert
use the offset parameter
$offset = 0;  //and is set from the application
SELECT * FROM blah WHERE something0 LIMIT $offset , 5;
bastien
From: [EMAIL PROTECTED] (Jovan Ross)
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Mysql Function to display number of records
Date: 2 Nov 2004 20:28:41 -
I have a query that uses a LIMIT clause. Let's say it looks like this:
SELECT * FROM blah WHERE something0 LIMIT 5;
Ok, now my table really has 20 rows that satisfy the WHERE statement but I 
only retrieved 5. There was a function/statement that I could use to find 
out the total number of rows that would have been returned had I not used 
the LIMIT clause. Does anyone know what the statement was? I forget.

Yes, I'm using PHP btw.
--
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] MySQL backup software

2004-10-27 Thread Perry, Matthew (Fire Marshal's Office)
Does anyone know a free MySQL backup program to schedule regular backups?



Re: [PHP-DB] MySQL backup software

2004-10-27 Thread Jason Wong
On Wednesday 27 October 2004 13:57, Perry, Matthew (Fire Marshal's Office) 
wrote:
 Does anyone know a free MySQL backup program to schedule regular backups?

  www.mysql.com

  google  mysql mailing list

-- 
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
--
/*
Sigh.  I like to think it's just the Linux people who want to be on
the leading edge so bad they walk right off the precipice.
(Craig E. Groeschel)
*/

-- 
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-27 Thread Norland, Martin
You were on the right track with mysqldump.  Windows doesn't have a
direct cron equivalent - but it does have the ability to schedule tasks.
Write a short batch file or equivalent (you should be able to whip one
together in no time with a little googling) and schedule it to run.

I doubt you'll find a tool that does exactly what you want that's any
more advanced or configurable - there's just no need.  That said - who
knows, people make all kinds of software to fill what others perceive as
unneeded.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Perry, Matthew (Fire Marshal's Office)
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 8:58 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL backup software


Does anyone know a free MySQL backup program to schedule regular
backups?

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



Re: [PHP-DB] mysql error and resource ID:

2004-10-18 Thread John Holmes
Stuart Felenstein wrote:
First time setting something like this up. So probably
making some major mistakes.
Anyway I get this message : mysql_error(Resource id
#2)
[snip]
echo  . mysql_error($link);
Read the above line or use an editor that does syntax highlighting. 
Also, you'll want to get the error before you run the rollback() function.

--
---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] MySQL max records

2004-10-17 Thread ApexEleven
thanks a lot, that's just about what i needed to hear


On Sat, 16 Oct 2004 11:00:25 -0400, Bastien Koert [EMAIL PROTECTED] wrote:
 Have a look at some of the case studies at mysql.comthere are servers
 handling 50Million records with not problemsat a certain point it
 becomes more a hardware issue than a db server issue...
 
 bastien
 
 From: -{ Rene Brehmer }- [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL max records
 Date: Sat, 16 Oct 2004 02:01:07 +0200
 
 
 
 How many records it can hold before becoming too slow for practical use
 depends entirely of the hardware that makes up the server.
 
 Current versions of MySQL has a finite limit of 2^64 records per table, but
 how many billion records you can shove into it before you start seeing
 performance issues depends on the RAM size, the RAM/CPU roundtrip speed,
 and the pure processing power of the CPUs, as well as the overall load of
 the server. Obviously dedicated DB servers/clusters will be able to handle
 alot higher record counts than mixed-purpose servers.
 
 
 Rene
 
 At 01:32 16-10-2004, ApexEleven wrote:
 I tried a little research on the mysql list but didn't find what I was
 looking for.What is the limit of a MySQL database? How many hundreds
 of thousands of records can a database hold before it gets too
 sluggish to work on a production server?
 
 thanks,
 
 --
 Rene Brehmer
 aka Metalbunny
 
 If your life was a dream, would you wake up from a nightmare, dripping of
 sweat, hoping it was over? Or would you wake up happy and pleased, ready to
 take on the day with a smile?
 
 http://metalbunny.net/
 References, tools, and other useful stuff...
 Check out the new Metalbunny forums at http://forums.metalbunny.net/
 
 --
 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
 
 


-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



Re: [PHP-DB] MySQL max records

2004-10-16 Thread Bastien Koert
Have a look at some of the case studies at mysql.comthere are servers 
handling 50Million records with not problemsat a certain point it 
becomes more a hardware issue than a db server issue...

bastien

From: -{ Rene Brehmer }- [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL max records
Date: Sat, 16 Oct 2004 02:01:07 +0200
How many records it can hold before becoming too slow for practical use 
depends entirely of the hardware that makes up the server.

Current versions of MySQL has a finite limit of 2^64 records per table, but 
how many billion records you can shove into it before you start seeing 
performance issues depends on the RAM size, the RAM/CPU roundtrip speed, 
and the pure processing power of the CPUs, as well as the overall load of 
the server. Obviously dedicated DB servers/clusters will be able to handle 
alot higher record counts than mixed-purpose servers.

Rene
At 01:32 16-10-2004, ApexEleven wrote:
I tried a little research on the mysql list but didn't find what I was
looking for.What is the limit of a MySQL database? How many hundreds
of thousands of records can a database hold before it gets too
sluggish to work on a production server?
thanks,
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
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] MySQL nested subqueries

2004-10-16 Thread Matthew Perry
Anyone know when there will be a version of MySQL that can handle nested 
subqueries?
-Matt

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


Re: [PHP-DB] MySQL nested subqueries

2004-10-16 Thread lists
Matthew Perry wrote:
Anyone know when there will be a version of MySQL that can handle nested 
subqueries?
-Matt

http://dev.mysql.com/doc/mysql/en/ANSI_diff_Subqueries.html
v4.1, but it isn't the stable release at this time.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySQL max records

2004-10-15 Thread ApexEleven
I tried a little research on the mysql list but didn't find what I was
looking for.What is the limit of a MySQL database? How many hundreds
of thousands of records can a database hold before it gets too
sluggish to work on a production server?

thanks,

-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



Re: [PHP-DB] MySQL max records

2004-10-15 Thread -{ Rene Brehmer }-
How many records it can hold before becoming too slow for practical use 
depends entirely of the hardware that makes up the server.

Current versions of MySQL has a finite limit of 2^64 records per table, but 
how many billion records you can shove into it before you start seeing 
performance issues depends on the RAM size, the RAM/CPU roundtrip speed, 
and the pure processing power of the CPUs, as well as the overall load of 
the server. Obviously dedicated DB servers/clusters will be able to handle 
alot higher record counts than mixed-purpose servers.

Rene
At 01:32 16-10-2004, ApexEleven wrote:
I tried a little research on the mysql list but didn't find what I was
looking for.What is the limit of a MySQL database? How many hundreds
of thousands of records can a database hold before it gets too
sluggish to work on a production server?
thanks,
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MySQL max records

2004-10-15 Thread John Holmes
ApexEleven wrote:
I tried a little research on the mysql list but didn't find what I was
looking for.What is the limit of a MySQL database? How many hundreds
of thousands of records can a database hold before it gets too
sluggish to work on a production server?
Check the output from phpinfo()... I'm pretty sure the value is in there.
--
---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] mysql error and resource ID:

2004-10-14 Thread Graham Cossey

See PHP manual  Chapter 6. Types  Strings

for an explanation of single  double quotes.

From the doc:

If the string is enclosed in double-quotes (), PHP understands more escape
sequences for special characters

But the most important feature of double-quoted strings is the fact that
variable names will be expanded.

In your case it would be ' within .

$query = INSERT INTO MainTable (RecordID,UserID,.)
values(null,null,'$f1a','$f2a',...);

Graham.

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 14 October 2004 15:43
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] mysql error and resource ID:


 Quote as in string or quote as in 'string' ?
 Those two confuse me.

 Stuart
 --- [EMAIL PROTECTED] wrote:

  If any of the variables used to insert data are
  strings ($f1a, $f2a,
  etc...), you'll need to have quotes around them.
 
  dave
 
 
 
 
 
 
  Stuart Felenstein [EMAIL PROTECTED]
 
  10/14/2004 08:26 AM
 
 
 
 
 
  To:
  Graham Cossey [EMAIL PROTECTED],
  [EMAIL PROTECTED]
  cc:
 
 
 
 
 
  Subject:
  RE: [PHP-DB] mysql error and resource ID:
 
 
 
  Not much luck here on placing the
  mysql_error($link);
  I know the server and database is reachable. So I
  imagine the error is happening in the query.  I've
  moved the $link around with no luck.
 
  Stuart
 
  Revised code below:
  --- Graham Cossey [EMAIL PROTECTED] wrote:
 
  ?php
 
  function begin()
  {
  mysql_query(BEGIN);
  }
  function commit()
  {
  mysql_query(COMMIT);
  }
  function rollback()
  {
  mysql_query(ROLLBACK);
  }
  mysql_connect(myserver,myusername, mypassword)
  or die(mysql_error());
 
  mysql_select_db(mydatabase) or die(mysql_error());
 
  $query = INSERT INTO MainTable
  (RecordID,UserID,.)
  values
 
 (null,null,$f1a,$f2a,$f2c,$f2d,$f2e,$f2g,$f5b,$f3m,$f3n,$f3e,$f3f,
 $f3g,$f3h,$f3i,$f3j,
  $f3k,$f3l);
  begin(); // transaction begins
  $result = @mysql_query($query, $link);
 
  if(!$result)
  {
  rollback(); // transaction rolls back
  echo You rolled back .mysql_error($link);
  exit;
  }
  else
  {
  commit(); // transaction is committed
  echo your insertion was successful;
  }
  ?
 
  --
  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] mysql error and resource ID:

2004-10-14 Thread Stuart Felenstein
Anyone see something wrong here :

My error message is :

0: 1064: 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
'd',1,'d',1,1, 31, 33,10/15/2004))' at
line 5

Code:

$query = INSERT INTO MainTable (RecordID,UserID,other
fields..)
values
(null,null,'$f1a',$f2a,$f2c,$f2d,$f2e,$f2g,'$f5b','$f3m','$f3n,'$f3e',$f3f,'$f3g',$f3h,$f3i,
$f3j, $f3k,$f3l)); //not sure if the double ) is
//needed though it doesn't make a diff
begin(); // transaction begins
$result = mysql_query($query);

--- Stuart Felenstein [EMAIL PROTECTED] wrote:

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



RE: [PHP-DB] mysql error and resource ID:

2004-10-14 Thread Stuart Felenstein
Yes, actually my apologies to everyone. I figured out
the error.  
So  , yep, I'm down to a problem with the date.
The column is set to date.  I'll go ahead and add the
quotes.

Stuart
--- [EMAIL PROTECTED] wrote:

 Stuart,
 
 The date has forward slashes. These are not
 integers, right? So put single 
 quotes around the whole date, like '10/15/2004'.
 
 dave
 
 
 
 
 
 Stuart Felenstein [EMAIL PROTECTED]
 
 10/14/2004 10:02 AM
 
 
 
  
 
 To:
 Stuart Felenstein [EMAIL PROTECTED]
 cc:
 [EMAIL PROTECTED]
 
 
 
 
 Subject:
 RE: [PHP-DB] mysql error and resource ID:
 
 
 
 Anyone see something wrong here :
 
 My error message is :
 
 0: 1064: 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
 'd',1,'d',1,1, 31, 33,10/15/2004))' at
 line 5
 
 Code:
 
 $query = INSERT INTO MainTable
 (RecordID,UserID,other
 fields..)
 values

(null,null,'$f1a',$f2a,$f2c,$f2d,$f2e,$f2g,'$f5b','$f3m','$f3n,'$f3e',$f3f,'$f3g',$f3h,$f3i,
 $f3j, $f3k,$f3l)); //not sure if the double ) is
 //needed though it doesn't make a diff
 begin(); // transaction begins
 $result = mysql_query($query);
 
 --- Stuart Felenstein [EMAIL PROTECTED] wrote:
 
 -- 
 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



<    1   2   3   4   5   6   7   8   9   10   >