General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 22nd, 2004, 04:07 PM
lilamy30 lilamy30 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 lilamy30 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
help is there a way to add new fields here

Could someone show me where i could add new fields like username age sate zipcode


<?

$error="";
if ($action=="add"){ // add new rating item
if ($password=="" || $newname=="" || $newcontact=="" || ($_FILES['picture']['name']=="" && $newpath==""))
$error=$lang['add_uncomplete'];
if ($newcontact!="" && !goodEmail($newcontact))
$error.="<br>".$lang['add_bademail'];
if ($_FILES['picture']['size']>$maxpicsize)
$error.="<br>".$lang['add_toobig']." ".round($maxpicsize/1024,0)." KB!";
if ($error!=""){
$error.="<br><b>".$lang['clickback']."</b>";
echo $error;
}else {
$newname=strip_tags($newname);
$password=strip_tags($password);
if ($doapprove){
$approved=0;
echo $lang['add_approve'];
if ($notifyadmin){
$itemname=$newname;
$itemcontact=$newcontact;
$message=$lang['add_newitem_mail'];
eval ("\$message = \"$message\";");
mail($mailadmin, "$sitename: New Item", $message,"From: $mailadmin");
}
}else $approved=1;
$sql="INSERT INTO $dbtable (name, contact, cat, pwd, ip, approved, date) VALUES ('$newname', '$newcontact', '$category', '$password', '".$_SERVER['REMOTE_ADDR']."', $approved, $now)";
mysql_query($sql, $db);
$res=mysql_query("SELECT id FROM $dbtable ORDER BY id DESC", $db);
$nr= mysql_fetch_row($res);
if ($uploadpic){
$path=substr($SCRIPT_FILENAME,0,strrpos($SCRIPT_FI LENAME, '/'))."/$imgdir$nr[0].jpg";
if (!move_uploaded_file($_FILES['picture']['tmp_name'], $path)) echo "save error!";
$newpath="$imgdir$nr[0].jpg";
}
$sql="UPDATE $dbtable SET path='$newpath' WHERE id=$nr[0]";
mysql_query($sql, $db);
echo "<meta http-equiv='refresh' content='4;URL=$PHP_SELF'>";
}

}else{
?>
<form name="form2" method="post" action="<?=$PHP_SELF?>" enctype="multipart/form-data">
<table border="0" cellpadding="2" cellspacing="1" bgcolor="<? echo $td_odd;?>" class="votingtxt">
<tr>
<td colspan="2" bgcolor="<? echo $td_caption_bg;?>"><font color="<? echo $td_caption_txt;?>"><? echo $lang['add_caption'];?></font></td>
</tr>
<tr>
<td width="50"><? echo $lang['name'];?>:</td>
<td><input name="newname" type="text" class="inputfield" id="newname">
</td>
</tr>
<tr>
<td><? echo $lang['contact'];?>:</td>
<td><input name="newcontact" type="text" class="inputfield" id="newcontact">
</td>
</tr>
<tr>
<td><? echo $lang['pwd'];?>:</td>
<td><input name="password" type="text" class="inputfield" id="password">
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td height="30" valign="top" class="votingsmalltxt"><? echo $lang['add_info'];?></td>
</tr>
<tr>
<td><? echo $lang['photo'];?>:</td>
<td><? if($uploadpic){?>
<input name="picture" type="file" class="inputfield">
<? }else{?>
<input name="newpath" type="text" class="inputfield" id="newpath">
Link (URL)
<? }?>
</td>
</tr>
<tr>
<td><? echo $lang['add_cat'];?>:</td>
<td><select class="catlist" name="category">
<?
for ($i=1; $i<$numcat; $i++){
echo "<option value='$i'>$cat[$i]</option>";
}
?>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input class="button" name="submit" type="submit" id="add" value="<? echo $lang['add_add'];?>">
<input name="do" type="hidden" id="do" value="add">
<input name="action" type="hidden" id="action" value="add">
</td>
</tr>
</table>
</form><br>
<input class="button" type="button" name="Button" value="<? echo $lang['back'];?>" onClick="location.href='<? echo "$PHP_SELF";?>'">
<? }?>

Reply With Quote
  #2  
Old January 22nd, 2004, 04:59 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Perhaps within the form where you have name contact and password?

Why not add the fields below that?

Code:
<tr>
<td width="50"><? echo $lang['field'];?>:</td>
<td><input name="field" type="text" class="inputfield" id="field">
</td>
</tr>


Or have i misinterpreted your question?

Reply With Quote
  #3  
Old January 22nd, 2004, 05:44 PM
lilamy30 lilamy30 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 lilamy30 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks that will work

thank for your help
then i add the new fields to my Mysql right?

Reply With Quote
  #4  
Old January 22nd, 2004, 10:42 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
If they're not present in your table, yes... =)

Try something like this:
Code:
ALTER TABLE table ADD COLUMN name

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > help is there a way to add new fields here


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT