[PHP-DB] how to connect to dbase

2004-10-15 Thread Swapan Mazumdar
Hi All,

I am quite new to php. I have a requirement to query dbase file to
implement searching on table columns. Now I am following a basic
approach using dbase_get_record_with_names($fileHandler,
$iterationIndex). This seems to be a rudimentary approach and has
performance bottleneck. For the purpose of   paging this is a big
stopper. 
I request php guys to show me how to use Connection to fire a query. I
am afraid I can't use system dsn since the underline dbase file could be
dynamic. Pl. suggest me how to use direct connection through url or file
dsn. This is in context to web apps development. 

Regards,
Swapan

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



Re: [PHP-DB] Converting Date for mysql

2004-10-15 Thread Stuart Felenstein
See below:
--- John Holmes <[EMAIL PROTECTED]> wrote:

> Are you sure it's the date that's causing the
> rejection? What does 
> mysql_error() say?

No, I'm not sure.  At first the date was being
accepted but "wrong" in the database.  It was setting
it to 1/1/2000.  Someone suggested I add '' around the
value. Apparently it didn't like that and started
saying I had a SQL  error. I've tried a number of
things, so far without success.
This is the current error:

"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 '', 1, 1, 24,
25, 10/28/2004)' at line 5 "  

While this is probably a waste of bandwidth here is my
statement: 

$query = "INSERT INTO
CorrectTableName(RecordID,UserID,ProfileName,
Edu, WorkAuth, WorkExp, CarLev, Secu, Confi, Relo,
Telecomu, 
City1, State1, City2, State2, TravelPref,
SalaryAnnual, SalaryHourly, Available)
VALUES (null, null, '$f1a', $f2a, $f2c, $f2d, $f2e,
$f2g, '$f5b', '$f3m',
'$f3n', '$f3e', $f3f, $f3g', $f3h, $f3i, $f3j, $f3k,
$f3l)";

Outside of the date I don't see where the error could
be coming from.  Fields with quotes are string values.
I have no idea.  

Stuart

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



Re: [PHP-DB] Converting Date for mysql

2004-10-15 Thread David Robley
On Fri, 15 Oct 2004 17:26, Stuart Felenstein wrote:

> See below:
> --- John Holmes <[EMAIL PROTECTED]> wrote:
> 
>> Are you sure it's the date that's causing the
>> rejection? What does
>> mysql_error() say?
> 
> No, I'm not sure.  At first the date was being
> accepted but "wrong" in the database.  It was setting
> it to 1/1/2000.  Someone suggested I add '' around the
> value. Apparently it didn't like that and started
> saying I had a SQL  error. I've tried a number of
> things, so far without success.
> This is the current error:
> 
> "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 '', 1, 1, 24,
> 25, 10/28/2004)' at line 5 "
> 
> While this is probably a waste of bandwidth here is my
> statement:
> 
> $query = "INSERT INTO
> CorrectTableName(RecordID,UserID,ProfileName,
> Edu, WorkAuth, WorkExp, CarLev, Secu, Confi, Relo,
> Telecomu,
> City1, State1, City2, State2, TravelPref,
> SalaryAnnual, SalaryHourly, Available)
> VALUES (null, null, '$f1a', $f2a, $f2c, $f2d, $f2e,
> $f2g, '$f5b', '$f3m',
> '$f3n', '$f3e', $f3f, $f3g', $f3h, $f3i, $f3j, $f3k,
> $f3l)";
> 
> Outside of the date I don't see where the error could
> be coming from.  Fields with quotes are string values.
> I have no idea.

You seem to be missing a single quote at the beginning of $f3g

May I suggest that as well as echoing mysql_error() you also echo your
query; that way you can see _exactly_ what is being passed to mysql and you
can resolve problems like this simply and without resorting to the mailing
list.

-- 
David Robley

Terminal glare: A look that kills...

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



Re: [PHP-DB] Converting Date for mysql

2004-10-15 Thread Stuart Felenstein
Yes, my apologies to the list!

Stuart
--- David Robley <[EMAIL PROTECTED]> wrote:


> May I suggest that as well as echoing mysql_error()
> you also echo your
> query; that way you can see _exactly_ what is being
> passed to mysql and you
> can resolve problems like this simply and without
> resorting to the mailing
> list.
> 
> -- 
> David Robley
> 

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



[PHP-DB] pdf

2004-10-15 Thread balwantsingh
hi all,

i want to how i can save the data retrieved from mysql through php in pdf
format.

thanks for your help in advance.

with best wishes
balwant


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

Re: [PHP-DB] Help: Transactions not working

2004-10-15 Thread John Holmes
Stuart Felenstein wrote:
But - I want to confirm, am I still using transactions
even though I'm issuing individual query calls for
each insert.
Yes, that's the idea. Everthing between BEGIN and COMMIT/ROLLBACK is the 
transaction.

In this line (from the second insert)
VALUES (null, LAST_INSERT_ID(), ..)";
The LAST_INSERT_ID works great here, getting the
auto-inc from the first insert, but will it work in
subsequent insertions to other tables.
I ask because in the second insert (shown), the
LAST_INSERT_ID, gets the value from the first table,
but the second table (second insert) also has an
auto-inc column.  So I'm thinking then the third
insert will get the LAST_INSERT_ID from table 2 / 2nd
insert.  
Yes, that's what will happen. LAST_INSERT_ID() picks up the last 
auto_increment number created.

Perhaps I need to declare it the first time as a value
(app code) or add "where" conditions to all the
subsequent insertions ?
You can get the auto_increment number using mysql_insert_id(), save it 
in a variable and then use that in subsequent queries.

$query1 = "INSERT INTO ... ";
$id = mysql_insert_id();
$query2 = "INSERT INTO (id,...) VALUES ($id,...)";
$query3 = "INSERT INTO (id,...) VALUES ($id,...)";
etc...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Help: Transactions not working

2004-10-15 Thread Stuart Felenstein
If you see the code I have the begin , then the $query
follows.  With both statements present, only the
second one does the insert. If I // or remove the
second, the first one takes.  

Am I missing something here ?

Stuart

Code:

function begin()
{
mysql_query("BEGIN");
}
function commit()
{
mysql_query("COMMIT");
}
function rollback()
{
mysql_query("ROLLBACK");
}
mysql_connect("...relevant information") or
die(mysql_error());
$link = mysql_connect("...relevant information"); 
mysql_select_db("database", $link) or
die(mysql_error());
echo mysql_errno($link) . ": " . mysql_error($link).
"\n";

begin(); // transaction begins

$query = "INSERT INTO Profiles (ProfileID, UserID,
ProfileName,
Edu, WorkAuth, WorkExp, CarLev, Secu, Confi, Relo,
Telecomu, 
City1, State1, City2, State2, TravelPref,
SalaryAnnual, SalaryHourly, Available)
VALUES (null, null, '$f1a', $f2a, $f2c, $f2d, $f2e,
$f2g, '$f5b', '$f3m',
'$f3n', '$f3e', $f3f, '$f3g', $f3h, $f3i, $f3j, $f3k,
$f3l)";

echo $query;

$query = "INSERT INTO LurkProfiles_AddContacts
(AddContID, ProfileID, P1,
P2, Pgr, Eml2, Eml3)
VALUES (null, LAST_INSERT_ID(), '$f1b', '$f1c',
'$f1d', '$f1e', '$f1g')";

echo $query;

$result = mysql_query($query);


if(!$result)
{
echo mysql_errno($link) . ": " . mysql_error($link).
"\n";
rollback(); // transaction rolls back

exit;
}
else
{
commit(); // transaction is committed
echo "your insertion was successful";

}
printf("Last inserted record has id %d\n",
mysql_insert_id());
?>

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



Re: [PHP-DB] Help: Transactions not working

2004-10-15 Thread John Holmes
Stuart Felenstein wrote:
If you see the code I have the begin , then the $query
follows.  With both statements present, only the
second one does the insert. If I // or remove the
second, the first one takes.  

Am I missing something here ?
Yep... you're missing a mysql_query() call for each query. You're only 
running one query and echoing the other...

$query = "INSERT INTO Profiles (ProfileID, UserID,
ProfileName,
Edu, WorkAuth, WorkExp, CarLev, Secu, Confi, Relo,
Telecomu, 
City1, State1, City2, State2, TravelPref,
SalaryAnnual, SalaryHourly, Available)
VALUES (null, null, '$f1a', $f2a, $f2c, $f2d, $f2e,
$f2g, '$f5b', '$f3m',
'$f3n', '$f3e', $f3f, '$f3g', $f3h, $f3i, $f3j, $f3k,
$f3l)";

echo $query;
  $result = mysql_query($query);
