[PHP-DB] Please help me! :(

2002-03-23 Thread Leif K-Brooks

I have a site where things in the database have ids.  When something new is
added, it gets an id one higher than the highest existing id.  I use code
something like this:

$gethighestid = mysql_fetch_array(mysql_query(select id from table order by
id desc limit 1));
$tobeid = $gethighestid[id]+1;
mysql_query(insert into table(id,othercolumn,othercolumn2)
values('$tobeid','something','something'));

The thing is, I just got two rows with duplicate ids.  Aparantley, two
people must of added two things at just the right times to make the same id.
Is there any way that will reduce, or eliminate, the time gap between
getting id and inserting? 

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




RE: [PHP-DB] Please help me! :(

2002-03-23 Thread Howard Picken

Can I ask why you're not using autoincrement for your
id field? If you used this you would never have the problem
your having.

Everytime a record is added it will increment the id field
by one, so you don't have to use all the code your using.

Howard

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 24 March 2002 3:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Please help me! :(


I have a site where things in the database have ids.  When something new is
added, it gets an id one higher than the highest existing id.  I use code
something like this:

$gethighestid = mysql_fetch_array(mysql_query(select id from table order by
id desc limit 1));
$tobeid = $gethighestid[id]+1;
mysql_query(insert into table(id,othercolumn,othercolumn2)
values('$tobeid','something','something'));

The thing is, I just got two rows with duplicate ids.  Aparantley, two
people must of added two things at just the right times to make the same id.
Is there any way that will reduce, or eliminate, the time gap between
getting id and inserting?

--
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] Please Help Me! thanks!!

2001-11-11 Thread Denny Suvanto

Try using fsockopen() function :
$file = fsockopen (www.yahoo.com, 80, $err_num,
$err_msg, 30);

You can find more informations about this fuction in
http://www.php.net/manual/en/function.fsockopen.php

May it help you.

Andy
www.mediahostnet.com

--- G [EMAIL PROTECTED] wrote:  Hello! i
would like to useing fopen() fuction to
 open the other Url,
 but i am using a shared server now. When i useing
 fopen() or file()
 fuctions, always have a error message:
 
 Warning: php_hostconnect: connect failed in
 /usr/xxx/xxx/xxx/html/test.php
 on line 3
 
 Warning: file(http://www.yahoo.com;) - Bad file
 descriptor in
 /usr/xxx/xxx/xxx/html/test.php on line 3
 
 How can i do?have any other fuctions can do that?
 Thank You Very Much!!
 
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
  

__
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music 
Charts
http://uk.my.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Please help me to solve a question

2001-04-25 Thread David Lee

I used MySQL server to create a application database and access it by php
program.
But now,I can access it only one machine that is runing the server.Other
computer
can not access it through browser(Internet Explorer5.0).My networks is made
up with
windows98 peer to peer network.Please help me and tell me what should i
do.

Thank you very much
  David Lee



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Please help me with this script...

2001-04-02 Thread SliderĀ©

Hello,

I've been working on this script all day, but I'm getting the same failure
report each time:

Warning: Supplied argument is not a valid MySQL result resource in
c:\program files\apache group\apache\htdocs\motoerit\toon_alles.php on line
23

What could be wrong? This is the code I have:

line 23 is: while(list($ID, $Naam, $Adres, [..] $Bet_rest, $Overig_info)
= mysql_fetch_array ($result))


---

HTML
HEADTITLEBoekingen/TITLE
LINK HREF="motoerit.css" TYPE="text/css" REL="stylesheet"
script language="JavaScript"
 !--
 function openwin(location) {OpenWin = this.open(location, "nieuws",
"width=455,height=333,scrollbars");}
 // --
 /script
/HEAD
BODY
?php

include ("dburl.txt");

mysql_connect  ($dbserver, 'username', 'password');
mysql_select_db('dbname');

if ($orderby == " ")
{$orderby == "ID";
}
$query  = "SELECT * FROM boekingen order by $orderbyASC ";
$result = mysql_query($query);
while(list($ID, $Naam, $Adres, $Postcode, $Woonplaats, $Land, $Telefoon,
$Mobiel, $Fax, $Email, $Aantal_pers, $Voert_aantal, $Voert_soort,
$Voert_merk, $Voert_kent, $Voert_hoogte, $Voert_lengte, $Voert_aanhang,
$Party, $Dat_heen, $Tijd_heen, $Dat_terug, $Tijd_terug, $Maaltijd,
$Hut_soort, $Reiscode, $Reisdoel, $Maatschap, $Dat_voorschot, $Dat_rest,
$Bet_voorschot, $Bet_rest, $Overig_info) = mysql_fetch_array ($result))
 print("TABLE BORDER=0 CELLSPACING=1");
 print("TRTH bgcolor=\"#99\"FONT
COLOR=\"#FF\"ID:/FONT/THTH bgcolor=\"#99\"FONT
COLOR=\"#FF\"Naam:/FONT/THTH bgcolor=\"#99\"FONT
COLOR=\"#FF\"Reisdoel:/THTH bgcolor=\"#99\"FONT
COLOR=\"#FF\"Datum vertrek:/THTH bgcolor=\"#99\"FONT
COLOR=\"#FF\"Datum terugkomst:/FONT/THTH bgcolor=\"#99\"FONT
COLOR=\"#FF\"Datum betaling voorschot:/FONT/THTH
bgcolor=\"#99\"FONT COLOR=\"#FF\"Datum betaling
rest:/FONT/THTHnbsp;/THTHnbsp;/TH/TR");

 print("TRTD  bgcolor=\"#99\"FONT
COLOR=\"#FF\"$ID/FONT/TDTD bgcolor=\"#F5F5F5\"div
CLASS=txtblack$Naam/DIV/TDTD$Reisdoel/TDTD$Dat_heen/TDTD$Dat_
terug/TDTDa href=\"wijzig.php?ID=".$ID."\"Wijzigen/a/TDTDa
href=\"wis.php?ID=".$ID."\"Verwijderen/a/TD/TR\n");

 print("/TABLE");

include ("footer.txt");
?
---

Thanks in advance!

Kind regards,

Paul Sidler



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Please help me with this script...

2001-04-02 Thread Mark Roedel

 -Original Message-
 From: Slider [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 02, 2001 9:27 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Please help me with this script...
 
 
 Hello,
 
 I've been working on this script all day, but I'm getting the 
 same failure
 report each time:
 
 Warning: Supplied argument is not a valid MySQL result resource in
 c:\program files\apache 
 group\apache\htdocs\motoerit\toon_alles.php on line 23
 
 What could be wrong? This is the code I have:

This usually means there was a problem with your query.  For more info,
including some useable sample code that should help you troubleshoot
exactly what went wrong, see

http://www.php.net/FAQ.php#7.12

---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]