table keys

2006-03-28 Thread fbsd_user
create table members (
logon_idvarchar(15) NOT NULL,
email_addr  varchar(30) NOT NULL,
  member_type char(1),
email_verified  char(1),
  logon_pwvarchar(15),
  date_added  date,
last_login  timestamp,
count_of_logons INT,
first_name  varchar(30),
last_name   varchar(30),
primary key login_id (login_id),
key email_addr (email_addr));

When doing a insert row, if the logon_id value is all ready in
the table I get a dup id msg. This is fine and what I want to
happen.

But when inserting a row with a unique logon_id value that has
a email_addr that is already used by some other logon_id,
mysql allows the insert. This is not the action I want.

I need to be able to do lookup by logon_id or by email_addr
and retrieve the row. I can do that now, but if 2 logon_id's have
the same email address I get both rows. I need the email address
to be unique across all rows.

How can I change this table definition so email_addr is unique
across all rows of the table?

I read the manual about 'unique & index' options, but still don't
comprehend what the manual says.

Also as you can see I do not select a engine type, is there some
engine type better suited and or faster for the way I am
trying to use the keys?

Thanks for your advice and help.





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Connection Buffer

2006-03-22 Thread fbsd_user
I think you are asking for  mysql_pconnect("localhost","root")

-Original Message-
From: Cory at SkyVantage [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 22, 2006 2:20 PM
To: MySQL-List
Subject: Connection Buffer


Is there anything I can put into the my.cnf file to buffer
connection
(leave it open) to give a similar effect as connection pooling?

Thanks in advance!

--


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



NULL columns

2006-03-16 Thread fbsd_user
When doing an insert using NULL in the insert request, 
what really is being written in the column?
Is the word NULL being written? 
Is any real space being consumed?

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Very large from

2006-03-15 Thread fbsd_user
A power bar is what they call the bar at the bottom and on the right
side of the browsers window when the content being showed in the
window is larger than the window. By sliding the bars around you
bring the content into view.


-Original Message-
From: James Harvard [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 14, 2006 6:39 PM
To: Mysql
Subject: Re: Very large from


At 4:24 pm -0500 14/3/06, fbsd_user wrote:
>user has to use the power bar to move deeper into the form

Out of curiosity, what's "the power bar"?

>From a db perspective one single insert is preferable, IMO. Firstly
you don't have to declare as NULL required fields that will be
entered in the second, third or Nth form page. Secondly you won't
get incomplete entries, as has already been mentioned.

If it was a sign-up form, say, and you have a unique index on the
user e-mail address, then you would run into problems if a user
completed the first page of the signup and created a new row in the
table, then for some reason started from scratch (e.g. their 'puter
crashed). They wouldn't be able to start again because their e-mail
address would already be in the unique field in the table.

I would do one of two things:

a) use a session management system to store the submitted details
until you get to the final form page and can insert the whole lot
into the table

b) Have the whole form on one page and use Javascript to only show
one part of the form at any one time (but in such a way that it
degrades gracefully for non-JS browsers - i.e. they get the whole
form on one page)

James Harvard

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Very large from

2006-03-15 Thread fbsd_user
Thank you Gabriel, more background information may result in a
better concept, so here it is.

The web based application I am writing deals with people who have an
a home for rent. They can sign up for small fee and enter their
rental property into the application so its searchable and viewable
by the internet public. I have a membership DB with single members
table containing 20 columns which holds the users signup info.
Members can list more than one rental property. Members has
opportunity to enter some portion of the 140 columns of data to
describe the rental property. Currently the real_estate DB contains
a single property table of 140 columns.

I have grouped the info in the table into 3 groups, mandatory info
deals with the business of renting, second group deals with
location,  third group deals with house characteristics. All the 140
columns of data will be shown on the detail property screen. Fields
that don't pertain to that individual property will show up as blank
because the user did not enter data. All fields are 'varchar' to
conserve on unused space.

One single record per listed property has all the info retrievable
by one read, but has undesirable effects entering all of it from
single form.  Making 3 tables would mean duplication of some common
key fields to allow retrieving all the associated rows to combine
the data for displaying.