$query = "INSERT INTO LurkProfiles_AddContacts
(AddContID, ProfileID, P1,
P2, Pgr, Eml2, Eml3)
VALUES (null, LAST_INSERT_ID(), '$f1b', '$f1c',
'$f1d', '$f1e', '$f1g')";
echo $query;
$result = mysql_query($query);
--
---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] pdf

2004-10-15 Thread mohamad AKL
check this
- Original Message - 
From: "balwantsingh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 15, 2004 11:23 AM
Subject: [PHP-DB] pdf


> hi all,
>
> i want to how i can save the data retrieved from mysql through php in pdf
> format.
>
> thanks for your help in advance.
>
> 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] how to connect to dbase

2004-10-15 Thread Swapan Mazumdar
I can't believe this, my problem doesn't attract any attention.
But I am quite sure that everybody else besides me has more experience
than me in this specific field.
Anyone pl, is my question absurd or just impossible.

-Original Message-
From: Swapan Mazumdar [mailto:[EMAIL PROTECTED] 
Sent: 15 October 2004 09:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] how to connect to dbase
Importance: High

Hi All,

I am quite new to php. I have a requirement to query dbase file to
implement searching on table columns. Now I am following a basic
approach using dbase_get_record_with_names($fileHandler,
$iterationIndex). This seems to be a rudimentary approach and has
performance bottleneck. For the purpose of   paging this is a big
stopper. 
I request php guys to show me how to use Connection to fire a query. I
am afraid I can't use system dsn since the underline dbase file could be
dynamic. Pl. suggest me how to use direct connection through url or file
dsn. This is in context to web apps development. 

Regards,
Swapan

-- 
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] Help: Transactions not working

2004-10-15 Thread Stuart Felenstein
That made a world of difference! :) Thank you.

But - I want to confirm, am I still using transactions
even though I'm issuing individual query calls for
each insert.

And, if I can ask another question to the list : 

In this line (from the second insert)
VALUES (null, LAST_INSERT_ID(), ..)";

The LAST_INSERT_ID works great here, getting the
auto-inc from the first insert, but will it work in
subsequent insertions to other tables.

I ask because in the second insert (shown), the
LAST_INSERT_ID, gets the value from the first table,
but the second table (second insert) also has an
auto-inc column.  So I'm thinking then the third
insert will get the LAST_INSERT_ID from table 2 / 2nd
insert.  

Perhaps I need to declare it the first time as a value
(app code) or add "where" conditions to all the
subsequent insertions ?

Thank you,
Stuart

--- John Holmes <[EMAIL PROTECTED]> wrote:

> > Am I missing something here ?
> 
> Yep... you're missing a mysql_query() call for each
> query. You're only 
> running one query and echoing the other...
> 

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



Re: [PHP-DB] how to connect to dbase

2004-10-15 Thread Jason Wong
On Friday 15 October 2004 19:11, Swapan Mazumdar wrote:
> I can't believe this, my problem doesn't attract any attention.
> But I am quite sure that everybody else besides me has more experience
> than me in this specific field.
> Anyone pl, is my question absurd or just impossible.

I may be wrong, but I can't believe that dbase is exactly popular amongst php 
users. Its lack of popularity could explain the lack of response.

-- 
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
--
/*
But scientists, who ought to know
Assure us that it must be so.
Oh, let us never, never doubt
What nobody is sure about.
-- Hilaire Belloc
*/

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



RE: [PHP-DB] pdf

2004-10-15 Thread Bastien Koert
www.fpdf.org
bastien

From: "balwantsingh" <[EMAIL PROTECTED]>
Reply-To: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: [PHP-DB] pdf
Date: Fri, 15 Oct 2004 13:53:00 +0530
hi all,
i want to how i can save the data retrieved from mysql through php in pdf
format.
thanks for your help in advance.
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] Help: Transactions not working

2004-10-15 Thread Stuart Felenstein
John, 

Big thank you! for your help.  I had been trying out
the mysql_insert_id and was not having luck.  It's
working great (with just a few more bumps to get
over).
--- John Holmes <[EMAIL PROTECTED]> wrote:

> Stuart Felenstein wrote:
> 
> > But - I want to confirm, am I still using
> transactions
> > even though I'm issuing individual query calls for
> > each insert.
> 
> Yes, that's the idea. Everthing between BEGIN and
> COMMIT/ROLLBACK is the 
> transaction.
> 

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



