[PHP-DB] postgres transaction php trigger rollback

2002-04-26 Thread Igor Kryltsov

Hi,

1. User clicks edit_record.php page
2. Page starts transaction and SELECT FOR UPDATE (say this is PostgreSQL)
3. User instead of clicking Submit/Reset buttons goes to www.boyplay.com
4. Other users can not edit this record because it was locked.

If somebody can give me an idea how to trigger Rollback on server.
I see the only solution here -- using sessions with timeout equals to
reasonable value for each particular page which requires transaction.


Thank you,

Igor



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




[PHP-DB] selected problem

2002-04-26 Thread its me

i have the file:
edit_profile.php

in it i have a form field like this:
select name=location
   OPTION selected value=Choose City/OPTION OPTION 
  value=10-Ramadan10-Ramadan/OPTION OPTION 
  value=15 May15 May/OPTION OPTION 
  value=6-October6-October/OPTION OPTION 
  value=Abou RedesAbou Redes/OPTION OPTION 
  value=Abou-ZabalAbou-Zabal/OPTION OPTION 
  value=Al ArishAl Arish/OPTION OPTION 
  value=Al MahalaAl Mahala/OPTION OPTION 
  value=Al TourAl Tour/OPTION OPTION 
  value=Al-NatrounAl-Natroun/OPTION OPTION 
  value=AlexandriaAlexandria/OPTION OPTION 
  value=AsuitAsuit/OPTION OPTION 
  value=AswanAswan/OPTION OPTION 
  value=BaderBader/OPTION OPTION 
  value=Bani-SweifBani-Sweif/OPTION OPTION 
  value=BelbisBelbis/OPTION OPTION 
  value=Berkeit sabbBerkeit sabb/OPTION OPTION 
  value=CairoCairo/OPTION OPTION 
  value=DahabDahab/OPTION OPTION 
  value=DamanhourDamanhour/OPTION OPTION 
  value=DisoukDisouk/OPTION OPTION 
  value=DumiatDumiat/OPTION OPTION 
  value=Ein SoukhnaEin Soukhna/OPTION OPTION 
  value=El- ManieaEl- Maniea/OPTION OPTION 
  value=FayedFayed/OPTION OPTION 
  value=FayoumFayoum/OPTION OPTION value=High DamHigh 
  Dam/OPTION OPTION value=HurghadaHurghada/OPTION 
  OPTION value=InshasInshas/OPTION OPTION 
  value=IsmaeliaIsmaelia/OPTION OPTION 
  value=Kafr Al ShiekKafr Al Shiek/OPTION OPTION 
  value=KatamiaKatamia/OPTION OPTION 
  value=LuxorLuxor/OPTION OPTION 
  value=MansouraMansoura/OPTION OPTION 
  value=MarabellaMarabella/OPTION OPTION 
  value=MaraquiaMaraquia/OPTION OPTION 
  value=Marsa matrouhMarsa matrouh/OPTION OPTION 
  value=Met GhamrMet Ghamr/OPTION OPTION 
  value=MonofiaMonofia/OPTION OPTION 
  value=MoustorodMoustorod/OPTION OPTION 
  value=NubiehNubieh/OPTION OPTION 
  value=Oubour CityOubour City/OPTION OPTION 
  value=Port SayedPort Sayed/OPTION OPTION 
  value=Qanater El Khiraya Qanater El Khiraya/OPTION 
  OPTION value=QliubQliub/OPTION OPTION 
  value=QuanaQuana/OPTION OPTION 
  value=QuesnaQuesna/OPTION OPTION 
  value=RafahRafah/OPTION OPTION value=Ras SidrRas 
  Sidr/OPTION OPTION value=Sadat CitySadat 
  City/OPTION OPTION value=SaqaraSaqara/OPTION OPTION 
  value=Sedi KrierSedi Krier/OPTION OPTION 
  value=Sharm el ShiekSharm el Shiek/OPTION OPTION 
  value=Shebin Al KoumShebin Al Koum/OPTION OPTION 
  value=SuhagSuhag/OPTION OPTION 
  value=SuiezSuiez/OPTION OPTION 
  value=TabaTaba/OPTION OPTION 
  value=TantaTanta/OPTION OPTION 
  value=TebinTebin/OPTION OPTION 
  value=ZafranaZafrana/OPTION OPTION 
  value=ZagazikZagazik/OPTION
 /select

