Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   TBdev Small Problem (http://www.bvlist.com/showthread.php?t=2737)

wrestleman 31st May 2009 11:58

TBdev Small Problem
 
Trying to add some new input fields but it won't overwrite.

http://img30.imageshack.us/img30/5016/testman1.gif

SQL Error

Duplicate entry 'Testman' for key 2

PHP Code:

sql_query("INSERT INTO users (username, donated, donoruntil, vip_until) VALUES ($username$donated$donoruntil$vip_until)") or
            
sqlerr(__file____line__);
$res sql_query("SELECT id FROM users WHERE username=$username");
$arr mysql_fetch_row($res);
if (!
$arr)
stderr("Error!""Unable To Update Account.");
header("Location: $BASEURL/userdetails.php?id=$arr[0]");
die; 

Any ideas ?

:smack:

pdq 31st May 2009 14:07

MySQL :: MySQL 5.0 Reference Manual :: 12.2.5.3 INSERT ... ON DUPLICATE KEY UPDATE Syntax

wrestleman 31st May 2009 16:52

phq, thanks that was it.

Had a little trouble at first, kept writing a new row but managed to sort it.

:ok:


All times are GMT +2. The time now is 21:31.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.