Re: [PHP-DB] Help: Transactions working but question / issue

2004-10-15 Thread Stuart Felenstein
Here is my situation , not sure how I should handle
it.  
I have this multi page form, at the end I use mysql
transaction to get the data into all the tables.
All the tables are innodb with the exception of one.
The last page has one field which takes a copy/paste
of a document, so it's a text area.  This is set up to
go into a MyISAM table.  MyISAM  for the full text
searching capabilities. 

So here are my thoughts:
1-I change the table to Innodb, and figure out how to
make it effective for text searching. I figure there
must be a work around.  Maybe not.

2-I put the field into a temp Innodb table and then
when the transaction completes, move it over to the
permanent MyISAM

3-Somehow I trick the transaction (maybe trick is a
bad word), to use and update for this last field into
the MyISAM table ?

Not sure if anyone has had this issue before but I'm
looking and hoping for suggestions.

Thank you
Stuart


--- John Holmes <[EMAIL PROTECTED]> wrote:

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



Re: [PHP-DB] pdf

2004-10-15 Thread Matt M.
> i want to how i can save the data retrieved from mysql through php in pdf
> format.

http://www.fpdf.org/

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



[PHP-DB] moving from MS Access

2004-10-15 Thread Perry, Matthew (Fire Marshal's Office)
I have finally convinced my office manager to move from Access to MySQL.
Unfortunately the office users are used to Access forms instead of web
forms.  
I have attempted to make my web forms look as much like the Access forms
they are used to but I am not a web designer.  Does anyone know a good
application that can help me with this so I can get away from UI development
back to my DB management?  
I realize this is not a web design list server.

Matthew Perry

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



Re: [PHP-DB] how to connect to dbase

2004-10-15 Thread Robert Twitty
Try odbtp, http://odbtp.sourceforge.net.

-- bob

On Fri, 15 Oct 2004, Swapan Mazumdar wrote:

> Hi All,
>
> I am quite new to php. I have a requirement to query dbase file to
> implement searching on table columns. Now I am following a basic
> approach using dbase_get_record_with_names($fileHandler,
> $iterationIndex). This seems to be a rudimentary approach and has
> performance bottleneck. For the purpose of   paging this is a big
> stopper.
> I request php guys to show me how to use Connection to fire a query. I
> am afraid I can't use system dsn since the underline dbase file could be
> dynamic. Pl. suggest me how to use direct connection through url or file
> dsn. This is in context to web apps development.
>
> Regards,
> Swapan
>
> --
> 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] Array and insert statement throws error

2004-10-15 Thread Stuart Felenstein
Trying to get array of values into table. 
Each value will be part of a new record, so it's a
loop.

I am getting a parse error though and for further down
in the code though I know this is what's causing it.
Is there anything wrong with this statement ?


if ( is_array( $_SESSION['l_industry'] ) ) {
foreach ( $_SESSION['l_industry'] as $p ) {
$query = "INSERT INTO Profiles_Industries (ProfileID,
IndID)
VALUES ($LID, $p)";   
}

Stuart

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



Re: [PHP-DB] Array and insert statement throws error

2004-10-15 Thread Matt M.
> if ( is_array( $_SESSION['l_industry'] ) ) {
> foreach ( $_SESSION['l_industry'] as $p ) {
> $query = "INSERT INTO Profiles_Industries (ProfileID,
> IndID)
> VALUES ($LID, $p)";
> }

do you have a } for the if statement?

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



Re: [PHP-DB] Array and insert statement throws error

2004-10-15 Thread Stuart Felenstein
Where would that go?

Stuart

--- "Matt M." <[EMAIL PROTECTED]> wrote:

> > if ( is_array( $_SESSION['l_industry'] ) ) {
> > foreach ( $_SESSION['l_industry'] as $p )
> {
> > $query = "INSERT INTO Profiles_Industries
> (ProfileID,
> > IndID)
> > VALUES ($LID, $p)";
> > }
> 
> do you have a } for the if statement?
> 

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



Re: [PHP-DB] Array and insert statement throws error

2004-10-15 Thread Matt M.
if ( is_array( $_SESSION['l_industry'] ) ) {
foreach ( $_SESSION['l_industry'] as $p ) {
$query = "INSERT INTO Profiles_Industries (ProfileID,IndID) VALUES
($LID, $p)";
} //foreach ( $_SESSION['l_industry'] as $p )
} //if ( is_array( $_SESSION['l_industry'] ) )

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