as you can see there is many options:)

and i got from my database:
$location=Alexandria
so i wanted to appear selected,how can i do this??






Rehab M.Shouman





-
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
-

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




Re: [PHP-DB] selected problem

2002-04-26 Thread Jason Wong

On Friday 26 April 2002 16:39, its me wrote:
 i have the file:
 edit_profile.php

 in it i have a form field like this:
 select name=location
OPTION selected value=Choose City/OPTION OPTION

 and i got from my database:
 $location=Alexandria
 so i wanted to appear selected,how can i do this??

Mark it as selected like above.

  OPTION selected value=Alexandria ...

Look up a decent HTML reference.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
If you are over 80 years old and accompanied by your parents, we will
cash your check.
*/

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




Re: [PHP-DB] Append into another table

2002-04-26 Thread Jason Wong

On Friday 26 April 2002 09:14, Rosen Marinov wrote:
 Hi,
 how can I append from one table to another with same structure some
 selected records

RTFM for the database you're using. If you still have problems, post to the 
database's list or to the php-db list.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Love is never asking why?
*/

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




Re: [PHP-DB] Couldn't Unsubscribe

2002-04-26 Thread Jason Wong

On Friday 26 April 2002 07:11, Ilhan Guvener wrote:
 Yes it seems off-topic but I only joined to this mail-list. So I don't have
 any other place to ask. I sent mail to unsubscribe me from the list but
 nothing happened. I'm still recieving mails from the list. What's wrong?

Did you read bit the at the bottom of every post?

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Confirmed bachelor:
A man who goes through life without a hitch.
*/

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




Re: [PHP-DB] Mssql/Sybase errors

2002-04-26 Thread Jeffrey_N_Dyke


No thats not it. I connected above this line.  All of my errors come as
Sybase errors because of the install of freeteds used with the
--with-sybase=/path/to/freetds flag when i configure.  It actually ended up
being a spacing problem where i had concatenated the query string.  there
were two words that got pushed together causing the query to die.

Thanks for the info though.




   
   
szii@sziisoft 
   
.comTo: [EMAIL PROTECTED]
   
 cc:   
   
04/25/2002   Subject: Re: [PHP-DB] Mssql/Sybase errors 
   
07:26 PM   
   
   
   
   
   




hehehe, you recoded PHP to reconnect to MSSQL, but you forgot
to redo your connection stuff.  Sybase error: means that you're
connecting to Sybase and not MSSQL.  *wink*

'Luck

-Szii

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 25, 2002 10:18 AM
Subject: [PHP-DB] Mssql/Sybase errors


 Hello.

 I have recently installed the freetds package and reconfigured PHP to
 connect to MSSQL.  I am running a simple join query on two tables and I
get
 the following error.
 bWarning/b:  Sybase error:  'REQ' is not a recognized OPTIMIZER LOCK
 HINTS option. (severity 15) in  myFile.php on line b29/bbr

 REQ is one of the tables in the database.  here is the query, which works
 fine in MS Query Analyzer.  Anyone run up against this problem?

 mssql_query(select REQ.DESCR, BUSINESS_AREA.DESCR, REQ_NUM from REQ
INNER
 JOIN BUSINESS_AREA.
 ON (REQ.BUSINESS_AREA = BUSINESS_AREA.BUSINESS_AREA) WHERE
 REQ.BUSINESS_AREA = '$area');

 I can run basic select queries, but came into this when i started using
 JOIN.

 Many thanks,
 Jeff

 my set up is PHP4.1.2/Apache/Unix/Freetds 0.53


 --
 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] Sybase - MSSQL Server 2000

2002-04-26 Thread Andrew Hill

Tom,

I suggest you use ODBC or Free-TDS.
For info on linking your PHP build against an ODBC Driver Manager (necessary
to use ODBC) see the PHP-ODBC HOWTO at http://www.iodbc.org.

