| Race
City: |
\n";
while
So you have one table with the fields 'email' and 'nickname' (perhaps others
too) and and given:
$email = '[EMAIL PROTECTED]'
$nickname = 'stinky'
You wish to be sure that no other record has either that email _or_ that
nickname. Correct?
You could run:
select * from
where email = $email
or nickname = $nickname
Now this would return rows if either was true and the only way you could
tell would be to look at the results and compare those fields to the values
you already have. If the results are empty then it's cool - there aren't
any rows with these values.
Otherwise if you want two results use two queries.
Good Luck,
Frank
On 3/27/02 12:27 AM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> From: "Dave Carrera" <[EMAIL PROTECTED]>
> Date: Wed, 27 Mar 2002 08:27:21 -
> To: <[EMAIL PROTECTED]>
> Subject: Checking for 2 unique row contents
>
> Hi all
>
>
>
> I am trying to create a registration area that uses a nickname and email
> pair.
>
>
>
> I need both to be unique.
>
>
>
> So how do I that either do not already exist then if unique insert into
> db.
>
>
>
> So
>
> if nickname exist then error = "sorry..."
>
> if email exist then error = "sorry..."
>
> else must be unique
>
> insert.
>
>
>
> I have been trying for hours know but cant get the twin check to work.
>
>
>
> Can get single check to work though.
>
>
>
> I thank you in advance for any thoughts or code examples
>
>
>
> Dave Carrera
>
> Php Developer
>
> http://davecarrera.freelancers.net
>
> http://www.davecarrera.com
--
Frank Flynn
Poet, Artist & Mystic
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
> Hi to all,
> I'm new to PHP. I'm trying to retrieve data from a database, but I just
> want to retrieve one record at a time and go through to the next
> records by click next record. I know how to retrieve all record by
> using the
> mysql_fetch_array, but I'm having problems to select one record at
> time. Any idea?
>
> Thanks in advanced
> Nato
Nato, you can use the MySQL LIMIT feature as part of your SELECT statement
to accomplish this.
$SQL = "SELECT * FROM my_data LIMIT 0, 1";
The result that you get with mysql_fetch_array is only one record, the
first record that the database returned from the SELECT statement.
When your user presses NEXT, you would execute:
$SQL = "SELECT * FROM my_data LIMIT 1, 1";
The second number is the number of records to limit by, in your case only
one at a time. The first number is the index of the record that you want
to have returned by the database. This number would be a variable in your
case that would increment by one when they press NEXT and decrement by one
when they press PREVIOUS.
Hope that helps you out.
Josh
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi all!
I have two tables. One have the primary key, that is referenced in
the second. When I have to insert a record in both tables, I do this in
the first, following a select to catch the primary key generated. So
then I insert the rest of data in the second table, with the value to
the foreign key. There is a way to do this better. I'm using postgres.
Thanks.
--
Jairo Tcatchenco
[EMAIL PROTECTED]
Coordenadoria de Defesa Agropecuária - CDA
Secretaria de Agricultura e Abastecimento do Estado de São Paulo -
SAA/SP
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi to all,
I'm new to PHP. I'm trying to retrieve data from a database, but I just want
to retrieve one record at a time and go through to the next records by click
next record. I know how to retrieve all record by using the
mysql_fetch_array, but I'm having problems to select one record at time. Any
idea?
Thanks in advanced
Nato
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Just some advice... You should use a consistent programming style,
especially with PHP. You can read some guys advice here.
http://www.phpbuilder.com/columns/tim20010101.php3?page=1
Some of the advantages of having a consistent style, is when you are
looking for bugs. If you look over your code and see something unusual,
then you can target that area to see if it is the culprit. If you don't
have a consistent style, then sometimes that can cause serious
heartache, as everything will look unusual.
A few issues that trip up most people when beginning to use PHP, is the
syntax errors. Usually these arise from quote issues, to semi-colon and
brace issues. A lot of this trouble can be avoided (or easily debugged)
by simply using tabs to your advantage. Consider the following:
Technically I *think* this would be syntactically correct, but if I was
looking for a bug, I would be shot in the foot. A better way to write
this would be the following:
So its a couple more lines, but if I came back to that script a month or
two months later trying to fix something, or add a new feature, it would
be easy. Couple that style with comments and you're on fire!!!
Hope this helps for someone out there...
Adam
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
show you code and db table struct
-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Very wierd problem ;-(
Hi All
I will try and explain as clearly as I can
I have a message board type of script.
User logs in = no prob
User posts message = No prob can see message on db and retrieve a list
of new posts.
Now the prob.
I am to reply to the message via an admin area by selecting the message
fron a generated list abd click on get message and it should give back
what was said.
When I log in and or create a new user and leave a message I can get all
the details and send a reply.
But when I try and get back the details of a message that someone else
has left I cant get the message and cant reply.
Got me foxed.
What could I be doing wrong?
Any ideas as always appreciated.
Dave Carrera
Php Developer
http://davecarrera.freelancers.net
http://www.davecarrera.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi All
I will try and explain as clearly as I can
I have a message board type of script.
User logs in = no prob
User posts message = No prob can see message on db and retrieve a list
of new posts.
Now the prob.
I am to reply to the message via an admin area by selecting the message
fron a generated list abd click on get message and it should give back
what was said.
When I log in and or create a new user and leave a message I can get all
the details and send a reply.
But when I try and get back the details of a message that someone else
has left I cant get the message and cant reply.
Got me foxed.
What could I be doing wrong?
Any ideas as always appreciated.
Dave Carrera
Php Developer
http://davecarrera.freelancers.net
http://www.davecarrera.com
What are you trying to link to?
Most likely you need to pass a few variables in the
URL
This should give you an idea:
echo "$column_value";
olinux
--- "Franden, Craig" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am using a small php script to return records from
> an oracle8.1.6
> database. I would like to have one of the columns
> contents display the data
> as a hyperlink and I am not quite sure how to do it.
> Here is the code that
> returns the data (which is correct). The table
> formatting is the issue. All
> help is greatly appreciated.
>
> --cbf
>
> / create connection
> if ($connection =
> OCIPLogon("chowder","head","help"))
> {
> //echo "$connection
> ".OCIServerVersion($connection)."\n";
> }
> else
> {
> echo "Couldn't connect to Oracle.\n";
> Exit();
> }
> // create SQL statement
> $sql = "select
> case_id,
> case_desc,
> evnt_code||' - '||evnt_desc,
> sched_date||' - '||start_time
>
> // parse SQL statement
> $sql_statement = OCIParse($connection,$sql)
> or die("Couldn't parse statement.");
>
> // execute SQL query
> OCIExecute($sql_statement)
> or die("Couldn't execute statement.");
> echo OCIError()."";
> // get number of columns for use later
>
> // start results formatting
> $row1 = "#F8";
> $row2 = "#ff";
> $rowcolor = $row1;
>
> echo "";
> echo "
> Case Number
> Case Description
> Event Code & Description
> Scheduled Date & Time
>
> ";
>
> // format results by row
> while (OCIFetch($sql_statement)) {
> echo "";
> $num_columns = OCINumCols($sql_statement);
> for ($i = 1; $i <= $num_columns; $i++) {
> $column_name = OCIColumnName($sql_statement,$i);
> $column_value = OCIResult($sql_statement,$i);
> echo "$column_value";
> }
> echo "";
> if ($rowcolor == $row1) $rowcolor = $row2;
> elseif ($rowcolor == $row2) $rowcolor = $row1;
> }
> echo OCIRowcount($sql_statement) . " records
> returned";
> echo "";
>
> // free resources and close connection
> OCIFreeStatement($sql_statement);
> OCILogoff($connection);
>
> ?>
>
>
> Thanks.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
You need to ensure that mysql.sock has the correct read-write-execute
permissions
Check the mail list archives; this question is asked and answered EVERY week
-Original Message-
From: Liam Gibbs [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 1:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Big Problems Connecting to MySQL
Hi,
I'm having some big problems even running any
mysql_connect commands. I get the results at the
bottom of this e-mail from running a simple
mysql_connect command. Some things to consider are
that I'm accessing my web site through port 8080, and
I'm not sure what username, password, or hostname I
should be using. Does anyone know how to find out what
username, password, and hostname I should be using?
And should I include my port number after my hostname?
Sorry. I'm new at this stuff.
===
Warning: Can't connect to local MySQL server through
socket '/tmp/mysql.sock' (111) in /index.php on line 9
Warning: MySQL Connection Failed: Can't connect to
local MySQL server through socket '/tmp/mysql.sock'
(111) in /index.php on line 9
__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Wow I'm amazed and thankful for such help and advice
I thought I would attack this project piecemeal but that will not give a
clear view that will allow helpful comment without the full view.
I have a website at http://geocities.com/efoxfiles a labor of love
So now it has become so detail intensive that I want to expand the scope
to include all field sports with a
Hunting...Foxhunting, Tree hunting Shooting Sports, Arena
Sports...rodeos, horse events, 4H, all linking to Contact table
Pedigrees...Hound,Whelping Date, Sire, Dam, Owner, Breeder... links to
Contact Table/zip/city/state/address
Timeline...back to Origin of each sportall linking to Contact Table
Field Trial and Show Associations ...linking to Contact table
So I did not present the true picture as I was assuming that I could
piggyback all the tips and replicate them into a complete database.
Practically all cities and zip codes may have to be in linking tables
and the ID used in each categorySo I know just enough to get me in
trouble.
So reflecting what advice I have received to date:
[Sportsmen] name to be registered of www
ContactID
FirstN,MidN,LastN,Suffix,Cityid,Stateid,Zip_Codepk,Addr1,Addr2,Other
Cityid pk
CityName
Stateid pk
Statename
Assnid
Assn (Associations)
Trials/Showsid
Trials/Show
Houndsid
Registry# /*Date to be a Timestamp?...reflecting mmdd001 to infinity
refecting how many hounds born on that date*/
IFSB#
SFSB#
UKC#
AKC#
Whelping Date /*Is there such a thing as Dateid (linking table)*/
Sire (houndid)
Dam (houndid)
Owner (contactid)
Breeder (contactid)
Colorid (20+ color combinations)
/*I have developed a CSS file that will display hound names in a
heirarchial display to display a pedigree. My hope is to be able to use
only the Sireid and Damid to present 5 generations???*/
/*I will have a large server thus excess capacity, php, mysql, pop3,
mailing lists...maybe I can reward some of my helpers down the road*/
Russell Griechen
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi,
I'm having some big problems even running any
mysql_connect commands. I get the results at the
bottom of this e-mail from running a simple
mysql_connect command. Some things to consider are
that I'm accessing my web site through port 8080, and
I'm not sure what username, password, or hostname I
should be using. Does anyone know how to find out what
username, password, and hostname I should be using?
And should I include my port number after my hostname?
Sorry. I'm new at this stuff.
===
Warning: Can't connect to local MySQL server through
socket '/tmp/mysql.sock' (111) in /index.php on line 9
Warning: MySQL Connection Failed: Can't connect to
local MySQL server through socket '/tmp/mysql.sock'
(111) in /index.php on line 9
__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi,
I am using a small php script to return records from an oracle8.1.6
database. I would like to have one of the columns contents display the data
as a hyperlink and I am not quite sure how to do it. Here is the code that
returns the data (which is correct). The table formatting is the issue. All
help is greatly appreciated.
--cbf
/ create connection
if ($connection = OCIPLogon("chowder","head","help"))
{
//echo "$connection ".OCIServerVersion($connection)."\n";
}
else
{
echo "Couldn't connect to Oracle.\n";
Exit();
}
// create SQL statement
$sql = "select
case_id,
case_desc,
evnt_code||' - '||evnt_desc,
sched_date||' - '||start_time
// parse SQL statement
$sql_statement = OCIParse($connection,$sql)
or die("Couldn't parse statement.");
// execute SQL query
OCIExecute($sql_statement)
or die("Couldn't execute statement.");
echo OCIError()."";
// get number of columns for use later
// start results formatting
$row1 = "#F8";
$row2 = "#ff";
$rowcolor = $row1;
echo "";
echo "
Case Number
Case Description
Event Code & Description
Scheduled Date & Time
";
// format results by row
while (OCIFetch($sql_statement)) {
echo "";
$num_columns = OCINumCols($sql_statement);
for ($i = 1; $i <= $num_columns; $i++) {
$column_name = OCIColumnName($sql_statement,$i);
$column_value = OCIResult($sql_statement,$i);
echo "$column_value";
}
echo "";
if ($rowcolor == $row1) $rowcolor = $row2;
elseif ($rowcolor == $row2) $rowcolor = $row1;
}
echo OCIRowcount($sql_statement) . " records returned";
echo "";
// free resources and close connection
OCIFreeStatement($sql_statement);
OCILogoff($connection);
?>
Thanks.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
If I understand your question, when editing an existing record where
StateID = "CA", you want the drop-down to show "California" as
selected.
You need to add a little code into your while loop to echo "SELECTED"
into the appropriate "option" tag.
-Dan
--- Steve Fitzgerald <[EMAIL PROTECTED]> wrote:
> I have the below code that populates a drop down list. The code will
> correctly insert the value $StateID into another a table. The problem
> I am
> running into is that when I select the record to edit the
> drop-downlist has
> the first option as the value instead of what the corresponding
> StateID in
> the column reads. How can I correct this? The form to insert and edit
> have
> the below code and correctly insert the StateID. I tried to write and
> if
> statement to state that if the StateID were == to the StateID in he
> table
> then print selected, but I think I am missing something.
>
> Any suggestions?
>
> Thanks.
>
>
> // populates state drop-down list
>
> $get_stateid_query = mysql_query("SELECT * FROM State INNER JOIN
> RaceResults
> ON State.StateID WHERE RaceID='$RaceID'");
>
> echo " \n";
>
> while ($myrow = mysql_fetch_array($get_stateid_query)) {
>
> echo ' value="'.$myrow["StateID"].'">'.$myrow["StateName"]."\n";
> }
> echo " \n";
> ?>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I'm trying to decipher:
when I select the record to edit the drop-downlist has
the first option as the value instead of what the corresponding
StateID in
the column reads. How can I correct this? The form to insert and
edit have
the below code and correctly insert the StateID
What exactly is happening? Run the script, do a View Source on the
resulting page; show us the HTML generated.
-Original Message-
From: Steve Fitzgerald [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 5:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Selecting Drop Down Value From DB to Edit
I have the below code that populates a drop down list. The code will
correctly insert the value $StateID into another a table. The problem I am
running into is that when I select the record to edit the drop-downlist has
the first option as the value instead of what the corresponding StateID in
the column reads. How can I correct this? The form to insert and edit have
the below code and correctly insert the StateID. I tried to write and if
statement to state that if the StateID were == to the StateID in he table
then print selected, but I think I am missing something.
Any suggestions?
Thanks.
\n";
while ($myrow = mysql_fetch_array($get_stateid_query)) {
echo ' '.$myrow["StateName"]."\n";
}
echo " \n";
?>
--
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
I have the below code that populates a drop down list. The code will
correctly insert the value $StateID into another a table. The problem I am
running into is that when I select the record to edit the drop-downlist has
the first option as the value instead of what the corresponding StateID in
the column reads. How can I correct this? The form to insert and edit have
the below code and correctly insert the StateID. I tried to write and if
statement to state that if the StateID were == to the StateID in he table
then print selected, but I think I am missing something.
Any suggestions?
Thanks.
\n";
while ($myrow = mysql_fetch_array($get_stateid_query)) {
echo ' '.$myrow["StateName"]."\n";
}
echo " \n";
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Adam,
Thanks for the assist.
The query works fine without the ( ) arount the conditions.
Now on to the next part.
George
- Original Message -
From: "Adam Royle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 26, 2002 10:03 PM
Subject: [PHP-DB] Re: PHP/Access problem
SELECT * FROM 'Documents'WHERE (CourseRef='4712' AND
Valid_From<=#26/03/2002# AND Valid_Until>=#26/03/2002#) Order by
Author,Title
should be
SELECT * FROM Documents WHERE (CourseRef='4712' AND
Valid_From<=#26/03/2002# AND Valid_Until>=#26/03/2002#) Order by
Author,Title
your table name should not hae single quotes around it...
adam
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi Dave,
> I am trying to create a registration area that uses a nickname and
email
> pair.
> I need both to be unique.
> So how do I that either do not already exist then if unique insert
into
> db.
> if nickname exist then error = "sorry..."
> if email exist then error = "sorry..."
> else must be unique
> insert.
> I have been trying for hours know but cant get the twin check to work.
> Can get single check to work though.
You do not mention which DBMS you are using but they must all offer
something similar (I shall work with MySQL as an example). If you had
posted your code we might have been able to work directly at that level
to achieve the final tweak...
Set up the db-tbl so that the nickname and email fields are both
constrained as UNIQUE. You can now attempt to INSERT row data and MySQL
will perform all the checks for uniqueness. After the (single row at a
time) INSERT operation check mysql_affected_rows() and if it returns <1
then the INSERT failed (and assuming all else is equal) we'll assume
because the data is not DISTINCT. If you do not need to know which of
the two fields fails this is fine.
If you need to know which field failed the uniqueness test, then precede
the INSERT/UPDATE with:
SELECT COUNT(nickname) AS NicknameTaken, COUNT (email) AS EmailTaken ...
WHERE nickname=value OR email=value
and then running a PHP IF( >0 ) across the two returned values will tell
you that the data is non-DISTINCT and which field(s) are at issue. NB
still follow the actual INSERT/UPDATE with an affected rows check if
your tbl is not locked and multi-user access is allowed!
Man ref: 6.5.3 CREATE TABLE Syntax
(http://www.mysql.com/doc/C/R/CREATE_TABLE.html)
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)]
[table_options] [select_statement]
create_definition:
col_name type [NOT NULL | NULL] [DEFAULT default_value]
[AUTO_INCREMENT]
[PRIMARY KEY] [reference_definition]
orPRIMARY KEY (index_col_name,...)
orKEY [index_name] (index_col_name,...)
orINDEX [index_name] (index_col_name,...)
orUNIQUE [INDEX] [index_name] (index_col_name,...)
...
In MySQL, a UNIQUE key can have only distinct values. An error occurs if
you try to add a new row with a key that matches an existing row.
...
Man ref: 6.4.3 INSERT Syntax (http://www.mysql.com/doc/I/N/INSERT.html)
Similarly 6.4.5 UPDATE Syntax (http://www.mysql.com/doc/U/P/UPDATE.html)
applies if changing/updating values
INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name [(col_name,...)]
VALUES (expression,...),(...),...
...
If you specify the keyword IGNORE in an INSERT with many value rows, any
rows that duplicate an existing PRIMARY or UNIQUE key in the table are
ignored and are not inserted. If you do not specify IGNORE, the insert
is aborted if there is any row that duplicates an existing key value.
PHP man ref:
http://uk.php.net/manual/en/function.mysql-affected-rows.php
Regards,
=dn
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Simple do these checks and you'll be sweet as a nut
Adam
// you might have this at the top of your form to show the error messages
\n";
for($i=0;$i\n";
}
echo "\n";
}
?>
> Hi all
>
>
>
> I am trying to create a registration area that uses a nickname and email
> pair.
>
>
>
> I need both to be unique.
>
>
>
> So how do I that either do not already exist then if unique insert into
> db.
>
>
>
> So
>
> if nickname exist then error = "sorry..."
>
> if email exist then error = "sorry..."
>
> else must be unique
>
> insert.
>
>
>
> I have been trying for hours know but cant get the twin check to work.
>
>
>
> Can get single check to work though.
>
>
>
> I thank you in advance for any thoughts or code examples
>
>
>
> Dave Carrera
>
> Php Developer
>
> http://davecarrera.freelancers.net
>
> http://www.davecarrera.com
Have you looked at or download the mysql.pdf.which is pretty clear and
consise. If you would like to look at other sites go to www.php.net and on
the top part click on links. There around the middle of the page you will
find PHP tutorials. Any place that has PHP tutorials will probably have
mysql. """Justphukit""" and Melonfire.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jennifer: Did you ever get your If else Question answered?
On Mon, 25 Mar 2002, Jennifer Downey wrote:
> Hi all,
>
> I have a table called pets, here is a partial dump:
> At this time this is all I am working with.
>
>
> uid int(10) NOT NULL default '0',
> num_pet tinyint(1) NOT NULL default '1',
>
> There are three steps to adding the pet into the db
>
> Step 1 create the record, this is in create.php. And yes believe it or not
> this does work.
>
> $query_update = "INSERT INTO pets (uid) SELECT uid FROM users WHERE
> uid={$session["uid"]}";
> $result = mysql_query($query_update)
> or die("Unable to insert into the database");
>
> Step 2 Check to see if there is already a pet record this is in process.php.
>
> $query="SELECT num_pet FROM pets WHERE uid={$session["uid"]}";
> $ret = mysql_query($query);
> while(list($num_pet)=
> mysql_fetch_row($ret))
>
> // echo the number in the db, it should = 1 until submit button clicked
> echo $num_pet
>
> $number_pet = $num_pet;
>
>if($number_pet == 0 ) {
>print ("Sorry you can't add another pet");
>}else{ this does all the updating of the record
>
> ?>
>
> Click to continue
>
>
> }
>
> Step three update num_pet after submit is clicked, this is in petdata.php
>
> $db = "update pets set num_pet = 0 where uid={$session["uid"]}";
>$ret = mysql_query($db) or die(db_error());
>
> Now here is my question, If the submit button is clicked and num_pets is
> updated to 0 and you try to add another record shouldn't this print- Sorry
> you can't add another pet?
>
> I am at a loss as to why it will keep adding records. Anyone want to take a
> stab at it?
>
> TIA
> Jen
>
>
>
> --
> 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
Russell,
> I am contemplating a Historical Database
> I barely can spel redundant let alone normalize so I am handicapped.
> The aim is to enter a name only once. I am studying linking tables.
> In the [Contact]
> idContact
>
First_Name,Last_Name,Middle,Suffix,Full_Name,idCity,idState,City_State,i
> dZip_Code,
> Address_1,Address_2,
>
> [City]
> id
> Cityname
>
> id (al, ar etc)
> Statename
>
> [ZipCode]
> id
> Zip_Code
>
> Comment please,
I note two previous responses and agree with the basic premise that if
you are not going to use the three supporting tables for some
information-processing purpose they are overkill, ie if the city, state,
and zip data is purely for information-labeling forget it. Similarly if
your motivation is some sort of space-saving effort, eg idCity=123 takes
less space than "Minneapolis", and multiplied by dozens/hundreds of
instances seems like a good plan; but what is the real cost of disk
storage these days?
However, if this motivation is based on "spelling" - or to be more
constructive, consistency of spelling a given word (eg I have to think
about some of the longer, repeating-character names like Minneapolis -
with apologies to St Paul and all the other good residents of said fair
city) then I will disagree with another correspondent and suggest that
using the City table to construct the combo/list box in a data-entry
form would do wonders for data-entry consistency and spell-checking -
although at the expense of response time if the tables grow to be huge.
Similarly State data-entry will definitely benefit because of the typing
time saved by entering MS instead of M-I-S-S (oops, there's that
spelling and character repetititititition issue again).
The Zip code is unlikely to save space, and depending upon how
'historical' your data/enquiry, of only limited/recent use. The comment
that replaying a five digit zip code with another integer is valid,
however it is also parochial in that many non-US countries use
postal/location codes that are not exclusively numeric. If 'history'
spans more than 200 years the observation is that there will be no zip
code to enter and the data will likely require an additional field:
Country! At which point it is worth mentioning that "State" is a
parochial term too - many countries don't use them/know their regional
subdivisions by that term.
I don't think anyone has mentioned City_State. What is the purpose of
this field given that there are already two separate fields?
You have gone to quite a bit of detail with the physical address and
(normalising) breaking out repeating components into separate
sub-tables, however what about the concept of a person moving about?
Should there be allowance for the fact that an address was only good on
a particular date or for a given period of history? Perhaps this is the
purpose behind Address_1 and Address_2 (except there is no temporal
component)? Why would you have one person and three addresses - and why
in a single db row? Shouldn't there be three address rows (or however
many are necessary) for each person - how would you otherwise construct
a search based upon place, or place and time?
There is a Suffix but not a Prefix, eg "Sir" or "Captain".
There is space for formal names, but not for nicknames, eg a lot of
people are known by their initials, or some familial address, eg "Doc"
(never play cards with him) - my buddy calls me "Buckwheat" for some
reason beyond my understanding but presumably because he thinks I am a
little...
Hope this is a little...helpful,
=dn
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
46 matches
Mail list logo
|