Re: [PHP-DB] Array and insert statement throws error

2004-10-15 Thread Stuart Felenstein
Yep, I had found it shortly before.
Only it's not looping.  It is taking last value only.

Stuart


--- "Matt M." <[EMAIL PROTECTED]> wrote:

> if ( is_array( $_SESSION['l_industry'] ) ) {
>   foreach ( $_SESSION['l_industry'] as $p ) {
>   $query = "INSERT INTO Profiles_Industries
> (ProfileID,IndID) VALUES
> ($LID, $p)";
>   } //foreach ( $_SESSION['l_industry'] as $p )
> } //if ( is_array( $_SESSION['l_industry'] ) )
> 
> -- 
> 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] Array and insert statement throws error

2004-10-15 Thread Matt M.
where is your insert statement? I am guessing it is after your loop


if ( is_array( $_SESSION['l_industry'] ) ) {
foreach ( $_SESSION['l_industry'] as $p ) {
$query = "INSERT INTO Profiles_Industries (ProfileID,IndID) VALUES
($LID, $p)";
/This is where your insert statement should
be**/
} //foreach ( $_SESSION['l_industry'] as $p )
} //if ( is_array( $_SESSION['l_industry'] ) )

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



Re: [PHP-DB] Array and insert statement throws error

2004-10-15 Thread Stuart Felenstein
Actually it did just loop.  I need to test again.  

The insert statement is the the one $query = 
So it's after yes, but contained in the braces, like
you diagram below.

Stuart
--- "Matt M." <[EMAIL PROTECTED]> wrote:

> where is your insert statement? I am guessing it is
> after your loop
> 
> 
> if ( is_array( $_SESSION['l_industry'] ) ) {
>   foreach ( $_SESSION['l_industry'] as $p ) {
>   $query = "INSERT INTO Profiles_Industries
> (ProfileID,IndID) VALUES
> ($LID, $p)";
> /This is where your insert
> statement should
> be**/
>   } //foreach ( $_SESSION['l_industry'] as $p )
> } //if ( is_array( $_SESSION['l_industry'] ) )
> 

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



Re: [PHP-DB] Array and insert statement throws error

2004-10-15 Thread Brent Baisley
When are you actually performing the insert into the database? The code 
you posted is only changing the value of the variable $query. You also 
need to have the database function to insert into the database. 
Assuming it MySQL:
...
foreach(...) {
	$query = "INSERT INTO ...";
	mysql_query($query);
}

On Oct 15, 2004, at 4:40 PM, Stuart Felenstein wrote:
Yep, I had found it shortly before.
Only it's not looping.  It is taking last value only.
Stuart
--- "Matt M." <[EMAIL PROTECTED]> wrote:
if ( is_array( $_SESSION['l_industry'] ) ) {
foreach ( $_SESSION['l_industry'] as $p ) {
$query = "INSERT INTO Profiles_Industries
(ProfileID,IndID) VALUES
($LID, $p)";
} //foreach ( $_SESSION['l_industry'] as $p )
} //if ( is_array( $_SESSION['l_industry'] ) )
--
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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Array and insert statement throws error

2004-10-15 Thread Stuart Felenstein
Hopefully these functions will explain it.
I'm starting the transaction, then provided it takes
with no errors it gets the commit

function begin()
{
mysql_query("BEGIN");
}
function commit()
{
mysql_query("COMMIT");
}
function rollback()
{
mysql_query("ROLLBACK");
}

begin();
$query = "INSERT INTO>...

$result = mysql_query($query);
--- Brent Baisley <[EMAIL PROTECTED]> wrote:

> When are you actually performing the insert into the
> database? The code 
> you posted is only changing the value of the
> variable $query. You also 
> need to have the database function to insert into
> the database. 
> Assuming it MySQL:
> ...
> foreach(...) {
>   $query = "INSERT INTO ...";
>   mysql_query($query);
> }
> 
> On Oct 15, 2004, at 4:40 PM, Stuart Felenstein
> wrote:
> 
> > Yep, I had found it shortly before.
> > Only it's not looping.  It is taking last value
> only.
> >
> > Stuart
> >
> >
> > --- "Matt M." <[EMAIL PROTECTED]> wrote:
> >
> >> if ( is_array( $_SESSION['l_industry'] ) ) {
> >>foreach ( $_SESSION['l_industry'] as $p ) {
> >>$query = "INSERT INTO Profiles_Industries
> >> (ProfileID,IndID) VALUES
> >> ($LID, $p)";
> >>} //foreach ( $_SESSION['l_industry'] as $p )
> >> } //if ( is_array( $_SESSION['l_industry'] ) )
> >>
> >> -- 
> >> 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
> >
> >
> -- 
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology
> Environments
> p: 212.759.6400/800.759.0577
> 
> -- 
> 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] moving from MS Access

