GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 13-Nov-2005, 09:45
djd@n djd@n is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Posts: 21
djd@n is on a distinguished road

i have this script but it isnt working properly


i have this php script on my members sytem to award spacific users spacific badges I.E Dan gets awarded user of the month and imatate gets awarded user of the year but wheneva i try to send out a badge to one particular person it gets sent to everyone. these are the 2 codes im user:
badge.php
PHP Code:

Award badges to a user. remember below this form is all the badges underneat the badge is the code you need to put in the "badge name" field
<br>
<form action="give.php" method=post>
Badge Name: <input type=text name="badge" size="50"><br>
Recipient: <input type=text name="user" size="50"><br>
<input type="submit" value="Award User">

</form> 



give.php
PHP Code:

<?
include ("cons.php");

$bn = $_POST['badge'];
$uname = $_POST['uname'];

mysql_query("INSERT INTO badges (bname, uname) VALUES ('$bn', '$uname')");
header("Location: index.php");
?>


and the Mysql table was
PHP Code:

<?
include("cons.php");

$table = "CREATE TABLE badges(
id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id),
bname VARCHAR(32) NOT NULL,
uname VARCHAR(32) NOT NULL
)";

$r = mysql_query($table);
if ($r) {
echo "Table created!";
}else{
echo mysql_error();
}


can you help me find out what is wrong with it
  #2  
Old 17-Nov-2005, 11:23
Error's Avatar
Error Error is offline
Junior Member
 
Join Date: May 2005
Posts: 42
Error is on a distinguished road

Re: i have this script but it isnt working properly


Try

Code:
INSERT INTO badges (bname) VALUES ('$bn') WHERE uname='$uname'
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cgi script problems joeW Apache Web Server Forum 3 21-Dec-2004 18:02
NOT sure what is wrong with script fscanf jenmaz C Programming Language 14 29-Oct-2004 15:53
Two virtual hosts, cgi script behaves differently on each blimbo Apache Web Server Forum 0 04-Aug-2004 10:35
JavaScript Tutorial Part 1 pcxgamer Web Design Forum 2 01-Dec-2003 10:16
Another working Tripod CGI script nickbeee Free Web Hosting 17 06-Jun-2002 15:39

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:07.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.