I would think since most of the activity will be people on the
internet searching for rental property, performance would be better
to retrieve all the info with a single read. This makes the 3 table
idea a bad performer.

It has been suggested to use session control as a staging function
where the forms store the entered data so a single insert of all the
data can be made to the table. Sessions store their data in standard
flat files in /tmp. Flat files are not known for their access speed
and performance, with 2 or 3 fields this is ok but 100+ fields and
this may become a major performance bottleneck.

My current thinking is to break the entering of the property info
into 3 separate forms, the first with the mandatory info does a
insert to create the row with the remaining 100 columns being seeded
with $t=''. Group 2 & 3 will them be a update to the row using the
'set' keyword just touching the columns under their separate
control.


Does this sound like a workable solution or is there some other
approach that is better suited to my application?

Thanks to all the people who have replied all ready.



-Original Message-
From: Gabriel PREDA [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 15, 2006 5:01 AM
To: Mysql
Subject: Re: Very large from


Hmmm...
Let me say some thoughts...
First *fbsd_user* said that he has *100 input fields plus 40
different drop
downs.*
And everybody is arguing that they prefer "*one single insert*".

Is it just me... or are you thinking at a table with 140 columns ?
Thinking at such a monster... all the above discussion is ok !

But who does a table with 140 columns...
It's not good practice... it's no good at all...

If we're not working with a monster like that... all discusion falls
down...
On the other hand if I have to insert all that info... in let's
say... I
don't know... 10 tables... what's the point of using "*one single
insert*"
how ca one use a "one single insert" to put data in 10 tables ?

So... the design of the application follows in at least 50% of the
cases the
design of the DATABASE !

Give us a little more details about your database !

--
Gabriel PREDA
Senior Web Developer


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Very large from

2006-03-14 Thread fbsd_user
Well not wanting to be rude back. But the question is dealing with
how best to control the writing of data to mysql. No where do I say
anything about using php. I could be using perl for all you know.
But I respect your right to state your thoughts, but just don't
agree with it. I think this is a better place to ask this question,
and acknowledge that people on the php list would also most likely
be able to shed light on this subject.

-Original Message-
From: David Logan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 14, 2006 4:53 PM
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Re: Very large from


Not wanting to be rude but this question would probably be answered
better in a php group. I realise there are many users of php that
subscribe to this list, but this is a mysql list not php.

If you go to http://www.php.net/support.php you will find a large
number
of resources (including lists at
http://www.php.net/mailing-lists.php),
not to mention examples of code, irc channels etc.

Regards

fbsd_user wrote:

>Have to develop form with over 100 input fields plus 40 different
>drop downs. Seeking advice on technique to use. Thinking about
>single form where user has to use the power bar to move deeper into
>the form. This has benefit that every thing is written to the
>database at one time, but the draw back is the user frustration in
>entering so much data at one time. Alternate thoughts are breaking
>it down into 2 or 3 separate pages with each page being written to
>the data base. First page does a insert to create the row, then
>following pages do updates to complete populating the row with
data.
>
>Has anyone done anything like this or have seen this done before.
>What advice can you offer.
>Where to look for examples.
>
>Thanks
>
>
>
>
>
>


--

David Logan
South Australia

when in trouble, or in doubt
run in circles, scream and shout


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Very large from

2006-03-14 Thread fbsd_user
I understand the save the page form data into the session. But I
don't know what you mean by just pass it from page to page. Would
that mean having all the fields in regular form fields to accept the
entered data and also hidden corresponding fields to hide page 1
data in as page 2 is entered and for page 3, page 1 & 2 would be in
hidden fields? This results in all that data being passed back and
forth between the web server and the user. This would really be slow
for a dial up user. Or am I not understanding what you were talking
about.

Using the 3 page method with data being written by page, I would
have flag on the record which would not be a user input field, but a
program control to identify the record as not usable until all 3
pages have been executed. Since all the fields are not mandatory
there will always be empty fields and that is ok by business design.

-Original Message-
From: Brett Harvey [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 14, 2006 4:35 PM
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Re: Very large from


Both methods are "commonly" used.

Another method used is to have multiple pages like you've mentioned
but save all the data into a session (of just pass it from page to
page) until all 3 pages are complete and then write all the data at
once

The question to ask yourself is, do you want just partial data, an
incomplete form, to be in your database/table.  If you don't, then
method 1 or the method I just mentioned is the way to go.  Otherwise
you'll have incomplete data in your dataset.

Surveys do both of any/all 3 of these methods. Of course, with ajax
now, I'm seeing more written to the database while a user is
inputing
their data and then the web application has to remove, at some
point,
incomplete data.

Good Luck!

>Have to develop form with over 100 input fields plus 40 different
>drop downs. Seeking advice on technique to use. Thinking about
>single form where user has to use the power bar to move deeper into
>the form. This has benefit that every thing is written to the
>database at one time, but the draw back is the user frustration in
>entering so much data at one time. Alternate thoughts are breaking
>it down into 2 or 3 separate pages with each page being written to
>the data base. First page does a insert to create the row, then
>following pages do updates to complete populating the row with
data.
>
>Has anyone done anything like this or have seen this done before.
>What advice can you offer.
>Where to look for examples.
>
>Thanks
>
>
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


--


/Brett C. Harvey;
/Creative-Pages.Net, President;
/Facility Management Systems, CTO (www.fmsystems.biz);
/Lasso Partner Association Member ID #LPA135259
(www.omnipilot.com/www.lassopartner.com);




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Very large from

2006-03-14 Thread fbsd_user
Have to develop form with over 100 input fields plus 40 different
drop downs. Seeking advice on technique to use. Thinking about
single form where user has to use the power bar to move deeper into
the form. This has benefit that every thing is written to the
database at one time, but the draw back is the user frustration in
entering so much data at one time. Alternate thoughts are breaking
it down into 2 or 3 separate pages with each page being written to
the data base. First page does a insert to create the row, then
following pages do updates to complete populating the row with data.

Has anyone done anything like this or have seen this done before.
What advice can you offer.
Where to look for examples.

Thanks




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: users browser caching the screen

2006-03-13 Thread fbsd_user
I guess you are saying that trying to have my php script send
the users browser html headers to stop caching is not
really going to solve my problem. I did put a block rule in
my firewall for the attackers ip address and that stopped
the attach from recurring.

But to make sure it don't happen again I am adding a
Captcha Security Code Random-Noisy-Images to the screen.
This uses a randomly generated graphic image to stymie
auto-submission scripts.

-Original Message-
From: gerald_clark [mailto:[EMAIL PROTECTED]
Sent: Monday, March 13, 2006 12:13 PM
To: [EMAIL PROTECTED]
Cc: Mysql
Subject: Re: users browser caching the screen


fbsd_user wrote:

>Now I know what I am going to talk about is not directly related to
>this mysql list, but I am in need of some concept ideas.
>
>To set the background. It’s a very common practice in the
>registration process of a new user to verify the users email
address
>is valid by sending a email to the entered email address with a
link
>in it to a screen that updates the users emailed verified flag in
>his table record. I have such a process.
>
>Once a week I review my apache activity log and I noticed a lot of
>log records for the file that process the link to update the users
>email verified flag, (over 1500 from same ip address).
>
>To me this looked like an attack to break into my web application.
>Research and testing indicates that the screen is Cached by the
>users browser and he is changing the passed link info repeatedly in
>effort to break in. This screen is the only one that does not have
>session security control because it’s launched from the verify
email
>I sent him.
>
>Now my registration sign up screen has a Captcha Security Code
>Random-Noisy-Image and part of that is a string of headers to the
>browser to stop caching. They look like this.
>
>// send several headers to make sure the image is not cached
>// taken directly from the PHP Manual
>
>// Date in the past
>header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
>
>// always modified
>header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
>
>// HTTP/1.1
>header("Cache-Control: no-store, no-cache, must-revalidate");
>header("Cache-Control: post-check=0, pre-check=0", false);
>
>// HTTP/1.0
>header("Pragma: no-cache");
>
>Now my desire is to somehow have the screen that is the target of
>the email link to issue these headers before displaying its html
>code so the user can not any longer run a script against this
screen
>trying to break in.
>
>Is this possible and if so how. Is this kind of attack happening to
>anyone else?
>
>Thanks for any help you can offer.
>
>
>
>
>
You have no way of knowing it the user is running a browser at all.
He
could have grabbed the page once, and
run a script that pretends to be a browser.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



update using 'set' keyword

2006-03-13 Thread fbsd_user
Trying to bump the count_of_logons by 1 using this update.
Phpmyadmin shows the count staying at zero.
I think that this   SET count_of_logons = 'count_of_logons + 1' 
is not coded correctly, but I get no errors so can not tell.

Anybody have any ideas?

The table def has   count_of_logons INT,

$sql = "UPDATE members 
   SET count_of_logons = 'count_of_logons + 1'
 WHERE logon_id  = '$logonid' 
 AND logon_pw= '$logonpw'
 AND email_verified = 'Y'";

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



timestamp

2006-03-13 Thread fbsd_user
In my mysql 4.4 table definition the default attributes are (ON
UPDATE CURRENT_TIMESTAMP). Reading the manual my understanding is
this is saying that the auto timestamp update feature is active. The
manual does not say what the trigger is to make the timestamp in the
row to be bumped to the current timestamp. I have noticed that the
timestamp field is only bumped when I update a field in the row. I
would like it to be auto bumped every time the row is selected/read.
Is there a way to do this without creating a timestamp from date in
my php code and then updating the row instead of reading the row?
The final goal is to auto bump the timestamp every time the user
logs on.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



users browser caching the screen

2006-03-13 Thread fbsd_user
Now I know what I am going to talk about is not directly related to
this mysql list, but I am in need of some concept ideas.

To set the background. It’s a very common practice in the
registration process of a new user to verify the users email address
is valid by sending a email to the entered email address with a link
in it to a screen that updates the users emailed verified flag in
his table record. I have such a process.

Once a week I review my apache activity log and I noticed a lot of
log records for the file that process the link to update the users
email verified flag, (over 1500 from same ip address).

To me this looked like an attack to break into my web application.
Research and testing indicates that the screen is Cached by the
users browser and he is changing the passed link info repeatedly in
effort to break in. This screen is the only one that does not have
session security control because it’s launched from the verify email
I sent him.

Now my registration sign up screen has a Captcha Security Code
Random-Noisy-Image and part of that is a string of headers to the
browser to stop caching. They look like this.

// send several headers to make sure the image is not cached
// taken directly from the PHP Manual

// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");

Now my desire is to somehow have the screen that is the target of
the email link to issue these headers before displaying its html
code so the user can not any longer run a script against this screen
trying to break in.

Is this possible and if so how. Is this kind of attack happening to
anyone else?

Thanks for any help you can offer.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Checking for good update

2006-03-13 Thread fbsd_user
Thank you Michael.  I learned a lot from your detailed explanation
of how the update and select functions work in relation to
checking for good execution.

I used
if (mysql_affected_rows() == 1)
and got the results I was after.

I am stilling having problem with users browser
caching the screen, but will post that as separate question.

Again thanks for your expert help.



-Original Message-
From: Michael Stassen [mailto:[EMAIL PROTECTED]
Sent: Monday, March 13, 2006 4:18 AM
To: [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Subject: Re: Checking for good update


[EMAIL PROTECTED] wrote:
> On Sun, 12 Mar 2006, Michael Stassen wrote:
>>
>>[EMAIL PROTECTED] wrote:
>>
>>>looks a bit strange to me.
>>>
>>>>$result = mysql_query($query) or die('Query couldn\'t
>>>>executed:'.mysql_error());
>>>
>>>please try something like this:
>>
>>Why?  There's nothing wrong with the above statement.
>
> I've never seen logic like that before. It looks to me like
> fbsd_user is trying to use the OR operator outside an if
> statement.
>
> Is the mentioned in the php manual somewhere Michael?
>
>>>I've not tested this - but it looks like you are mixing sending
the
>>>mysql query and testing for the result of the query at the same
time,
>>>which AFAIK is not possible.
>>
>>You should try it.  It works just fine, and isn't the problem.
The
>>problem is that you cannot treat the result of an UPDATE as if it
were a
>>SELECT.
>
> Regards
>
> Keith Roberts

Yes, this is documented.  It's also standard practice (in perl and C
as well).

OR is not part of an if statement, it is a logical operator.
<http://www.php.net/manual/en/language.operators.logical.php>  "A or
B" has a
value, true or false, depending on the values of A and of B.  In
fact, if A is
true, then "A or B" is certainly true, so there's no need to look at
B at all.
This short-circuit evaluation, combined with the fact that every
assignment
returns the assigned value
<http://www.php.net/manual/en/language.expressions.php>, makes a
statement like
this possible.

   $result = mysql_query($query) or die('Query
error:'.mysql_error());

First, the function mysql_query() is called.  Its return value is
assigned to
$result, *and* returned as the return value of the assignment
operator (=).  Now
we know A.  If mysql_query succeeded, its return value (A) evaluates
as true, so
the or operation must be true, so no need to look at B.  If, on the
other hand,
A is false (mysql_query failed), we must evaluate B to determine the
value of
the "or" expression.  Of course, to determine the value of B, we
have to call
the referenced function, die().

Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Checking for good update

2006-03-12 Thread fbsd_user

Maybe I have the overall logic wrong.

I don't do a select query first to see if that record is there.
I just try to update it.

If the logonid key in the update request is on the table, the record
does get updated. I can verify that using phpmyadmin.

When the logonid key in the update request is not on the table, the
results checks still take the record successful updated condition. A
look at the table using phpmyadmin shows me that there is no record
matching that logonid key.

My last test I tried this
if ($results == TRUE)

and still the update was successful condition is taken even when the
update key value is not on the table. I would expect the update was
unsuccessful condition to have been taken.

So the basic question boils down to   why does the successful
condition always get taken even when there is no match on the table
for the key value being used?

This is testing a new developed script, so there may be a logic
error in how things are done in the script. But I need to have the
results of the update to be able to tell difference between a good
update and one where the key used to target the record is not on the
table.

How do you suggest I should code the result condition test?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 12, 2006 5:20 PM
To: mysql@lists.mysql.com
Subject: Re: Checking for good update


Maybe I need to read the copy of php pocket reference I have
to David - LOL.

Keith

On Sun, 12 Mar 2006 [EMAIL PROTECTED] wrote:

> To: mysql@lists.mysql.com
> From: [EMAIL PROTECTED]
> Subject: Re: Checking for good update
>
>
> looks a bit strange to me.
>
> > $result = mysql_query($query) or die('Query couldn\'t
> > executed:'.mysql_error());
>
> please try something like this:
>
> // build the query - (that's OK)
> $query = "UPDATE members SET email_verified='X' WHERE
> logon_id='" .$logonid. "'";
>
> // send the query to the server - save the result resource
> $res = mysql_query($query);
>
> // test for the result of the above query
> if(!$res)
>   {
>   // stop the script if the result is not valid
>   die('Query couldn\'t be executed:'.mysql_error());
>   }
>
> // process a valid result
> $row = mysql_fetch_array($res)
>
> if (mysql_num_rows($res) == 1)
>   {
>   // the user id and password match,
>   print("User id on db");
>   }
> else
>   {
>   //$errorMessage = 'Sorry, wrong user id / password';
>   print("Sorry, wrong user id / password");
>   }
>
> I've not tested this - but it looks like you are mixing sending
the
> mysql query and testing for the result of the query at the same
time,
> which AFAIK is not possible.
>
> Maybe you need to get a simple introductory book on php, such as
O'reillys
> php pocket reference, ISBN 0596-00402-8.
>
> Regards
>
> Keith
>
> In theory, theory and practice are the same;
> In practice they are not.
>
> On Sun, 12 Mar 2006, fbsd_user wrote:
>
> > To: Mysql 
> > From: fbsd_user <[EMAIL PROTECTED]>
> > Subject: Checking for good update
> >
> > Using this code I get this error message.
> >
> > Warning: mysql_num_rows(): supplied argument is not a valid
MySQL
> > result resource in /usr/local/www/data/mls_verifyemail.php on
line
>
> Probably because you are not sending a valid query to the server,
> you will not be getting a valid result resource back from the
server.
>
> > What code should I use to check if the update worked or not?
> >
> >
> > $query = "UPDATE members SET email_verified='X' WHERE
> > logon_id='".$logonid."'";
> >
> > $result = mysql_query($query) or die('Query couldn\'t
> > executed:'.mysql_error());
> >
> > if (mysql_num_rows($result) == 1)
> > {
> >  // the user id and password match,
> >  print("User id on db");
> > }
> > else
> > {
> >  //$errorMessage = 'Sorry, wrong user id / password';
> >  print("Sorry, wrong user id / password");
> > }
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Checking for good update

2006-03-12 Thread fbsd_user


All ready read that and its clear as mud.
It tells you update is different but gives no example.

I asked in my post what should I code for checking the result of a
update.



-Original Message-
From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 12, 2006 4:50 PM
To: [EMAIL PROTECTED]; Mysql
Subject: RE: Checking for good update


Perhaps reading the manual would be a good start at
http://us3.php.net/manual/en/function.mysql-num-rows.php

It clearly states

Retrieves the number of rows from a result set. This command is only
valid for SELECT statements. To retrieve the number of rows affected
by
a INSERT, UPDATE, or DELETE query, use mysql_affected_rows().

You are using a function not valid for an UPDATE

Regards

---
** _/ **  David Logan
***   _/ ***  ITO Delivery Specialist - Database
*_/*  Hewlett-Packard Australia Ltd
_/_/_/  _/_/_/    E-Mail: [EMAIL PROTECTED]
   _/  _/  _/  _/     Desk:   +618 8408 4273
  _/  _/  _/_/_/  Mobile: 0417 268 665
*_/   **
**  _/    Postal: 148 Frome Street,
   _/ **  Adelaide SA 5001
  Australia
invent
---

-Original Message-
From: fbsd_user [mailto:[EMAIL PROTECTED]
Sent: Monday, 13 March 2006 8:00 AM
To: Mysql
Subject: Checking for good update

Using this code I get this error message.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /usr/local/www/data/mls_verifyemail.php on line
49

What code should I use to check if the update worked or not?


$query = "UPDATE members SET email_verified='X' WHERE
logon_id='".$logonid."'";

$result = mysql_query($query) or die('Query couldn\'t
executed:'.mysql_error());

if (mysql_num_rows($result) == 1)
{
 // the user id and password match,
 print("User id on db");
}
else
{
 //$errorMessage = 'Sorry, wrong user id / password';
 print("Sorry, wrong user id / password");

}


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Checking for good update

2006-03-12 Thread fbsd_user
Using this code I get this error message.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /usr/local/www/data/mls_verifyemail.php on line
49

What code should I use to check if the update worked or not?


$query = "UPDATE members SET email_verified='X' WHERE
logon_id='".$logonid."'";

$result = mysql_query($query) or die('Query couldn\'t
executed:'.mysql_error());

if (mysql_num_rows($result) == 1)
{
 // the user id and password match,
 print("User id on db");
}
else
{
 //$errorMessage = 'Sorry, wrong user id / password';
 print("Sorry, wrong user id / password");

}


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



mysql_query gives Resource id #3 error

2006-03-11 Thread fbsd_user
$sql = "SELECT logon_id
FROM members
  WHERE logon_id = '$logonid' AND logon_pw =
'$logonpw'";

$result = mysql_query($sql) or die('Query failed. ' .
mysql_error());

  print "$result";  shows Resource id #3


  Where can I find meaning for what this means?

  And why does mysql_error() not contain the description of this
error?

  And why was the 'or die' condition not taken?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



mysql_commect or die

2006-03-11 Thread fbsd_user
   mysql_connect("localhost","root") 
or die("Unable to connect to MySQL server");

  $err mysql_connect("localhost","root");
  if ($err != 0) {


Under what conditions will the die clause be taken.

What is in $err  if there is a error?

Are these 2 statements basically doing the same thing?

 
 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Reusing connections.

2006-03-11 Thread fbsd_user


I am using php as my programming language.

Let me clarify my post.
When I say 'doing a connect',
I am talking about the mysql_connect statement not some
tcp/ip thing done before the mysql server.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, March 10, 2006 2:24 PM
To: [EMAIL PROTECTED]
Cc: Mysql
Subject: Re: Reusing connections.


"fbsd_user" <[EMAIL PROTECTED]> wrote on 03/10/2006 02:18:49
PM:

> In my reading of mysql tutorials I see many examples of mysql
access
> with out first doing a connect. Comments say something about
reusing
> open connections for faster processing and less resources usage
> overhead. What are they talking about & what code do I need to
make
> this happen?
>

You first need to tell us which of several dozen languages you are
programming with. We can't read your mind.

;-)

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Reusing connections.

2006-03-10 Thread fbsd_user
In my reading of mysql tutorials I see many examples of mysql access
with out first doing a connect. Comments say something about reusing
open connections for faster processing and less resources usage
overhead. What are they talking about & what code do I need to make
this happen?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: php and mysql

2006-03-09 Thread fbsd_user
You need a login id and password unless this is test DB added under
ID "root"
You have to use the same login id as the one you created the
db/table with.

mysql_connect('localhost', 'Login id', 'pw') or die(mysql_error())

mysql_connect('localhost', 'root') or die(mysql_error())


-Original Message-
From: Mary Adel [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 09, 2006 3:06 PM
To: mysql@lists.mysql.com
Subject: php and mysql


I have a severe problem that php5 cannot connect to mysql and i
don't
know why
also i am using linux
here is my peice of code
:";
print "connected";
?>
if their is any configuration please tell me

thanks,
mary


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Table with multiple primary keys - How

2006-03-08 Thread fbsd_user
Thank you.
I went with your solution and the create table worked.
Tested inserting on primary key and it worked.
Need to load more data before I can test alt indexes.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 08, 2006 3:39 AM
To: mysql@lists.mysql.com
Subject: Re: Table with multiple primary keys - How



It is not possible to have more than one PRIMARY
key per table.

Maybe you need to use one PRIMARY key as the main index into
the table, then use UNIQUE or KEY which is a synonym for
INDEX on the other two columns.

This book will help you ALOT with designing tables.

It will also teach you how to normalise (refactor) your
tables into a more efficient form.

http://www.apress.com/book/bookDisplay.html?bID=338

It is also more efficient IMHO to index on integer values if
you can, rather than character text.

Regards

Keith

> create table members (
> logon_idMEDIUMINT UNSIGNED NOT NULL
AUTO_INCREMENT,
> email_addr  varchar(30), ???
> last_name   varchar(30), ???
> member_type char(1),
> email_verified  char(1),
> logon_pwvarchar(15),
> date_added  date,
> last_login  timestamp,
> first_name  varchar(30),
> addr1   varchar(30),
> addr2   varchar(30),
> cityvarchar(20),
> state   varchar(20),
> zip varchar(15),
> phone_home  varchar(15),
> phone_officevarchar(15),
> phone_cell  varchar(15),
> mothers_maiden_name varchar(30),
> ip_of_useratsignup  varchar(16),
> primary key(login_id, email_addr, last_name)
>   );

primary key login_id (login_id),
key email_addr (email_addr),
key last_name (last_name)
);

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Not Saving

2006-03-08 Thread fbsd_user
You are doing this 
 
mysql_connect
mysql_query

And you need to do this

mysql_connect
mysql_select_db
mysql_query



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Table with multiple primary keys - How

2006-03-07 Thread fbsd_user

What I am trying to do here is have 3 separate primary keys.
Creating a mysql select on either of the Logon_id, email_addr, 
or last_name fields will do a single read to the matching value. 
Like having 3 different indexes into the same table. 
I don't want those 3 field concatenated together as a single key.

Is this table definition correct?

create table members (
logon_idvarchar(15),
email_addr  varchar(30),
  last_name   varchar(30),
  member_type char(1),
email_verified  char(1),
  logon_pwvarchar(15),
  date_added  date,
last_login  timestamp,
first_name  varchar(30),
addr1   varchar(30),
addr2   varchar(30),
cityvarchar(20),
state   varchar(20),
zip varchar(15),
  phone_home  varchar(15),
phone_officevarchar(15),
phone_cell  varchar(15),
mothers_maiden_name varchar(30),
  ip_of_useratsignup  varchar(16),
  primary key(login_id, email_addr, last_name)
);


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]