2004-10-15 Thread John Holmes
Perry, Matthew (Fire Marshal's Office) wrote:
I have finally convinced my office manager to move from Access to MySQL.
Unfortunately the office users are used to Access forms instead of web
forms.  
I have attempted to make my web forms look as much like the Access forms
they are used to but I am not a web designer.  Does anyone know a good
application that can help me with this so I can get away from UI development
back to my DB management?  
I realize this is not a web design list server.
Yeah, off topic for here, but there are ways to use MySQL as the backend 
database of Access and just use Access for the forms, gui, queries, etc. 
You just link Access to the MySQL tables and your users are none the 
wiser. You can still implement a web version (I can't help with your 
actual question up there, though) and an Access GUI version. Search 
Google for tutorials on how to do this. Good luck.

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


[PHP-DB] 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


[PHP-DB] Form Processing

2004-10-15 Thread Ron Piggott
I would like to know if you are able to create a PHP web form that has
different "SUBMIT" buttons --- or if you used the HTML command


Delete Record
Update And Approve For Listing
For Management


Basically I want the delete record to find the record in the mySQL
database --- I added the auto_increment yesterday to help develop the
editing module --- I want the Update and Approve For Listing to change a
variable value from "0" to "1" and to accept any changes the pre-viewer has
made --- for example writing in "United States" instead of US and "For
Management" to change the variable value to "2".

Are any of you able to help me with this question?

Sincerely thank you.

It would again help me if a copy of your response is sent to my e-mail
[EMAIL PROTECTED]

Ron

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



[PHP-DB] Re: [PHP] How to optimize select of random record in DB ?

2004-10-15 Thread Gareth Williams
What about in MySQL:
SELECT personID from persons ORDER BY RAND(NOW()) LIMIT 1
If the table is large, then the following might be better:
LOCK TABLES foo READ;
SELECT FLOOR(RAND() * COUNT(*)) AS rand_row FROM foo;
SELECT * FROM foo LIMIT $rand_row, 1;
UNLOCK TABLES;
There's a whole discussion on it in the MySQL documentation web site:
http://dev.mysql.com/doc/mysql/en/SELECT.html
On 15 Oct 2004, at 07:41, -{ Rene Brehmer }- wrote:
I made this code to pick a random record from a changeable number of 
records in a given table.
I'm just curious if any of the more awake coders out there can see a 
way to optimize this for better performance, since there's several 
other DB queries on the same page.

  $records = mysql_query("SELECT COUNT(*) AS count FROM persons") or 
die('Unable to get record count'.mysql_error());
  $totalcount = mysql_result($records,0) - 1;
  $rndrecord = rand(0,$totalcount);
  $personquery = mysql_query("SELECT personID FROM persons LIMIT 
$rndrecord,1") or die('Unable to get random 
record'.mysql_error());
  $personID = mysql_result($personquery,0);
--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] How to optimize select of random record in DB ?

2004-10-15 Thread Bastien Koert
skip the two step process and use RAND in the sql statement
SELECT * FROM table1, table2 WHERE a=b AND c
bastien
From: -{ Rene Brehmer }- <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: [PHP-DB] How to optimize select of random record in DB ?
Date: Fri, 15 Oct 2004 07:41:44 +0200
I made this code to pick a random record from a changeable number of 
records in a given table.
I'm just curious if any of the more awake coders out there can see a way to 
optimize this for better performance, since there's several other DB 
queries on the same page.

  $records = mysql_query("SELECT COUNT(*) AS count FROM persons") or 
die('Unable to get record count'.mysql_error());
  $totalcount = mysql_result($records,0) - 1;
  $rndrecord = rand(0,$totalcount);
  $personquery = mysql_query("SELECT personID FROM persons LIMIT 
$rndrecord,1") or die('Unable to get random record'.mysql_error());
  $personID = mysql_result($personquery,0);
--
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