Best regards,
Andrew Hill
Director Technology Evangelism
OpenLink Software http://www.openlinksw.com
XML  E-Business Infrastructure Technology Provider


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 25, 2002 2:13 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Sybase - MSSQL Server 2000


 PHP.NET indicates that to connect to MSSQL Server, from Linux use Sybase.
 I've installed Sybase, PHP and Apache and everything works well
 on my Linux
 server when I connect to the Sybase test database.

 When I try to connect to my MS SQL server, I get this...

 sybase$ isql -S mssql-server -U username -P password
 DB-LIBRARY error:
 Unexpected EOF from SQL Server.

 Anyone have any suggestions?

 --Tom Brownridge


 --
 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] Newbie and having to convert from idc/htx format

2002-04-26 Thread Robert Webb

Ok, I have been somewhat tasked here to try and do a web conversion from 
the idc/htx format of Microsoft to a more portable format. I am looking 
and using php for my scripting. My current scripts are very simple. Here 
is my setup.

Microsoft IIS using idc/htx frontend
MSSQL backend database
All sql queries, inserts, etc.. are handled as stored procedures.
IDC files only pass data to the sql server via odbc.

As you can see we have setup the sql server to handle all the processing 
  of data. The web server only passes data put into the forms across to 
the sql server.

Here are my questions.

1.  What odbc would you recommend under Linux to connect to the mssql 
server.

2. Where would be a good place to go to get a feel on how I would write 
the code to pass the variable data over to the sql server.

3. Is this even easily obtainable. Or should I just start trying to 
re-write the entire site.

Also I am including below a sample of what our idc file looks like.

*Of course names have been changed to protect the guilty. ;-)

Datasource: Contacts
Template: view_entry.htx
SQLStatement: DECLARE typesearch varchar(50)
+select typesearch = '%R1%'
+if typesearch = 'name'
+Begin
+execute sp_corporate_wide_database_search '%name%', '%classification%'
+End
+if typesearch = 'company'
+begin
+execute sp_main_company_search '%name%', '%classification%'
+end


I am on a tight schedule with this. Otherwise I would be only digging 
into any manual I could find first.


Thanks,
Robert


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




Re: [PHP-DB] selected problem

2002-04-26 Thread Paul Burney

on 4/26/02 4:39 AM, its me at [EMAIL PROTECTED] appended the following bits to
my mbox:

 in it i have a form field like this:
 select name=location
  OPTION selected value=Choose City/OPTION OPTION
 value=10-Ramadan10-Ramadan/OPTION OPTION
 value=15 May15 May/OPTION OPTION
 value=6-October6-October/OPTION OPTION
 value=Abou RedesAbou Redes/OPTION OPTION


 and i got from my database:
 $location=Alexandria
 so i wanted to appear selected,how can i do this??


Easy solution:

Get rid of the word selected in the first option.  The browser will
default to the first anyway.

After the select tag, echo:

?php
echo 'option value=' , $location , '' , $location , '/option';
?

That will list the selected item as the first item in the list.




Hard solution:

Go thorough the list and put:

