Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2005, 06:34 PM
fashunphotog fashunphotog is offline
 
Join Date: Apr 2005
Location: US
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I keep my form updates from overwriting data?

I have a form my customers fill out that I'm having some difficutly with. Whenever they re-visit to update their information they have to fill in every field all over again or the data is overwritten to the new (null) values.

I'm fairly new to MySQL and don't know how to keep this from happening. Any ideas/suggestions?

Thank you,

FaShUnPhOtOg
Reply With Quote
  #2  
Old 05-12-2005, 06:45 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Two ways to do it:
1. Check the database to see if there is data there. If there is, and the form field pertaining to that data is empty, simply readd the existing data.

2. Better yet, check each form variable and ONLY update the form fields that have values. I am not suggesting doing 3 or 4 update queries. I am suggesting that you write your query so that it is dynamic.

For example:
Code:
if ($formnamefield)
{
   $nameupdate = "name = '" . addslashes($formnamefield) . "',"
}
else 
{
  $nameupdate = '';
}
This technique is used many times by Jelsoft. Just poke around in your source code for concrete examples.
Reply With Quote
  #3  
Old 05-12-2005, 07:17 PM
fashunphotog fashunphotog is offline
 
Join Date: Apr 2005
Location: US
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by amykhar
Two ways to do it:
1. Check the database to see if there is data there. If there is, and the form field pertaining to that data is empty, simply readd the existing data.

2. Better yet, check each form variable and ONLY update the form fields that have values. I am not suggesting doing 3 or 4 update queries. I am suggesting that you write your query so that it is dynamic.

For example:
Code:
if ($formnamefield)
{
   $nameupdate = "name = '" . addslashes($formnamefield) . "',"
}
else 
{
  $nameupdate = '';
}
This technique is used many times by Jelsoft. Just poke around in your source code for concrete examples.
Amy,

thank you for your quick response. Are you available for PM for some one-on-one? I really need to get this thing working.

Mike
Reply With Quote
  #4  
Old 05-14-2005, 11:46 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Post some more info (code snippets, table layout, etc) and i will try to help.
Reply With Quote
  #5  
Old 05-14-2005, 12:57 PM
fashunphotog fashunphotog is offline
 
Join Date: Apr 2005
Location: US
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's kinda long but here's the code for the form I'm using (a snippet from the included .php file is in the reply below this:


