Re: [PHP-DB] Contact Database php_mysql

2002-03-27 Thread DL Neil

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




Re: [PHP-DB] If else Question

2002-03-27 Thread ted

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

 ?
 form action=petdata.php method=post
 Click to continueBR
 INPUT TYPE=submit VALUE=Submit NAME=submit
 /form
 ?
 }

 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




[PHP-DB] Re: procedures?

2002-03-27 Thread Ron

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




[PHP-DB] Re: Checking for 2 unique row contents

2002-03-27 Thread Adam Royle

Simple do these checks and you'll be sweet as a nut

Adam

?php

$sql = SELECT nickname FROM tblUsers WHERE nickname = '$nickname'';
$result = mysql_query($sql);

$sql = SELECT email FROM tblUsers WHERE email = '$email';
$result2 = mysql_query($sql);

if (mysql_num_rows($result)){
$error[] = That nickname is already chosen;
}

if (mysql_num_rows($result2)){
$error[] = That username is already chosen;
}

if (!$error){
// do the inserting here
}

?


// you might have this at the top of your form to show the error messages
?php
if ($error){
echo p class=\msg\\n;
for($i=0;$icount($error);$i++){
echo $error[$i] . br\n;
}
echo /p\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



Re: [PHP-DB] Checking for 2 unique row contents

2002-03-27 Thread DL Neil

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




Re: [PHP-DB] Re: PHP/Access problem

2002-03-27 Thread George Pitcher

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




[PHP-DB] Selecting Drop Down Value From DB to Edit

2002-03-27 Thread Steve Fitzgerald

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.

?php

// populates state drop-down list

$get_stateid_query = mysql_query(SELECT * FROM State INNER JOIN RaceResults
ON State.StateID WHERE RaceID='$RaceID');

echo  select name=\StateID\\n;

while ($myrow = mysql_fetch_array($get_stateid_query)) {

echo ' option
value='.$myrow[StateID].''.$myrow[StateName]./option\n;
}
echo  /select\n;
?



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




RE: [PHP-DB] Selecting Drop Down Value From DB to Edit

2002-03-27 Thread Rick Emery

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.

?php

// populates state drop-down list

$get_stateid_query = mysql_query(SELECT * FROM State INNER JOIN RaceResults
ON State.StateID WHERE RaceID='$RaceID');

echo  select name=\StateID\\n;

while ($myrow = mysql_fetch_array($get_stateid_query)) {

echo ' option
value='.$myrow[StateID].''.$myrow[StateName]./option\n;
}
echo  /select\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




Re: [PHP-DB] Selecting Drop Down Value From DB to Edit

2002-03-27 Thread Dan Harrelson

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.
 
 ?php
 
 // populates state drop-down list
 
 $get_stateid_query = mysql_query(SELECT * FROM State INNER JOIN
 RaceResults
 ON State.StateID WHERE RaceID='$RaceID');
 
 echo  select name=\StateID\\n;
 
 while ($myrow = mysql_fetch_array($get_stateid_query)) {
 
 echo ' option
 value='.$myrow[StateID].''.$myrow[StateName]./option\n;
 }
 echo  /select\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




[PHP-DB] formatting table column to display as a hyperlink using Oracle

2002-03-27 Thread Franden, Craig

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).BR\n; 
} 
else 
{ 
echo Couldn't connect to Oracle.BR\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().BR; 
// get number of columns for use later 

// start results formatting 
$row1 = #F8; 
$row2 = #ff; 
$rowcolor = $row1; 

echo TABLE BORDER=0; 
echo TR 
THCase Number/TH 
THCase Description/TH 
THEvent Code  Description/TH 
THScheduled Date  Time/TH 
/TR 
; 

// format results by row 
while (OCIFetch($sql_statement)) { 
echo TR BGCOLOR='$rowcolor'; 
$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 TD$column_value/TD; 
} 
echo /TR; 
if ($rowcolor == $row1) $rowcolor = $row2; 
elseif ($rowcolor == $row2) $rowcolor = $row1; 
} 
echo OCIRowcount($sql_statement) .  records returned; 
echo /TABLE; 

// free resources and close connection 
OCIFreeStatement($sql_statement); 
OCILogoff($connection); 

?/p


Thanks.

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




[PHP-DB] Big Problems Connecting to MySQL

2002-03-27 Thread Liam Gibbs

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




Re: [PHP-DB] Contact Database php_mysql

2002-03-27 Thread Russell Griechen

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




RE: [PHP-DB] Big Problems Connecting to MySQL

2002-03-27 Thread Rick Emery

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




Re: [PHP-DB] formatting table column to display as a hyperlink using Oracle

2002-03-27 Thread olinux

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 TDA
HREF=whateverpage.php?var1=$var1record=$column_value$column_value/ATD;

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).BR\n; 
 } 
 else 
 { 
 echo Couldn't connect to Oracle.BR\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().BR; 
 // get number of columns for use later 
 
 // start results formatting 
 $row1 = #F8; 
 $row2 = #ff; 
 $rowcolor = $row1; 
 
 echo TABLE BORDER=0; 
 echo TR 
 THCase Number/TH 
 THCase Description/TH 
 THEvent Code  Description/TH 
 THScheduled Date  Time/TH 
 /TR 
 ; 
 
 // format results by row 
 while (OCIFetch($sql_statement)) { 
 echo TR BGCOLOR='$rowcolor'; 
 $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 TD$column_value/TD; 
 } 
 echo /TR; 
 if ($rowcolor == $row1) $rowcolor = $row2; 
 elseif ($rowcolor == $row2) $rowcolor = $row1; 
 } 
 echo OCIRowcount($sql_statement) .  records
 returned; 
 echo /TABLE; 
 
 // free resources and close connection 
 OCIFreeStatement($sql_statement); 
 OCILogoff($connection); 
 
 ?/p
 
 
 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




[PHP-DB] Very wierd problem ;-(

2002-03-27 Thread Dave Carrera

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

 

 




RE: [PHP-DB] Very wierd problem ;-(

2002-03-27 Thread Rick Emery

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




[PHP-DB] Advice to PHP beginners

2002-03-27 Thread Adam Royle

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:

?php if ($condition){ echo correct;} else {
echo 'what';
if (!$condition2){
include 'thing.php';
while (!$dead)
{ if ($jam!= $yes){ $dead = true;
} else{
for ($i=0;$i100;$i++)
{ $thing = processSomething('something', something2);
$string = 'something'.$here.too;
}
?

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:

?php

if ($condition){
echo correct;
} else {
echo what;
if (!$condition2){
include ('thing.php');
while (!$dead){
if ($jam != $yes){
$dead = true;
} else {
for ($i=0;$i100;$i++){
$thing = processSomething(something, 
something2);
$string = something $here too;
}
}
}
}
}

?

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




[PHP-DB] retrieving one record at a time

2002-03-27 Thread Natividad Castro

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




[PHP-DB] Looking for a recent inserted record

2002-03-27 Thread Jairo Tcatchenco

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




Re: [PHP-DB] retrieving one record at a time

2002-03-27 Thread Josh Trutwin

 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




Re: [PHP-DB] Selecting Drop Down Value From DB to Edit

2002-03-27 Thread Steve Fitzgerald

This is the entire code for the page edit_race.php

?php

// editrace.php - edit race results

?
?php

// includes
 include(../includes/config.php);
 include(../includes/functions.php);

// open database connection
  $connection = mysql_connect($host, $user, $pass) or die (Unable to
connect!);

// select database
  mysql_select_db($db) or die (Unable to select database!);

// generate and execute query
  $get_raceresults_query = SELECT * FROM RaceResults WHERE RaceID =
'$RaceID';
  $get_raceresults_result = mysql_query($get_raceresults_query) or die
(Error in query: $get_raceresults_query.  . mysql_error());

// if a result is returned
if (mysql_num_rows($get_raceresults_result) 0)

 // turn it into an object
 $row = mysql_fetch_object($get_raceresults_result);

?

html
head
titleRace Results: Edit Race Results/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
link rel=stylesheet href=../css/styles.css type=text/css
script language=javascript src=../scripts/CascadeMenu.js/script
script language=JavaScript src=../scripts/ts_picker4.js/script/head

body OnLoad=InitMenu() Onclick=HideMenu(menuBar) ID=Bdy
bgcolor=#FF text=#00 topmargin=0 leftmargin=0
marginwidth=0 marginheight=0

form action=do_editrace.php method=POST enctype=multipart/form-data
  table width=799 border=0 cellpadding=0 cellspacing=0
bgcolor=#ff
tr
  td width=339 height=112 valign=top
bgcolor=#0066ccnbsp;/td
  td width=460 valign=top rowspan=2
?php include (../includes/nav.php3);?


input type=hidden name=RaceID value=?php echo $RaceID; ?


  /td
/tr
tr
  td height=16/td
/tr
tr
  td height=12/td
  td/td
/tr
  /table
  table width=800 border=0 cellpadding=0 cellspacing=0
tr
  td width=10 bgcolor=#ff height=25
  td valign=middle colspan=2 class=raceresutlstitle
bgcolor=#ffAdmin
gt; Add a Race/td
  /tr
tr
  td width=10 bgcolor=#CC
  td width=131 valign=middle height=25 class=raceresutlstitle
bgcolor=#CCRace
Date:/td
  td width=660 valign=middle bgcolor=#CC
input type=Text name=RaceDate value=?php echo $row-RaceDate; ?
/td
/tr
tr
  td width=10
  td valign=middle height=25 class=raceresutlstitleRace
Name:/td
  td valign=middle
input type=text name=RaceName value=?php echo $row-RaceName;
?
  /td
/tr
tr
  td width=10 bgcolor=#CC
  td valign=middle height=25 class=raceresutlstitle
bgcolor=#CCRace
Distance:/td
  td valign=middle bgcolor=#CC

?php

// populates race distance drop-down list

$get_racedistid_query = mysql_query(SELECT * FROM RaceDistance INNER JOIN
RaceResults ON RaceDistance.RaceDistID WHERE RaceID='$RaceID');

echo  select name=\RaceDistID\\n;

while ($myrow = mysql_fetch_array($get_racedistid_query)) {

echo ' option
value='.$myrow[RaceDistID].''.$myrow[RaceDistName]./option\n;
}
echo  /select\n;
?

  /td
/tr
tr
  td width=10
  td valign=middle height=25 class=raceresutlstitleRace Type:


/td
td valign=middle class=newstxt



?php

// populates race type drop-down list

$get_racetypeid_query = mysql_query(SELECT * FROM RaceType INNER JOIN
RaceResults ON RaceType.RaceTypeID WHERE RaceID='$RaceID');

echo  select name=\RaceTypeID\\n;

while ($myrow = mysql_fetch_array($get_racetypeid_query)) {

echo ' option
value='.$myrow[RaceTypeID].''.$myrow[RaceTypeName]./option\n;
}
echo  /select\n;
?
/td
/tr
tr
  td width=10 bgcolor=#CC
  td valign=middle height=25 class=raceresutlstitle
bgcolor=#CCRace
Time:/td
  td valign=middle bgcolor=#CC span class=hdtxtHH
input type=text name=RaceTimeHH size=2 maxlength=2
value=? echo $row-RaceTimeHH; ??php if ($row-RaceTimeHH ==0) print
0;?
MM
input type=text name=RaceTimeMM size=2 maxlength=2
value=?php echo $row-RaceTimeMM; ?
SS
input type=text name=RaceTimeSS size=2 maxlength=2
value=?php echo $row-RaceTimeSS; ?
/span/td
/tr
tr
  td width=10
  td valign=middle height=25 class=raceresutlstitleRace
Pace:/td
  td valign=middle span class=hdtxt MM
input type=text name=RacePaceMM size=2 maxlength=2
value=? echo $row-RacePaceMM; ?
SS
input type=text name=RacePaceSS size=2 maxlength=2
value=? echo $row-RacePaceSS; ?
/span/td
/tr
tr
  td width=10 bgcolor=#CC
  td valign=middle height=25 class=raceresutlstitle
bgcolor=#CC#
of Comp.:/td
  td valign=middle bgcolor=#CC
input type=text name=RaceNumbComp value=?php echo
$row-RaceNumbComp; ?
  /td
/tr
tr
  td width=10 bgcolor=#ff
  td valign=middle height=25 class=raceresutlstitle
bgcolor=#ffRace
Place:/td
  td valign=middle bgcolor=#ff
input type=text name=RacePlace value=?php echo
$row-RacePlace; ?
  /td
/tr
tr
  td width=10 bgcolor=#cc
  td valign=middle 

[PHP-DB] include() statement hell!

2002-03-27 Thread Brad Melendy

Ok, I've spent some time reading the docs at php.net and I'm still confused.

After a couple hours, I have an include file working with a statement like:

include (dblib.inc);

However, to add to my confusion, I've got a second include file statement on
the next line:

include (userlib.inc);

And that doesn't work.

Most crazy of all, if I just put the darn functions all in the PHP file that
is trying to call the include files, everything works perfectly.

So far I have my include_path line in the pho.ini file set to no value since
I'm just using include files that exist in the same directory as the calling
php file.  this after I could NOT get the files to be properly recognized
from their own include directory.  As far as I'm concerned, you should be
able to include a relative path with the included filename and have it work.
Too bad that doesn't work in PHP.

So, long story short, I'm about to give up on include statements and just
copy and paste my functions all over the place.  Does anyone have any ideas
why this is so difficult for me?  What am I missing?  This stuff is easy in
ASP but PHP is giving me serious heart-ache.  :-(

Thanks for any tips or suggestions.

Brad



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




[PHP-DB] include files don't work???

2002-03-27 Thread Brad Melendy

Hi All,
This is strange.  I've got some functions I want to include in my PHP
documents.  Well, I can never get anything to work if I include the file
that holds the functions, but, if I insert the functions into the PHP
document in question, everything works??

Now, I've checked to ensure that the path in the include statement is
correct and I never get any errors about it not being able to find the
include file.  Also, I've ensured that the functions in the included
document are enclosed with ?php ? tags at the top and bottom.

So, I'm looking for other possible gotchas or bugs in the include
statement??  Thanks in advance for any help.  I don't know what I could be
doing wrong.

Brad





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




[PHP-DB] parsing 2 results per row in different td's

2002-03-27 Thread valentino

i'm having trouble telling php to format the output of a mysql query correctly. i
not only want to loop the output in simple table rows (meaning that php parses one
result per row), instead i want php to parse two results per row in different
td's. no clue what i'm talking about? take my following simplyfied code:

$result = mysql_query(SELECT * FROM news);
...
while ( $row = mysql_fetch_array($result) ):
...
tr
td?=$row[newsBODY]?/td
/tr

endwhile;
---
the output would look like:
html
tr
tdblabla/td
/tr
tr
tdlalala/td
/tr
tr
tddoowaadee/td
/tr
tr
tdyipeeiyo/td
/tr
--and so on--

what i want is the following output
tr
tdblablabla/td
tdlalala/td
/tr
tr
tddoowaadee/td
tdyipeeiyo/td
/tr
--and so on--

got the point?

i really do appreciate your help!

thx,

val


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




[PHP-DB] Re: OT - [PHP-DB] Advice to PHP beginners

2002-03-27 Thread -BD-


did the tabs get stripped in your mail, or is there a reason the code
couldn't be written like the following?
i'm curious, since this is the way i do 90% of my code - makes it easy to
see what's going on... but i dunno about performance or parsing impact
(never gave it much thought until now)...?

newbily yours...

?php

if ($condition){
echo correct;
} else {
echo what;
if (!$condition2){
include ('thing.php');
while (!$dead){
if ($jam != $yes){
$dead = true;
} else {
for ($i=0;$i100;$i++){
$thing = processSomething(something, something2);
$string = something $here too;
}
}
}
}
}

?


- Original Message -
From: Adam Royle [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 27, 2002 4:44 PM
Subject: [PHP-DB] Advice to PHP beginners


 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:

 ?php if ($condition){ echo correct;} else {
 echo 'what';
 if (!$condition2){
 include 'thing.php';
 while (!$dead)
 { if ($jam!= $yes){ $dead = true;
 } else{
 for ($i=0;$i100;$i++)
 { $thing = processSomething('something', something2);
 $string = 'something'.$here.too;
 }
 ?

 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:

 ?php

 if ($condition){
 echo correct;
 } else {
 echo what;
 if (!$condition2){
 include ('thing.php');
 while (!$dead){
 if ($jam != $yes){
 $dead = true;
 } else {
 for ($i=0;$i100;$i++){
 $thing = processSomething(something, something2);
 $string = something $here too;
 }
 }
 }
 }
 }

 ?

 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




RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Rick Emery

did you start each include file with:
?php
?

If not, PHP treats the code within as straight text

-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 5:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] include() statement hell!


Ok, I've spent some time reading the docs at php.net and I'm still confused.

After a couple hours, I have an include file working with a statement like:

include (dblib.inc);

However, to add to my confusion, I've got a second include file statement on
the next line:

include (userlib.inc);

And that doesn't work.

Most crazy of all, if I just put the darn functions all in the PHP file that
is trying to call the include files, everything works perfectly.

So far I have my include_path line in the pho.ini file set to no value since
I'm just using include files that exist in the same directory as the calling
php file.  this after I could NOT get the files to be properly recognized
from their own include directory.  As far as I'm concerned, you should be
able to include a relative path with the included filename and have it work.
Too bad that doesn't work in PHP.

So, long story short, I'm about to give up on include statements and just
copy and paste my functions all over the place.  Does anyone have any ideas
why this is so difficult for me?  What am I missing?  This stuff is easy in
ASP but PHP is giving me serious heart-ache.  :-(

Thanks for any tips or suggestions.

Brad



-- 
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] retrieving one record at a time

2002-03-27 Thread mike

try using your id column of the table

Select * from table where table_id=1
using mysql_fetch_array with the above query will work.

Mike
- Original Message -
From: Natividad Castro [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 27, 2002 5:04 PM
Subject: [PHP-DB] retrieving one record at a time


 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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.330 / Virus Database: 184 - Release Date: 2/28/02


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




RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Jonathan Hilgeman

#1. You may want to double-check the path where you're calling it from in
case you're working with subdirectories. 

Let's saying you access a page at www.domain.com/page.php which calls
www.domain.com/includes/header.inc.
Then, header.inc includes the dblib.inc file at
www.domain.com/includes/dblib.inc. However, the include's base directory
will still be in page.php - the directory won't change to includes, so for
header.inc to include dblib.inc, it has to say:
  include(includes/dblib.inc);
NOT
  include(dblib.inc);
Otherwise, it will be trying to include www.domain.com/dblib.inc because the
page that started the whole chain reaction of includes is located at
www.domain.com/page.php

#2. If you have error reporting turned off, and there is a parsing error in
your files, the page may just die without giving a reason. Try turning off
any error reporting and also access those include files like userlib.inc
directly in your web browser to see if PHP reports any errors. You may need
to change the extension to something like userlib.inc.php for the web server
to recognize the request correctly. 

#3. Please give us a little more detail on the errors you're getting (any
specific messages would be nice).

- Jonathan

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 3:42 PM
To: 'Brad Melendy'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] include() statement hell!


did you start each include file with:
?php
?

If not, PHP treats the code within as straight text

-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 5:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] include() statement hell!


Ok, I've spent some time reading the docs at php.net and I'm still confused.

After a couple hours, I have an include file working with a statement like:

include (dblib.inc);

However, to add to my confusion, I've got a second include file statement on
the next line:

include (userlib.inc);

And that doesn't work.

Most crazy of all, if I just put the darn functions all in the PHP file that
is trying to call the include files, everything works perfectly.

So far I have my include_path line in the pho.ini file set to no value since
I'm just using include files that exist in the same directory as the calling
php file.  this after I could NOT get the files to be properly recognized
from their own include directory.  As far as I'm concerned, you should be
able to include a relative path with the included filename and have it work.
Too bad that doesn't work in PHP.

So, long story short, I'm about to give up on include statements and just
copy and paste my functions all over the place.  Does anyone have any ideas
why this is so difficult for me?  What am I missing?  This stuff is easy in
ASP but PHP is giving me serious heart-ache.  :-(

Thanks for any tips or suggestions.

Brad



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

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

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




[PHP-DB] Another Drop down question

2002-03-27 Thread Kim Kohen

Hello all,

I'm trying for the first time to use a dynamically created popup menu from a
mysql database.  The menu is of (article) writers' names and will be used in
a select query.

Using snippets of code I've gleaned from here and the mysql list, I've the
popup working fine but I'd like to include either a blank entry or a 'Search
all Writers' entry in the menu and this is where I'm stuck.

The code I have is:

$getlist = mysql_query(SELECT distinct Writer FROM stories);
echo  select name=\WriterName\\n;
while ($row = mysql_fetch_array($getlist)) {
echo ' option value='.$row[Writer].''.$row[Writer]./option\n;
}
echo  /select\n;

If anyone could point me in the right direction or direct me to appropriate
documentation I'd be most appreciative.

Cheers and thanks

kim


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




Re: [PHP-DB] Another Drop down question

2002-03-27 Thread szii

The easiest way...

 $getlist = mysql_query(SELECT distinct Writer FROM stories);
 echo  select name=\WriterName\\n;

   echo option value='All'Search All/option;
 
 while ($row = mysql_fetch_array($getlist)) {
 echo ' option value='.$row[Writer].''.$row[Writer]./option\n;
 }
 echo  /select\n;

-Szii

- Original Message - 
From: Kim Kohen [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Wednesday, March 27, 2002 5:18 PM
Subject: [PHP-DB] Another Drop down question


 Hello all,
 
 I'm trying for the first time to use a dynamically created popup menu from a
 mysql database.  The menu is of (article) writers' names and will be used in
 a select query.
 
 Using snippets of code I've gleaned from here and the mysql list, I've the
 popup working fine but I'd like to include either a blank entry or a 'Search
 all Writers' entry in the menu and this is where I'm stuck.
 
 The code I have is:
 
 $getlist = mysql_query(SELECT distinct Writer FROM stories);
 echo  select name=\WriterName\\n;
 while ($row = mysql_fetch_array($getlist)) {
 echo ' option value='.$row[Writer].''.$row[Writer]./option\n;
 }
 echo  /select\n;
 
 If anyone could point me in the right direction or direct me to appropriate
 documentation I'd be most appreciative.
 
 Cheers and thanks
 
 kim
 
 
 -- 
 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] Another Drop down question

2002-03-27 Thread Kim Kohen

G'day szii,

 The easiest way...
 $getlist = mysql_query(SELECT distinct Writer FROM stories);
 echo  select name=\WriterName\\n;
  echo option value='All'Search All/option;

I love simple solutions:)

Cheers and  many thanks

kim


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




Re: [PHP-DB] include() statement hell!

2002-03-27 Thread Brad Melendy

Hi Rick,
Yes, this is the first thing I checked.  Thanks for your suggestion.

...Brad

Rick Emery [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 did you start each include file with:
 ?php
 ?

 If not, PHP treats the code within as straight text

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 5:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] include() statement hell!


 Ok, I've spent some time reading the docs at php.net and I'm still
confused.

 After a couple hours, I have an include file working with a statement
like:

 include (dblib.inc);

 However, to add to my confusion, I've got a second include file statement
on
 the next line:

 include (userlib.inc);

 And that doesn't work.

 Most crazy of all, if I just put the darn functions all in the PHP file
that
 is trying to call the include files, everything works perfectly.

 So far I have my include_path line in the pho.ini file set to no value
since
 I'm just using include files that exist in the same directory as the
calling
 php file.  this after I could NOT get the files to be properly recognized
 from their own include directory.  As far as I'm concerned, you should be
 able to include a relative path with the included filename and have it
work.
 Too bad that doesn't work in PHP.

 So, long story short, I'm about to give up on include statements and just
 copy and paste my functions all over the place.  Does anyone have any
ideas
 why this is so difficult for me?  What am I missing?  This stuff is easy
in
 ASP but PHP is giving me serious heart-ache.  :-(

 Thanks for any tips or suggestions.

 Brad



 --
 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] include() statement hell!

2002-03-27 Thread Brad Melendy

Thanks Jonathan,
I'm trying to include a file /includes/dblib.inc from /main/page.php.  In
/main/page.php I use include(includes/dblib.inc);.  When that didn't work,
I tried copying the file to /main/ and including it there and that didn't
work either.  Finally, I tried adding a specific path to the php.ini file
for includes_path and put the files there and that worked.  Then I went and
changed the php.ini file to remove the reference (still trying to get it to
work the way I THINK it should) and then it WORKED!  But ONLY from within
/main/.  Each time I make these changes, I am making a matching change in
the actual include() statement at the top of /main/page.php and I am
restarting apache each time I change php.ini.

So, maybe this is the question.  Can you include a file from /main/page.php
by using a path of /includes/dblib.inc?

dblib.inc has functions that do connections and queries to a mysql database.
Even stranger yet, is that I have one other include file called userlib.inc
that has authentication related session functions.  Well, that hasn't worked
at all no matter what, unless I put the functions in /includes/userlib.inc
directly into the file /main/page.php.  Once there, all the functions work
fine.  Otherwise, the only error messages I get are regarding unknown
functions being referenced, yet, I never get an error that the include files
can't be found.  It's all crazy to me.

Currently, both of my include files are called directly with two lines like:

include(dblib.inc);
include(userlib.inc);

They are both located in /main/ along side page.php which is calling them.
They both seem to work this way, but as soon as I place them in /includes/
and try to call them using:

include(includes/dblib.inc);
include(includes/userlib.inc);

I get errors saying that the functions can't be found, however, no errors
saying it can't find the include files??

Lastly, even with both include files in /main/ I still have some strange
problem with my userlib.inc file because the single function that is in
there won't work unless the function is pasted directly into /main/page.php.

I think I've made this message way too long but I appreciate your help.
I've got the page working reliably with the functions all pasted into
page.php but not while including those functions.  I just can't think of
what could be making it difference.  The functions are all the same, just
running from an include file is a problem.

Thanks again, just writing this up has helped to make more sense to me.  I
think the crux of the whole thing is the path.  I'm using to including files
in ASP and those can be relative so something like ../includes/dblib.inc
works great.

...Brad



Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 #1. You may want to double-check the path where you're calling it from in
 case you're working with subdirectories.

 Let's saying you access a page at www.domain.com/page.php which calls
 www.domain.com/includes/header.inc.
 Then, header.inc includes the dblib.inc file at
 www.domain.com/includes/dblib.inc. However, the include's base directory
 will still be in page.php - the directory won't change to includes, so for
 header.inc to include dblib.inc, it has to say:
   include(includes/dblib.inc);
 NOT
   include(dblib.inc);
 Otherwise, it will be trying to include www.domain.com/dblib.inc because
the
 page that started the whole chain reaction of includes is located at
 www.domain.com/page.php

 #2. If you have error reporting turned off, and there is a parsing error
in
 your files, the page may just die without giving a reason. Try turning off
 any error reporting and also access those include files like userlib.inc
 directly in your web browser to see if PHP reports any errors. You may
need
 to change the extension to something like userlib.inc.php for the web
server
 to recognize the request correctly.

 #3. Please give us a little more detail on the errors you're getting (any
 specific messages would be nice).

 - Jonathan

 -Original Message-
 From: Rick Emery [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 3:42 PM
 To: 'Brad Melendy'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] include() statement hell!


 did you start each include file with:
 ?php
 ?

 If not, PHP treats the code within as straight text

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 5:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] include() statement hell!


 Ok, I've spent some time reading the docs at php.net and I'm still
confused.

 After a couple hours, I have an include file working with a statement
like:

 include (dblib.inc);

 However, to add to my confusion, I've got a second include file statement
on
 the next line:

 include (userlib.inc);

 And that doesn't work.

 Most crazy of all, if I just put the darn functions all in the PHP file
that
 is trying to call the include files, everything works 

Re: [PHP-DB] Contact Database php_mysql

2002-03-27 Thread Russell Griechen

Thanks for the advice
So reflecting what advice I have received to date:

Assuming that the Contact table would be used for:
Owners, Breeders, Sportsmen, Ancestors, Associations, and a myriad of
other categories of mankind, would the  following normalization be
prudent?

ContactID
FirstN,MidN,LastN,Suffix,Cityid,Stateid,Zip_Code_pk,Addr1,Addr2,Other

Cityid pk
CityName
/*?? What about Norwood, MO...Norwood, MA*/

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
Colorname(20+ color combinations)

$table_name = Chart_Users;
$sql = SELECT * FROM $table_name order by album_title;
$result = @mysql_query($sql,$connection) or die( Couldn't execute
query.);
//if(! $result = mysql_query($sql,$connection)) {
  //print(ERROR .mysql_errno().:
.mysql_error().br\n$sqlbr\n);
 //  }

 while ($row = mysql_fetch_array($result)) {
 $id = $row['id'];
 $username = $row['username'];
 $title1 = $row['album_title'];
 $title = stripslashes($title1);

  $sql1 = SELECT COUNT(*) FROM Chart_Files where id = '$id';
  $result1 = @mysql_query($sql1,$connection) or die( Couldn't execute
query.);
  //if(! $result = mysql_query($sql1,$connection)) {
  //print(ERROR .mysql_errno().:
.mysql_error().br\n$sqlbr\n);
   //}
   $count = mysql_result($result1,0,count(*));

$sql2 = SELECT date_format(date, '%b. %D, %Y') as date1 FROM
Chart_Files where id = '$id' order by photoid desc limit 1;
$result2 = @mysql_query($sql2,$connection) or die( Couldn't execute
query.);
$row = mysql_fetch_array($result2);
$date1 = $row['date1'];

if ($count  0) {

 $display_block .= trtd nowrap align=\left\ba
  href=\display_album.php?id=$id\$titlenbsp;/a/b/tdtd
align=\left\$count/tdtd align=\right\ nowrap$date1/td/tr;
}
 }


The first thing I see, do you need all of the fields in your SELECT *
statement?

Jeff Oien wrote:
Hi Jeff,

the most important rule you should follow: don't query the database
in a loop to avoid a join! The following lines (maybe some changes
are necesary) will do the same job as your code, but considerable
faster.
Especially if 'id' is an index in both tables.

Lutz


$sql = 'SELECT u.id, u.username, u.album_title,'
.' date_format(MAX(f.date), '%b. %D, %Y') as date1,'
.' COUNT(*) AS cnt'
   .' FROM Chart_Users AS u'
  .' INNER JOIN Chart_Files AS f USING (id)'
  .' GROUP BY f.id'
  .' ORDER BY u.album_title ASC';

$result = @mysql_query($sql,$connection) or die( Couldn't execute
query.);

while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$username = $row['username'];
$title1 = $row['album_title'];
$title = stripslashes($title1);
$date1 = $row['date1'];

$display_block .= trtd nowrap align=\left\ba
$href=\display_album.php?id=$id\$titlenbsp;/a/b/tdtd
align=\left\$cnt/tdtd align=\right\ nowrap$date1/td/tr;
}


[EMAIL PROTECTED] (Jeff Oien) writes:

 Here is some code I have for an index page of people who post
 charts on the Web, kind of like Yahoo Photos or something.
 It displays the album title, number of images and date of last
 upload. The page takes about 5-6 seconds to load which is all
 in the queries I'm sure. Is there a way I can make this more
efficient?
 http://www.webdesigns1.com/temp/code.txt
 Jeff

 --

 $table_name = Chart_Users;
 $sql = SELECT * FROM $table_name order by album_title;
 $result = @mysql_query($sql,$connection) or die( Couldn't execute
query.);
 //if(! $result = mysql_query($sql,$connection)) {
   //  print(ERROR .mysql_errno().:
.mysql_error().br\n$sqlbr\n);
 // }

 while ($row = mysql_fetch_array($result)) {
 $id = $row['id'];
 $username = $row['username'];
 $title1 = $row['album_title'];
 $title = stripslashes($title1);

 $sql1 = SELECT COUNT(*) FROM Chart_Files where id = '$id';
 $result1 = @mysql_query($sql1,$connection) or die( Couldn't execute
query.);
 //if(! $result = mysql_query($sql1,$connection)) {
 //print(ERROR .mysql_errno().:
.mysql_error().br\n$sqlbr\n);
 //}
 $count = mysql_result($result1,0,count(*));

 $sql2 = SELECT date_format(date, '%b. %D, %Y') as date1 FROM
Chart_Files where
 id = '$id' order by photoid desc limit 1;
 $result2 = @mysql_query($sql2,$connection) or die( Couldn't execute
query.);
 $row = mysql_fetch_array($result2);
 $date1 = $row['date1'];

 if ($count  0) {

 $display_block .= trtd nowrap align=\left\ba
 href=\display_album.php?id=$id\$titlenbsp;/a/b/tdtd
 align=\left\$count/tdtd align=\right\
nowrap$date1/td/tr;
 }
 }

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Fantastic! I'm going to have to study the code more to really understand
it. Thanks 

RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Dan Brunner

Has anybody told him to check his PHP.INI???

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 6:28 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] include() statement hell!

#1. You may want to double-check the path where you're calling it from
in
case you're working with subdirectories. 

Let's saying you access a page at www.domain.com/page.php which calls
www.domain.com/includes/header.inc.
Then, header.inc includes the dblib.inc file at
www.domain.com/includes/dblib.inc. However, the include's base directory
will still be in page.php - the directory won't change to includes, so
for
header.inc to include dblib.inc, it has to say:
  include(includes/dblib.inc);
NOT
  include(dblib.inc);
Otherwise, it will be trying to include www.domain.com/dblib.inc because
the
page that started the whole chain reaction of includes is located at
www.domain.com/page.php

#2. If you have error reporting turned off, and there is a parsing error
in
your files, the page may just die without giving a reason. Try turning
off
any error reporting and also access those include files like userlib.inc
directly in your web browser to see if PHP reports any errors. You may
need
to change the extension to something like userlib.inc.php for the web
server
to recognize the request correctly. 

#3. Please give us a little more detail on the errors you're getting
(any
specific messages would be nice).

- Jonathan

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 3:42 PM
To: 'Brad Melendy'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] include() statement hell!