?php if ($location == 'Alexandria) { echo ' selected'; } ?

In each of your option tags. (ouch).





Less hard solution:

Put all of the options into an array and then create the list by looping
through the array, each time checking the value to see if it is the selected
one using the code above.



HTH.

Sincerely,

Paul Burney
http://paulburney.com/

?php
while ($self != asleep) {
$sheep_count++;
}
?



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




[PHP-DB] PHP + Oracle problem

2002-04-26 Thread Daniel Ryhle

When i have uncommented the php_oci8.dll extension in the php.in(i use the
recommended) i get the following error.

kodPHP Warning: Unable to load dynamic library 'c:/php/php_oci8.dll' - The
specified module could not be found. in Unknown on line 0 

All paths are correct and it works fine with the mssql dll.

Worth mentioning is that i run php 4.2.0 on IIS/win2k machine.

Someone has a clue?



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




Re: [PHP-DB] FORM not inserting data

2002-04-26 Thread szii

put in a var_dump($sql);die();  right after

  $result = mysql_query($sql);

Then copy/paste it into mysql's command line util, and see what
you get.

-Szii

- Original Message -
From: Neil [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 25, 2002 6:34 PM
Subject: [PHP-DB] FORM not inserting data


Help. Help

Please, Please tell me what I am  doing wrong here...I have a form to input data but 
it is not posting ithere is the code. It
seems to work no errors but a query show no new additions to the table.

$sql = INSERT INTO employees (first,last,address,date_of_birth,sex,age,telephone,

parent_guardian_name,parent_guardian_workplace,work_telephone,emergency_information_contact,

list_physical_conditions_if_any,all_schools_previously_attended,examinations_passed,older_brothers,younger_brothers,older_sisters,yo
unger_sisters,
 names_sisters_or_brothers_attending_school) VALUES
('$first','$last','$address','$date_of_birth',$sex','$age','$telephone','$parent_guardian_name','$parent_guardian_workplace',

'$work_telephone','$emergency_information_contact','$list_physical_conditions_if_any','$all_schools_previously_attended','$examinati
ons_passed','$older_brothers','$younger_brothers','$older_sisters','$younger_sisters','$names_sisters_or_brothers_attending_school')
;
  $result = mysql_query($sql);
  echo Thank you! Information entered.\n;
} else{

  // display form

  ?



Neil



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




Re: [PHP-DB] selected problem

2002-04-26 Thread szii

When you build the list up, originally, you'll NOT put selected on Choose City, but
move it to Alexandria.

-Szii

- Original Message - 
From: its me [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 26, 2002 1:39 AM
Subject: [PHP-DB] selected problem


 i have the file:
 edit_profile.php
 
 in it i have a form field like this:
 select name=location
OPTION selected value=Choose City/OPTION OPTION 
   value=10-Ramadan10-Ramadan/OPTION OPTION 
   value=15 May15 May/OPTION OPTION 
   value=6-October6-October/OPTION OPTION 
   value=Abou RedesAbou Redes/OPTION OPTION 
   value=Abou-ZabalAbou-Zabal/OPTION OPTION 
   value=Al ArishAl Arish/OPTION OPTION 
   value=Al MahalaAl Mahala/OPTION OPTION 
   value=Al TourAl Tour/OPTION OPTION 
   value=Al-NatrounAl-Natroun/OPTION OPTION 
   value=AlexandriaAlexandria/OPTION OPTION 
   value=AsuitAsuit/OPTION OPTION 
   value=AswanAswan/OPTION OPTION 
   value=BaderBader/OPTION OPTION 
   value=Bani-SweifBani-Sweif/OPTION OPTION 
   value=BelbisBelbis/OPTION OPTION 
   value=Berkeit sabbBerkeit sabb/OPTION OPTION 
   value=CairoCairo/OPTION OPTION 
   value=DahabDahab/OPTION OPTION 
   value=DamanhourDamanhour/OPTION OPTION 
   value=DisoukDisouk/OPTION OPTION 
   value=DumiatDumiat/OPTION OPTION 
   value=Ein SoukhnaEin Soukhna/OPTION OPTION 
   value=El- ManieaEl- Maniea/OPTION OPTION 
   value=FayedFayed/OPTION OPTION 
   value=FayoumFayoum/OPTION OPTION value=High DamHigh 
   Dam/OPTION OPTION value=HurghadaHurghada/OPTION 
   OPTION value=InshasInshas/OPTION OPTION 
   value=IsmaeliaIsmaelia/OPTION OPTION 
   value=Kafr Al ShiekKafr Al Shiek/OPTION OPTION 
   value=KatamiaKatamia/OPTION OPTION 
   value=LuxorLuxor/OPTION OPTION 
   value=MansouraMansoura/OPTION OPTION 
   value=MarabellaMarabella/OPTION OPTION 
   value=MaraquiaMaraquia/OPTION OPTION 
   value=Marsa matrouhMarsa matrouh/OPTION OPTION 
   value=Met GhamrMet Ghamr/OPTION OPTION 
   value=MonofiaMonofia/OPTION OPTION 
   value=MoustorodMoustorod/OPTION OPTION 
   value=NubiehNubieh/OPTION OPTION 
   value=Oubour CityOubour City/OPTION OPTION 
   value=Port SayedPort Sayed/OPTION OPTION 
   value=Qanater El Khiraya Qanater El Khiraya/OPTION 
   OPTION value=QliubQliub/OPTION OPTION 
   value=QuanaQuana/OPTION OPTION 
   value=QuesnaQuesna/OPTION OPTION 
   value=RafahRafah/OPTION OPTION value=Ras SidrRas 
   Sidr/OPTION OPTION value=Sadat CitySadat 
   City/OPTION OPTION value=SaqaraSaqara/OPTION OPTION 
   value=Sedi KrierSedi Krier/OPTION OPTION 
   value=Sharm el ShiekSharm el Shiek/OPTION OPTION 
   value=Shebin Al KoumShebin Al Koum/OPTION OPTION 
   value=SuhagSuhag/OPTION OPTION 
   value=SuiezSuiez/OPTION OPTION 
   value=TabaTaba/OPTION OPTION 
   value=TantaTanta/OPTION OPTION 
   value=TebinTebin/OPTION OPTION 
   value=ZafranaZafrana/OPTION OPTION 
   value=ZagazikZagazik/OPTION
  /select
 
 as you can see there is many options:)
 
 and i got from my database:
 $location=Alexandria
 so i wanted to appear selected,how can i do this??
 
 
 
 
 
 
 Rehab M.Shouman
 
 
 
 
 
 -
 Express yourself with a super cool email address from BigMailBox.com.
 Hundreds of choices. It's free!
 http://www.bigmailbox.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] selected problem

2002-04-26 Thread Richard Emery

How is your option list created?  Did you pull the names and values from a
database?  Or is the list hard-coded?

- Original Message -
From: its me [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 26, 2002 3:39 AM
Subject: [PHP-DB] selected problem


i have the file:
edit_profile.php

in it i have a form field like this:
select name=location
   OPTION selected value=Choose City/OPTION OPTION
  value=10-Ramadan10-Ramadan/OPTION OPTION
  value=15 May15 May/OPTION OPTION
  value=6-October6-October/OPTION OPTION
  value=Abou RedesAbou Redes/OPTION OPTION
  value=Abou-ZabalAbou-Zabal/OPTION OPTION
  value=Al ArishAl Arish/OPTION OPTION
  value=Al MahalaAl Mahala/OPTION OPTION
  value=Al TourAl Tour/OPTION OPTION
  value=Al-NatrounAl-Natroun/OPTION OPTION
  value=AlexandriaAlexandria/OPTION OPTION
  value=AsuitAsuit/OPTION OPTION
  value=AswanAswan/OPTION OPTION
  value=BaderBader/OPTION OPTION
  value=Bani-SweifBani-Sweif/OPTION OPTION
  value=BelbisBelbis/OPTION OPTION
  value=Berkeit sabbBerkeit sabb/OPTION OPTION
  value=CairoCairo/OPTION OPTION
  value=DahabDahab/OPTION OPTION
  value=DamanhourDamanhour/OPTION OPTION
  value=DisoukDisouk/OPTION OPTION
  value=DumiatDumiat/OPTION OPTION
  value=Ein SoukhnaEin Soukhna/OPTION OPTION
  value=El- ManieaEl- Maniea/OPTION OPTION
  value=FayedFayed/OPTION OPTION
  value=FayoumFayoum/OPTION OPTION value=High
DamHigh
  Dam/OPTION OPTION value=HurghadaHurghada/OPTION
  OPTION value=InshasInshas/OPTION OPTION
  value=IsmaeliaIsmaelia/OPTION OPTION
  value=Kafr Al ShiekKafr Al Shiek/OPTION OPTION
  value=KatamiaKatamia/OPTION OPTION
  value=LuxorLuxor/OPTION OPTION
  value=MansouraMansoura/OPTION OPTION
  value=MarabellaMarabella/OPTION OPTION
  value=MaraquiaMaraquia/OPTION OPTION
  value=Marsa matrouhMarsa matrouh/OPTION OPTION
  value=Met GhamrMet Ghamr/OPTION OPTION
  value=MonofiaMonofia/OPTION OPTION
  value=MoustorodMoustorod/OPTION OPTION
  value=NubiehNubieh/OPTION OPTION
  value=Oubour CityOubour City/OPTION OPTION
  value=Port SayedPort Sayed/OPTION OPTION
  value=Qanater El Khiraya Qanater El
Khiraya/OPTION
  OPTION value=QliubQliub/OPTION OPTION
  value=QuanaQuana/OPTION OPTION
  value=QuesnaQuesna/OPTION OPTION
  value=RafahRafah/OPTION OPTION value=Ras
SidrRas
  Sidr/OPTION OPTION value=Sadat CitySadat
  City/OPTION OPTION value=SaqaraSaqara/OPTION
OPTION
  value=Sedi KrierSedi Krier/OPTION OPTION
  value=Sharm el ShiekSharm el Shiek/OPTION OPTION
  value=Shebin Al KoumShebin Al Koum/OPTION OPTION
  value=SuhagSuhag/OPTION OPTION
  value=SuiezSuiez/OPTION OPTION
  value=TabaTaba/OPTION OPTION
  value=TantaTanta/OPTION OPTION
  value=TebinTebin/OPTION OPTION
  value=ZafranaZafrana/OPTION OPTION
  value=ZagazikZagazik/OPTION
 /select

as you can see there is many options:)

and i got from my database:
$location=Alexandria
so i wanted to appear selected,how can i do this??






Rehab M.Shouman





-
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.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




[PHP-DB] Update/Insert

2002-04-26 Thread Natividad Castro

Hi to all,
I have a form where users can insert or update a record. Now the way I have
it, can just only do one thing either update or insert a new record. What I
would like to do is: if it is a new record, execute the insert statement
else execute the update statement. I don't know if it is possible to do it
in PHP.
Any help is greatly appreciate

Thanks in advanced!
Nato


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




Re: [PHP-DB] Update/Insert

2002-04-26 Thread Chris

You could try inserting it, and see if it succeeds.  If its fails, then you 
know you have to update it.

IE

$sql= 'insert...'
$result = mysql_query($sql);
if(!$result)
{
$sql = 'update...';
mysql_query($sql);
}

-Chris

At 01:34 PM 4/26/2002 -0400, you wrote:
Hi to all,
I have a form where users can insert or update a record. Now the way I have
it, can just only do one thing either update or insert a new record. What I
would like to do is: if it is a new record, execute the insert statement
else execute the update statement. I don't know if it is possible to do it
in PHP.
Any help is greatly appreciate

Thanks in advanced!
Nato


--
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: selected problem

2002-04-26 Thread Hugh Bothwell


Its Me [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 i have the file:
 edit_profile.php

Just curious: why do you have May 15th
and October 6th listed as locations?

?php

if (!isset($location))
$location = ;

$locations[] = array(
 = Choose City,
Abou Redes = Abou Redes,
Abou-Zabal = Abou-Zabal,
Al Arish = Al Arish,
Al Mahala = Al Mahala,
// ... etc, etc...
Zafrana = Zafrana,
Zagazik = Zagazik
);


echo \nselect name='location';

foreach($locations as $value = $text)
echo
\n\toption
.($location == $value ?  selected : )
. value='$value'
.$text
./option;

echo \n/select;

?


NOTE:

1.  That is a pretty God-awful long list; is there
any way to subdivide it logically?  Maybe use a pair
of Javascript-coupled selection-boxes - use
the first box to specify the first letter of the desired
name, then the second box provides (a much shorter
list of) all destinations beginning with that letter.

2.  If your option-value and option-text are
always identical, there is no need to specify
the value separately (it defaults to the text).



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




Re: [PHP-DB] Update/Insert

2002-04-26 Thread Jason Wong

On Saturday 27 April 2002 01:34, Natividad Castro wrote:
 Hi to all,
 I have a form where users can insert or update a record. Now the way I have
 it, can just only do one thing either update or insert a new record. What I
 would like to do is: if it is a new record, execute the insert statement
 else execute the update statement. I don't know if it is possible to do it
 in PHP.

if ... else is certainly available in PHP. 

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Modesty is a vastly overrated virtue.
-- J.K. Galbraith
*/

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