HTML Code:
<form action="vbportfolio.php" method="post" enctype="multipart/form-data">
<p> 
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="max_file_size" value="$vboptions[vbpmaxfilesize]">
</p>
<table width="40%" border="1" cellspacing="1" cellpadding="1" align="center" bordercolor="#ff893a">
<tr>
<td align="center" valign="top" height="2134"> 
<div align="center">
<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center">
<tr bgcolor="ff893a"> 
<td colspan="4"><font size="2"><b>$user[username]'s $vbphrase[vbportfolio]- 
Edit Mode</b></font></td>
</tr>
<tr> 
<td colspan="4" bgcolor="#738FBF"><font size="2"><b><font color="#FFFFFF">Enter 
personal information here:</font></b></font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">First Name:</font></div>
</td>
<td width="19%"> 
<div align="left"><font size="2"> 
<input type="text" class="bginput" name="firstname" size="20" maxlength="30" />
</font></div>
</td>
<td width="27%"> 
<div align="right"><font size="2">Last Name: </font></div>
</td>
<td width="26%"> 
<div align="left"><font size="2"> 
<input type="text" class="bginput" name="lastname" size="20" maxlength="30" />
</font></div>
</td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Gender:</font></div>
</td>
<td width="19%"> 
<div align="left"> <font size="2"> 
<select name="gender">
<option value=" "></option>
<option value="Female">Female</option>
<option value="Male">Male</option>
</select>
</font> </div>
</td>
<td width="27%"> 
<div align="right"><font size="2">Talent Type: </font></div>
</td>
<td width="26%"> 
<div align="left"> 
<div align="left"> <font size="2"> 
<select name="talent">
<option value=" "></option>
<option value="Model">Model</option>
<option value="Actor">Actor</option>
<option value="Singer">Singer</option>
<option value="Musician">Musician</option>
<option value="Photographer">Photographer</option>
<option value="Make-up Artist">Make-up Artist</option>
<option value="Director">Director</option>
<option value="Casting Director">Casting Director</option>
<option value="Producer">Producer</option>
</select>
</font></div>
</div>
</td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Age:</font></div>
</td>
<td width="19%"> <font size="2"> 
<select name="age">
<option value=" "></option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
<option value="60">60</option>
<option value="61">61</option>
<option value="62">62</option>
<option value="63">63</option>
<option value="64">64</option>
<option value="65">65</option>
<option value="66">66</option>
<option value="67">67</option>
<option value="68">68</option>
<option value="69">69</option>
<option value="70">70</option>
</select>
</font></td>
<td width="27%"> 
<div align="right"><font size="2">eMail:</font></div>
</td>
<td width="26%"><b><font size="2"> 
<input type="text" name="email" size="20" maxlength="75">
</font></b></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"></div>
</td>
<td width="19%">&nbsp;</td>
<td width="27%">&nbsp;</td>
<td width="26%">&nbsp;</td>
</tr>
<tr> 
<td colspan="4" bgcolor="#738FBF"><font size="2" color="#FFFFFF"><b>Contact 
Information:</b></font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Address:</font></div>
</td>
<td width="19%"><b><font size="2"> 
<input type="text" name="address" size="20" maxlength="25">
</font></b></td>
<td width="27%"> 
<div align="right"><font size="2">Apartment:</font></div>
</td>
<td width="26%"><b><font size="2"> 
<input type="text" name="address2" size="20" maxlength="25">
</font></b></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">City:</font></div>
</td>
<td width="19%"><b><font size="2"> 
<input type="text" name="city" size="20" maxlength="25">
</font></b></td>
<td width="27%"> 
<div align="right"><font size="2">State/Province:</font></div>
</td>
<td width="26%"><font size="2"> 
<input type="text" name="state" size="20" maxlength="25">
</font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Country: </font></div>
</td>
<td width="19%"><font size="2"><b> 
<input type="text" name="country" size="20" maxlength="25">
</b></font></td>
<td width="27%"> 
<div align="right"><font size="2">Postal Code:</font></div>
</td>
<td width="26%"><font size="2"><b> 
<input type="text" name="postal2" size="10" maxlength="15">
</b></font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Phone Number: </font></div>
</td>
<td width="19%"><b><font size="2"> 
<input type="text" name="phone" size="20" maxlength="20">
</font></b></td>
<td width="27%"> 
<div align="right"><font size="2">Fax Number: </font></div>
</td>
<td width="26%"><font size="2"><b> 
<input type="text" name="phone2" size="20" maxlength="20">
</b></font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Cell Phone: </font></div>
</td>
<td width="19%"><b><font size="2"> 
<input type="text" name="phone3" size="20" maxlength="20">
</font></b></td>
<td width="27%"> 
<div align="right"><font size="2">Pager:</font></div>
</td>
<td width="26%"><font size="2"><b> 
<input type="text" name="phone4" size="20" maxlength="20">
</b></font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Personal Website: </font></div>
</td>
<td colspan="2"><font size="2"> 
<input type="text" name="website" size="50" maxlength="75">
</font></td>
<td width="26%">&nbsp;</td>
</tr>
<tr> 
<td width="28%">&nbsp;</td>
<td width="19%">&nbsp;</td>
<td width="27%">&nbsp;</td>
<td width="26%">&nbsp;</td>
</tr>
<tr> 
<td colspan="4" bgcolor="#738FBF"><font size="2" color="#FFFFFF"><b>Personal 
Statistics:</b></font></td>
</tr>
<tr> 
<td colspan="4" bgcolor="#666666"><font size="2" color="#FFFFFF"><b>Women:</b></font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Breast Size:</font></div>
</td>
<td width="19%"><b><font size="2"> 
<input type="text" name="breast" size="10" maxlength="10">
</font></b><font size="1">(inches)</font></td>
<td width="27%"> 
<div align="right"><font size="2">Cup Size:</font></div>
</td>
<td width="26%"><b><font size="2"> 
<input type="text" name="cup" size="5" maxlength="5">
</font></b></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Waist:</font></div>
</td>
<td width="19%"><font size="2"><b><font size="2"> 
<input type="text" name="waist" size="10" maxlength="10">
</font></b><font size="1">(inches)</font></font></td>
<td width="27%"> 
<div align="right"><font size="2"><font size="2">Hips:</font></font></div>
</td>
<td width="26%"><font size="2"><b><font size="2"> 
<input type="text" name="hips" size="5" maxlength="5">
</font></b><font size="1">(inches)</font></font></td>
</tr>
<tr> 
<td width="28%"> 
<div align="right"><font size="2">Dress:</font></div>
</td>
<td width="19%"> <font size="2"> 
<select name="dress" size="1">
<option value=" "></option>
<option value="00"><b>00</b></option>
<option value="0"><b>0</b></option>
<option value="1"><b>1</b></option>
<option value="2"><b>2</b></option>
<option value="3"><b>3</b></option>
<option value="4"><b>4</b></option>
<option value="5"><b>5</b></option>
<option value="6"><b>6</b></option>
<option value="7"><b>7</b></option>
<option value="8"><b>8</b></option>
<option value="9"><b>9</b></option>
<option value="10"><b>10</b></option>
<option value="11"><b>11</b></option>
<option value="12"><b>12</b></option>
<option value="13"><b>13</b></option>
<option value="14"><b>14</b></option>
<option value="15"><b>15</b></option>
<option value="16"><b>16</b></option>
<option value="17"><b>17</b></option>
<option value="18"><b>18</b></option>
<option value="19"><b>19</b></option>
<option value="20"><b>20</b></option>
<option value="Boat Cover"><b>Boat Cover</b></option>
<option value="Small Tent"><b>Small Tent</b></option>
<option value="Circus Tent"><b>Circus Tent</b></option>
</select>
</font></td>
<td width="27%"> [I cut here]
 