did you start each include file with:
?php
?

If not, PHP treats the code within as straight text

-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 5:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] include() statement hell!


Ok, I've spent some time reading the docs at php.net and I'm still
confused.

After a couple hours, I have an include file working with a statement
like:

include (dblib.inc);

However, to add to my confusion, I've got a second include file
statement on
the next line:

include (userlib.inc);

And that doesn't work.

Most crazy of all, if I just put the darn functions all in the PHP file
that
is trying to call the include files, everything works perfectly.

So far I have my include_path line in the pho.ini file set to no value
since
I'm just using include files that exist in the same directory as the
calling
php file.  this after I could NOT get the files to be properly
recognized
from their own include directory.  As far as I'm concerned, you should
be
able to include a relative path with the included filename and have it
work.
Too bad that doesn't work in PHP.

So, long story short, I'm about to give up on include statements and
just
copy and paste my functions all over the place.  Does anyone have any
ideas
why this is so difficult for me?  What am I missing?  This stuff is easy
in
ASP but PHP is giving me serious heart-ache.  :-(

Thanks for any tips or suggestions.

Brad



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

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

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



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




RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Photocon

At 22:41 3/27/2002 -0600, Dan Brunner wrote:
Has anybody told him to check his PHP.INI???

How about adding the following to httpd.conf:

php_value include_path .:/usr/share/php:/path/to/webpages


--Photocon
Conrad Hunziker III
www.nightskyent.com


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




[PHP-DB] https post using php

2002-03-27 Thread mailing list

Hello,

I am attempting to POST to a https://whatever.url.com server and return
the result from the server into the script without the user knowing using
a php script.  I can not use CURL becuase the shared server I have hosting
this site was not compiled -with-curl.  I downloaded HTTP_POST PHP script
from: http://px.sklar.com/code.html?code_id=313.  Here is my code that I
am using to call the functions:

?php

require('classes2.php');

//instantiate class http_post
$a = new http_post;

//define variables

$a-set_server(onlinechecks.interceptcorporation.com);
$a-set_port(443);
$a-set_file(/icolc/short.cgi);
$a-set_action(https://onlinechecks.interceptcorporation.com/icolc/short.cgi;);
$a-set_enctype(application/x-www-form-urlencoded);
$a-set_element(array(MEN = 789,MPA = 456, MID = 7015,CRO
= 123456780,CAC = 123123123,
CPH = 17015551212,PAM = 12.34));
$a-set_timeout(20);
$a-show_post();
$a-send($display=1);

?

Here is the result returned from the browser:

Bad Request
Your browser sent a request that this server could not understand.

Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Hint: https://206.11.164.21/


Apache/1.3.20 Server at 206.11.164.21 Port 80

Does anyone have any ideas?


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




[PHP-DB] PHP and Foxpro Databases

2002-03-27 Thread John Clarke

I am thinking about providing real time web access to our coach reservations
system.

The reservations system is on Foxpro2.6 on a SCO Unix 5.0.2 server.

I am considering setting up the web server with FreeBSD, Apache and PHP.

Our reservations system is used by up to 60 operators almost 24 hours per
day via dumb terminals and telnet sessions.

I am interested in any experience anyone may have had with this type of
project and whether there are any major hurdles to overcome or limitations
of the OS's or the Foxpro RDMS.

In particular I am interested in any experience anyone may have had with
reading, writing, and locking Foxpro dbf's using PHP from the web server
while other in house users are doing the same via their terminals and telnet
sessions connected directly to the SCO Unix server. I have had some negative
experiences with locking Foxpro dbf's via NFS and as such I am wary about
it's limitations.


Any comments at all would be greatly appreciated.

Kind regards,

John Clarke



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




Re: [PHP-DB] PHP and Foxpro Databases

2002-03-27 Thread ted

Does FoxPro have an ODBC module?

I'm in the midst of putting a web front-end on an Access database; we've
put MySQL as the back end to Access using the ODBC connection.  Then PHP
can process queries on the MySQL db and the local operators see it as an
Access db.

We first tried PostgreSQL because of its more mature status -- but the
case sensitive text queries were a killer for Access' completion function.
MySQL works like a charm.

On Thu, 28 Mar 2002, John Clarke wrote:

 I am thinking about providing real time web access to our coach reservations
 system.

 The reservations system is on Foxpro2.6 on a SCO Unix 5.0.2 server.

 I am considering setting up the web server with FreeBSD, Apache and PHP.

 Our reservations system is used by up to 60 operators almost 24 hours per
 day via dumb terminals and telnet sessions.

 I am interested in any experience anyone may have had with this type of
 project and whether there are any major hurdles to overcome or limitations
 of the OS's or the Foxpro RDMS.

 In particular I am interested in any experience anyone may have had with
 reading, writing, and locking Foxpro dbf's using PHP from the web server
 while other in house users are doing the same via their terminals and telnet
 sessions connected directly to the SCO Unix server. I have had some negative
 experiences with locking Foxpro dbf's via NFS and as such I am wary about
 it's limitations.


 Any comments at all would be greatly appreciated.

 Kind regards,

 John Clarke



 --
 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] include() statement hell!

2002-03-27 Thread Brad Melendy

The thing that sucks about having to rely upon the php.ini file is that the
you must use a particular folder for all your include files, even if you are
using files for several different sites.  It makes much more sense to be
able to put your include files for a particular site in that site.  It's
easier for backups, moving the site and for shared hosting.  I've gotten it
to work partially using the folder defined in the php.ini file, but I want
to be able to specifiy a folder from within the calling php file, which is
how you should be able to do it.

...Brad


Dan Brunner [EMAIL PROTECTED] wrote in message
01c1d612$e94f0570$b3f7a718@doggy">news:01c1d612$e94f0570$b3f7a718@doggy...
 Has anybody told him to check his PHP.INI???

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 6:28 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] include() statement hell!

 #1. You may want to double-check the path where you're calling it from
 in
 case you're working with subdirectories.

 Let's saying you access a page at www.domain.com/page.php which calls
 www.domain.com/includes/header.inc.
 Then, header.inc includes the dblib.inc file at
 www.domain.com/includes/dblib.inc. However, the include's base directory
 will still be in page.php - the directory won't change to includes, so
 for
 header.inc to include dblib.inc, it has to say:
   include(includes/dblib.inc);
 NOT
   include(dblib.inc);
 Otherwise, it will be trying to include www.domain.com/dblib.inc because
 the
 page that started the whole chain reaction of includes is located at
 www.domain.com/page.php

 #2. If you have error reporting turned off, and there is a parsing error
 in
 your files, the page may just die without giving a reason. Try turning
 off
 any error reporting and also access those include files like userlib.inc
 directly in your web browser to see if PHP reports any errors. You may
 need
 to change the extension to something like userlib.inc.php for the web
 server
 to recognize the request correctly.

 #3. Please give us a little more detail on the errors you're getting
 (any
 specific messages would be nice).

 - Jonathan

 -Original Message-
 From: Rick Emery [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 3:42 PM
 To: 'Brad Melendy'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] include() statement hell!


 did you start each include file with:
 ?php
 ?

 If not, PHP treats the code within as straight text

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 5:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] include() statement hell!


 Ok, I've spent some time reading the docs at php.net and I'm still
 confused.

 After a couple hours, I have an include file working with a statement
 like:

 include (dblib.inc);

 However, to add to my confusion, I've got a second include file
 statement on
 the next line:

 include (userlib.inc);

 And that doesn't work.

 Most crazy of all, if I just put the darn functions all in the PHP file
 that
 is trying to call the include files, everything works perfectly.

 So far I have my include_path line in the pho.ini file set to no value
 since
 I'm just using include files that exist in the same directory as the
 calling
 php file.  this after I could NOT get the files to be properly
 recognized
 from their own include directory.  As far as I'm concerned, you should
 be
 able to include a relative path with the included filename and have it
 work.
 Too bad that doesn't work in PHP.

 So, long story short, I'm about to give up on include statements and
 just
 copy and paste my functions all over the place.  Does anyone have any
 ideas
 why this is so difficult for me?  What am I missing?  This stuff is easy
 in
 ASP but PHP is giving me serious heart-ache.  :-(

 Thanks for any tips or suggestions.

 Brad



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

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

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





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




[PHP-DB] MySQL/PHP Update

2002-03-27 Thread Jason

I'm trying to update my MySQL database, but it doesn't seem to be taking.

my code is:

mysql_query(update prod_list set prod_manu=$prod_man where sku='$prod');

where
prod_manu is an int
$prod_man is an int
sku is a varchar
$prod is text

mysql_query() comes back successful, and just to be sure I echoed
mysql_error() and nothing came back.

What am I doing wrong?




Re: [PHP-DB] MySQL/PHP Update

2002-03-27 Thread Maxwell

 I'm trying to update my MySQL database, but it doesn't seem to be taking.
 my code is:
 mysql_query(update prod_list set prod_manu=$prod_man where sku='$prod');

Try: mysql_query(update prod_list set prod_manu='$prod_man' where
sku='$prod');

Maxwell



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




Re: [PHP-DB] include() statement hell!

2002-03-27 Thread Jason Wong

On Thursday 28 March 2002 14:58, Brad Melendy wrote:
 How is this different than using the php.ini file?

 Photocon [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

  At 22:41 3/27/2002 -0600, Dan Brunner wrote:
  Has anybody told him to check his PHP.INI???
 
  How about adding the following to httpd.conf:
 
  php_value include_path .:/usr/share/php:/path/to/webpages

Because you can have per-site settings which are different from those of 
php.ini.


Also you can have per-file settings by using the ini_set() function. If 
you're not able to change the httpd.conf file then just use ini_set() at the 
beginning of all your php files to specify an include path.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Support wildlife -- vote for an orgy.
*/

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




Re: [PHP-DB] MySQL/PHP Update

2002-03-27 Thread Marius Ursache



Jason a écrit :

 I'm trying to update my MySQL database, but it doesn't seem to be taking.

 my code is:

 mysql_query(update prod_list set prod_manu=$prod_man where sku='$prod');

 where
 prod_manu is an int
 $prod_man is an int
 sku is a varchar
 $prod is text

 mysql_query() comes back successful, and just to be sure I echoed
 mysql_error() and nothing came back.

 What am I doing wrong?

if you already have an row with that data, mysql doesn't update the db...

do an echo $query to see what exactly is executed.
($query = update prod_list set prod_manu=$prod_man where sku='$prod')

--
  Marius Ursache (3563 || 3494)

   \|/  \|/
   '/ ,. \`
   /_| \__/ |_\
  \__U_/



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