</tr>
</table>
 
</form>


Thank you for whatever help you can provide.

Mike

And here's the code snippet from the included .php file:
[sql]

// ################################################## ##########################
// ############################### EDIT PORTFOLIO ################################
// ################################################## ##########################


if ($_REQUEST['do'] == 'editportfolio')
{
if (can_administer() && $_REQUEST[id])
{
$id = $_REQUEST[id];
}
else
{
$id = $bbuserinfo['userid'];
}

$user = fetch_userinfo($id);

if (!$bbuserinfo['userid'])
{
print_no_permission();
}

if ($permissions['genericpermissions'] & CANVBPORTFOLIO) {

$result_data = $DB_site->query("
SELECT firstname,lastname,text,gender,age,email,bmonth,bd ay,byear,talent,address,address2,city,state,postal ,country,phone,phone2,phone3,phone4,website,inssta tus,aftra,sag,natas,experience,breast,cup,waist,he ight,weight,hips,dress,shoes,chest,inseam,ethnic,s tone,hcolor,ecolor,hstyle,piercings,glasses,braces ,handicap,hearing,marks,beard,moustache,tattoos,ru nway,fashion,printmedia,casual,commercial,editoria l,tradeshow,spokesmodel,sports,swimwear,artmodel,f ineartphoto,fineart,photomodel,perfart,internet,bo dyart,lingerie,glamour,acting,singing,dance,voiceo ver,stage,film,television,language,language2,flyin g,swimming,horse,skydiving,scuba,climbing,noagent, likeagent,agencyname,address3,address4,agentname,a gencycity,agencystate,agencypostal,agencycountry,p hone5,phone6,maillist,newsletter FROM " . TABLE_PREFIX . "vbportfolio_users WHERE userid = $id
");

$count = 0;
$data = $DB_site->fetch_Array($result_data);

$result_image = $DB_site->query("
SELECT vbportfolioid,name FROM " . TABLE_PREFIX . "vbportfolio_images WHERE userid = $id
");

while ($image = $DB_site->fetch_Array($result_image))
{
$count++;
eval('$editimagebits .= "' . fetch_template('vbportfolio_editimagebits') . '";');
}

$navbits = construct_navbits(array('' => 'vBPortfolio'));
eval('$navbar = "' . fetch_template('navbar') . '";');

eval('print_output("' . fetch_template('vbportfolio_editportfolio') . '");');
}
else
{
print_no_permission();
}
}

if ($_REQUEST['do'] == 'edit')
{
globalize($_POST, array('firstname','lastname','text','gender','age' ,'email','bmonth','bday','byear','talent','address ','address2','city','state','postal','country','ph one','phone2','phone3','phone4','website','insstat us','aftra','sag','natas','experience','breast','c up','waist','height','weight','hips','dress','shoe s','chest','inseam','ethnic','stone','hcolor','eco lor','hstyle','piercings','glasses','braces','hand icap','hearing','marks','beard','moustache','tatto os','runway','fashion','printmedia','casual','comm ercial','editorial','tradeshow','spokesmodel','spo rts','swimwear','artmodel','fineartphoto','fineart ','photomodel','perfart','internet','bodyart','lin gerie','glamour','acting','singing','dance','voice over','stage','film','television','language','lang uage2','flying','swimming','horse','skydiving','sc uba','climbing','noagent','likeagent','agencyname' ,'address3','address4','agentname','agencycity','a gencystate','agencypostal','agencycountry','phone5 ','phone6','maillist','newsletter'));

if (can_administer() && $_REQUEST[id])
{
$id = $_POST[id];
}
else
{
$id = $bbuserinfo['userid'];
}

if (!$bbuserinfo['userid'])
{
print_no_permission();
}

/*
if ($permissions['genericpermissions'] & CANVBPORTFOLIO) {
if (empty($firstname) OR empty($lastname) OR empty($id))
{
eval (print_standard_error('error_requiredfields'));
}
*/
if ($permissions['genericpermissions'] & CANVBPORTFOLIO) {
if (empty($id))
{
eval (print_standard_error('error_requiredfields'));
}

if (!empty($_FILES['src']['tmp_name'])) {
$name = $_FILES['src']['name'];
$data = addslashes(fread(fopen($_FILES['src']['tmp_name'], "r"), filesize($_FILES['src']['tmp_name'])));
$type = $_FILES['src']['type'];

$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "vbportfolio_images (userid, name, data, type) VALUES ($id, '$name', '$data', '$type')
");
}

$result_user = $DB_site->query("
SELECT * FROM " . TABLE_PREFIX . "vbportfolio_users WHERE userid = $id
");

$user = $DB_site->fetch_Array($result_user);

/*my hack
if ($firstname)
{
$nameupdate = "name = '" . addslashes($firstname) . "',"
}
else
{
$nameupdate = '';
}
*/

if (empty($user)) {
$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "vbportfolio_users (userid, firstname, lastname, text, gender, age, email, bmonth, bday, byear, talent, address, address2, city, state, postal, country, phone, phone2, phone3, phone4, website, insstatus, aftra, sag, natas, experience, breast, cup, waist, height, weight, hips, dress, shoes, chest, inseam, ethnic, stone, hcolor, ecolor, hstyle, piercings, glasses, braces, handicap, hearing, marks, beard, moustache, tattoos, runway, fashion, printmedia, casual, commercial, editorial, tradeshow, spokesmodel, sports, swimwear, artmodel, fineartphoto, fineart, photomodel, perfart, internet, bodyart, lingerie, glamour, acting, singing, dance, voiceover, stage, film, television, language, language2, flying, swimming, horse, skydiving, scuba, climbing, noagent, likeagent, agencyname, address3, address4, agentname, agencycity, agencystate, agencypostal, agencycountry, phone5, phone6, maillist, newsletter, lastactivity) VALUES ($id, '" . addslashes($firstname) . "', '" . addslashes($lastname) . "', '" . addslashes($text) . "', '" . addslashes($gender) . "', '" . addslashes($age) . "', '" . addslashes($email) . "', '" . addslashes($bmonth) . "', '" . addslashes($bday) . "', '" . addslashes($byear) . "', '" . addslashes($talent) . "', '" . addslashes($address) . "', '" . addslashes($address2) . "', '" . addslashes($city) . "', '" . addslashes($state) . "', '" . addslashes($postal) . "', '" . addslashes($country) . "', '" . addslashes($phone) . "', '" . addslashes($phone2) . "', '" . addslashes($phone3) . "', '" . addslashes($phone4) . "', '" . addslashes($website) . "', '" . addslashes($insstatus) . "', '" . addslashes($aftra) . "', '" . addslashes($sag) . "', '" . addslashes($natas) . "', '" . addslashes($experience) . "', '" . addslashes($breast) . "', '" . addslashes($cup) . "','" . addslashes($waist) . "', '" . addslashes($height) . "', '" . addslashes($weight) . "', '" . addslashes($hips) . "', '" . addslashes($dress) . "', '" . addslashes($shoes) . "', '" . addslashes($chest) . "', '" . addslashes($inseam) . "', '" . addslashes($ethnic) . "', '" . addslashes($stone) . "', '" . addslashes($hcolor) . "', '" . addslashes($ecolor) . "', '" . addslashes($hstyle) . "', '" . addslashes($piercings) . "', '" . addslashes($glasses) . "', '" . addslashes($braces) . "', '" . addslashes($handicap) . "', '" . addslashes($hearing) . "', '" . addslashes($marks) . "', '" . addslashes($beard) . "', '" . addslashes($moustache) . "', '" . addslashes($tattoos) . "', '" . addslashes($runway) . "', '" . addslashes($fashion) . "', '" . addslashes($printmedia) . "', '" . addslashes($casual) . "', '" . addslashes($commercial) . "', '" . addslashes($editorial) . "', '" . addslashes($tradeshow) . "', '" . addslashes($spokesmodel) . "', '" . addslashes($sports) . "', '" . addslashes($swimwear) . "', '" . addslashes($artmodel) . "', '" . addslashes($fineartphoto) . "', '" . addslashes($fineart) . "', '" . addslashes($photomodel) . "', '" . addslashes($perfart) . "', '" . addslashes($internet) . "', '" . addslashes($bodyart) . "', '" . addslashes($lingerie) . "', '" . addslashes($glamour) . "', '" . addslashes($acting) . "', '" . addslashes($singing) . "', '" . addslashes($dance) . "', '" . addslashes($voiceover) . "', '" . addslashes($stage) . "', '" . addslashes($film) . "', '" . addslashes($television) . "', '" . addslashes($language) . "', '" . addslashes($language2) . "', '" . addslashes($flying) . "', '" . addslashes($swimming) . "', '" . addslashes($horse) . "', '" . addslashes($skydiving) . "', '" . addslashes($scuba) . "', '" . addslashes($climbing) . "', '" . addslashes($noagent) . "', '" . addslashes($likeagent) . "', '" . addslashes($agencyname) . "', '" . addslashes($address3) . "', '" . addslashes($address4) . "', '" . addslashes($agentname) . "', '" . addslashes($agencycity) . "', '" . addslashes($agencystate) . "', '" . addslashes($agencypostal) . "', '" . addslashes($agencycountry) . "', '" . addslashes($phone5) . "', '" . addslashes($phone6) . "', '" . addslashes($maillist) . "', '" . addslashes($newsletter) . "', '" . time() . "')
");
}
else
{
$DB_site->query("
UPDATE " . TABLE_PREFIX . "vbportfolio_users SET firstname = '" . addslashes($firstname) . "', lastname = '" . addslashes($lastname) . "', text = '" . addslashes($text) . "', gender = '" . addslashes($gender) . "', age = '" . addslashes($age) . "', email = '" . addslashes($email) . "', bmonth = '" . addslashes($bmonth) . "', bday = '" . addslashes($bday) . "', byear = '" . addslashes($byear) . "', talent = '" . addslashes($talent) . "', address = '" . addslashes($address) . "', address2 = '" . addslashes($address2) . "', city = '" . addslashes($city) . "', state = '" . addslashes($state) . "', postal = '" . addslashes($postal) . "', country = '" . addslashes($country) . "', phone = '" . addslashes($phone) . "', phone2 = '" . addslashes($phone2) . "', phone3 = '" . addslashes($phone3) . "', phone4 = '" . addslashes($phone4) . "', website = '" . addslashes($website) . "', insstatus = '" . addslashes($insstatus) . "', aftra = '" . addslashes($aftra) . "', sag = '" . addslashes($sag) . "', natas = '" . addslashes($natas) . "', experience = '" . addslashes($experience) . "', breast = '" . addslashes($breast) . "', cup = '" . addslashes($cup) . "', waist = '" . addslashes($waist) . "', height = '" . addslashes($height) . "', weight = '" . addslashes($weight) . "', hips = '" . addslashes($hips) . "', dress = '" . addslashes($dress) . "', shoes = '" . addslashes($shoes) . "', chest = '" . addslashes($chest) . "', inseam = '" . addslashes($inseam) . "', ethnic = '" . addslashes($ethnic) . "', stone = '" . addslashes($stone) . "', hcolor = '" . addslashes($hcolor) . "', ecolor = '" . addslashes($ecolor) . "', hstyle = '" . addslashes($hstyle) . "', piercings = '" . addslashes($piercings) . "', glasses = '" . addslashes($glasses) . "', braces = '" . addslashes($braces) . "', handicap = '" . addslashes($handicap) . "', hearing = '" . addslashes($hearing) . "', marks = '" . addslashes($marks) . "', beard = '" . addslashes($beard) . "', moustache = '" . addslashes($moustache) . "', tattoos = '" . addslashes($tattoos) . "', runway = '" . addslashes($runway) . "', fashion = '" . addslashes($fashion) . "', printmedia = '" . addslashes($printmedia) . "', casual = '" . addslashes($casual) . "', commercial = '" . addslashes($commercial) . "', editorial = '" . addslashes($editorial) . "', tradeshow = '" . addslashes($tradeshow) . "', spokesmodel = '" . addslashes($spokesmodel) . "', sports = '" . addslashes($sports) . "', swimwear = '" . addslashes($swimwear) . "', artmodel = '" . addslashes($artmodel) . "', fineartphoto = '" . addslashes($fineartphoto) . "', fineart = '" . addslashes($fineart) . "', photomodel = '" . addslashes($photomodel) . "', perfart = '" . addslashes($perfart) . "', internet = '" . addslashes($internet) . "', bodyart = '" . addslashes($bodyart) . "', lingerie = '" . addslashes($lingerie) . "', glamour = '" . addslashes($glamour) . "', acting = '" . addslashes($acting) . "', singing = '" . addslashes($singing) . "', dance = '" . addslashes($dance) . "', voiceover = '" . addslashes($voiceover) . "', stage = '" . addslashes($stage) . "', film = '" . addslashes($film) . "', television = '" . addslashes($television) . "', language = '" . addslashes($language) . "', language2 = '" . addslashes($language2) . "', flying = '" . addslashes($flying) . "', swimming = '" . addslashes($swimming) . "', horse = '" . addslashes($horse) . "', skydiving = '" . addslashes($skydiving) . "', scuba = '" . addslashes($scuba) . "', climbing = '" . addslashes($climbing) . "', noagent = '" . addslashes($noagent) . "', likeagent = '" . addslashes($likeagent) . "', agencyname = '" . addslashes($agencyname) . "', address3 = '" . addslashes($address3) . "', address4 = '" . addslashes($address4) . "', agentname = '" . addslashes($agentname) . "', agencycity = '" . addslashes($agencycity) . "', agencystate = '" . addslashes($agencystate) . "', agencypostal = '" . addslashes($agencypostal) . "', agencycountry = '" . addslashes($agencycountry) . "', phone5 = '" . addslashes($phone5) . "', phone6 = '" . addslashes($phone6) . "', maillist = '" . addslashes($maillist) . "', newsletter = '" . addslashes($newsletter) . "', lastactivity = '" . time() . "' WHERE userid = $id
");
}

$result_image = $DB_site->query("
SELECT vbportfolioid,name FROM " . TABLE_PREFIX . "vbportfolio_images WHERE userid = $id
");

if (!empty($result_image))
{
while ($image = $DB_site->fetch_Array($result_image))
{
if ($_POST['delete'.$image['vbportfolioid']])
{
$DB_site->query("
DELETE FROM " . TABLE_PREFIX . "vbportfolio_images WHERE vbportfolioid = $image[vbportfolioid] LIMIT 1
");
}
}
}
Header("Location: $vboptions[bburl]/vbportfolio.php?do=editportfolio&id=$id");
}
else
{
print_no_permission();
}
}

if ($_REQUEST['do'] == 'delportfolio')
{
globalize($_REQUEST, array('id' => INT));

if (!$bbuserinfo['userid'] OR $bbuserinfo['usergroupid']!=6)
{
print_no_permission();
}

if (empty($id))
{
eval (print_standard_error('error_requiredfields'));
}

$DB_site->query("
DELETE FROM " . TABLE_PREFIX . "vbportfolio_users WHERE userid = $id
");

$DB_site->query("
DELETE FROM " . TABLE_PREFIX . "vbportfolio_images WHERE userid = $id
");

$DB_site->query("
DELETE FROM " . TABLE_PREFIX . "vbportfolio_comments WHERE vbportfolioid = $id
");

Header("Location: $vboptions[bburl]/vbportfolio.php?do=list");
}
[/sql]
Reply With Quote
  #6  
Old 05-14-2005, 01:00 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please use bb-codes like [php] [html] [sql] & [code]
Reply With Quote
  #7  
Old 05-14-2005, 01:10 PM
fashunphotog fashunphotog is offline
 
Join Date: Apr 2005
Location: US
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, I'm new to this vB thing and didn't realize I needed to use codes. Did I edit it correctly? There should be section with
HTML Code:
...
and one with [sql]...[/sql] (which is embedded in the .php file).

M
Reply With Quote
  #8  
Old 05-14-2005, 01:18 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is gonna be very easy.

In your template you have already this line:
HTML Code:
<input type="text" class="bginput" name="firstname" size="20" maxlength="30" />
Change that to:
HTML Code:
<input type="text" class="bginput" name="firstname" size="20" maxlength="30" value="$data[firstname]"/>
You can just add the value statements for each field.

Some more, the following:
PHP Code:
        $result_data $DB_site->query("
            SELECT firstname,lastname,text,gender,age,email,bmonth,bday,byear,talent,address,addres  s2,city,state,postal,country,phone,phone2,phone3,phone4,website,insstatus,aftra,  sag,natas,experience,breast,cup,waist,height,weight,hips,dress,shoes,chest,insea  m,ethnic,stone,hcolor,ecolor,hstyle,piercings,glasses,braces,handicap,hearing,ma  rks,beard,moustache,tattoos,runway,fashion,printmedia,casual,commercial,editoria  l,tradeshow,spokesmodel,sports,swimwear,artmodel,fineartphoto,fineart,photomodel  ,perfart,internet,bodyart,lingerie,glamour,acting,singing,dance,voiceover,stage,  film,television,language,language2,flying,swimming,horse,skydiving,scuba,climbin  g,noagent,likeagent,agencyname,address3,address4,agentname,agencycity,agencystat  e,agencypostal,agencycountry,phone5,phone6,maillist,newsletter FROM " 
TABLE_PREFIX "vbportfolio_users WHERE userid = $id
        "
);
 
        
$count 0;
        
$data $DB_site->fetch_Array($result_data); 
Can also be written like:
PHP Code:
        $data $DB_site->query_first("
            SELECT firstname,lastname,text,gender,age,email,bmonth,bday,byear,talent,address,addres  s2,city,state,postal,country,phone,phone2,phone3,phone4,website,insstatus,aftra,  sag,natas,experience,breast,cup,waist,height,weight,hips,dress,shoes,chest,insea  m,ethnic,stone,hcolor,ecolor,hstyle,piercings,glasses,braces,handicap,hearing,ma  rks,beard,moustache,tattoos,runway,fashion,printmedia,casual,commercial,editoria  l,tradeshow,spokesmodel,sports,swimwear,artmodel,fineartphoto,fineart,photomodel  ,perfart,internet,bodyart,lingerie,glamour,acting,singing,dance,voiceover,stage,  film,television,language,language2,flying,swimming,horse,skydiving,scuba,climbin  g,noagent,likeagent,agencyname,address3,address4,agentname,agencycity,agencystat  e,agencypostal,agencycountry,phone5,phone6,maillist,newsletter FROM " 
TABLE_PREFIX "vbportfolio_users WHERE userid = $id
        "
);
 
        
$count 0
And probably even better like:
PHP Code:
        $data $DB_site->query_first("
            SELECT * FROM " 
TABLE_PREFIX "vbportfolio_users WHERE userid = $id
        "
);
 
        
$count 0
Reply With Quote
  #9  
Old 05-14-2005, 01:42 PM
fashunphotog fashunphotog is offline
 
Join Date: Apr 2005
Location: US
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would this work for the radio button inputs and menu/list input boxes as well?

M

Ok, I tried that and am getting these messages:

Code:
Database error in vBulletin 3.0.7:

Invalid SQL: 
				INSERT INTO vbportfolio_users (userid, firstname, lastname, text, gender, age, email, bmonth, bday, byear, talent, address, address2, city, state, postal, country, phone, phone2, phone3, phone4, website, insstatus, aftra, sag, natas, experience, breast, cup, waist, height, weight, hips, dress, shoes, chest, inseam, ethnic, stone, hcolor, ecolor, hstyle, piercings, glasses, braces, handicap, hearing, marks, beard, moustache, tattoos, runway, fashion, printmedia, casual, commercial, editorial, tradeshow, spokesmodel, sports, swimwear, artmodel, fineartphoto, fineart, photomodel, perfart, internet, bodyart, lingerie, glamour, acting, singing, dance, voiceover, stage, film, television, language, language2, flying, swimming, horse, skydiving, scuba, climbing, noagent, likeagent, agencyname, address3, address4, agentname, agencycity, agencystate, agencypostal, agencycountry, phone5, phone6, maillist, newsletter, lastactivity) VALUES (1, 'Michael', 'Commini', 'You may put anything here you\'d like.  Build 
a resume, list the models/photographers you\'ve
worked with, be creative.', ' ', ' ', '', '', '', '', ' ', '', '', '', '', '', '', '', '', '', '', '', ' ', ' ', ' ', ' ', '', '', '','', '', '', '', ' ', ' ', '', '', 'African', 'Fair', 'Blue', ' ', 'Bald', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ' ', ' ', '', '', '', '', '', '', '', '', '', '', ' ', ' ', '1116083892')
			
mysql error: Duplicate entry '1' for key 1

mysql error number: 1062

Date: Saturday 14th of May 2005 11:18:12 AM
Script: http://www.chicagotalentgroup.com/forums/vbportfolio.php
Referer: http://www.chicagotalentgroup.com/forums/vbportfolio.php?do=editportfolio
Username: mcommini
IP Address: 69.142.145.218
and when I tried to put the code back to the original I get the following parse error:
Code:
Parse error: parse error, unexpected T_STRING in /home/chicagot/public_html/forums/vbportfolio.php on line 177
I'm not sure why it tried to insert instead of updating....

Ok, I figured out what I did wrong - first, I modified the original code which already had what I needed built in! Talk about creating my own problem!

Next, I put the code you suggested in the wrong place! Once I realized that I was able to take care of the problems and get it working.

The only problems I'm having now is that I can no longer use checkboxes and radio buttons 'cause I can't figure out how to assign the variable value and the other is the pictures are expanding to the right. I don't know how to layer them in rows. Any suggestions?

Mike

PS - Give me the url you'd like me to use on my credits page and I'll be sure to give you the credit you deserve!
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:05 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05230 seconds
  • Memory Usage 2,425KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (4)bbcode_html
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete