Cannot Update Database

Started on the old forum in October 2009 · view the original in the archive · old links redirect here

8 replies · 453 views · started 17 years ago · 1 min read

5 participants
Mysterio Lead · 630 posts #1

Hi, can anyone help me where is the problem?

index.php

else if($action=="uset2"){ $dob = explode("-",$bdy[0]); boxstart("Update"); echo "

<form action=\"genproc.php?action=uprof2&amp;sid=$sid\" method=\"post\"> School: <input id=\"inputText\" type=\"text\" name=\"school\" maxlength=\"30\"/>

Bad HAbits: <input id="inputText" type="text" name="habitsb" maxlength="150"/>

Good Habits: <input id="inputText" type="text" name="habitsg" maxlength="150"/>

Sport: <input id="inputText" type="text" name="favsport" maxlength="20"/>

Music: <input id="inputText" type="text" name="favmusic" maxlength="20"/>

Orient Sex: <select id="inputText" name="sexpre">

<option value=\"Hetero\">Hetero</option> <option value=\"Homo\">Homo</option></select>

Height (cm): <input id="inputText" type="text" name="height" maxlength="3"/>

Weight (kg): <input id="inputText" type="text" name="weight" maxlength="3"/> "; /// echo "Race: <input id="inputText" type="text" name="racerel" maxlength="50"/> "; echo " Hair: <input id="inputText" type="text" name="hairtype" maxlength="10"/>

Eyes: <input id="inputText" type="text" name="eyescolor" maxlength="10"/>


Want more?: <input id="inputText" type="text" name="moretext" maxlength="500"/>

<input id="inputButton" type="submit" value="Update"/>

</form>

"; }

genproc.php

else if($action=="uprof2") { $sexpre = $_POST["sexpre"]; $height = $_POST["height"]; $weight = $_POST["weight"]; $racerel = $_POST["racerel"]; $hairtype = $_POST["hairtype"]; $eyescolor = $_POST["eyescolor"]; $habitsb = $_POST["habitsb"]; $habitsg = $_POST["habitsg"]; $favsport = $_POST["favsport"]; $favmusic = $_POST["favmusic"]; $school = $_POST["school"]; $moretext = $_POST["moretext"];

$res = mysql_query("UPDATE ibwf_xinfo SET sexpre='".$sexpre."', height='".$height."', weight='".$weight."', racerel='".$racerel."', hairtype='".$hairtype."', eyescolor='".$eyescolor."', habitsb='".$habitsb."', habitsg='".$habitsg."', favsport='".$favsport."', favmusic='".$favmusic."', school='".$school."', moretext='".$moretext."' WHERE id='".$uid."'");

if($res) { echo "Done "; }else{ echo "Error "; } }

Why do I always get error? Or am I blink?

mysterio.al - programming is a functional art

Mysterio Lead · 630 posts #3

Just error (echo "Error ";) See the script above!

mysterio.al - programming is a functional art

riderz Lead · 975 posts #4

what are ur site link

and ur problem are in ur config.php


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Mysterio Lead · 630 posts #6

WhiteWarrior wrote: Upload the ibwf_xinfo table here

i can remove it, but anyway, the values are not going to be updated in the database.

mysterio.al - programming is a functional art

Mysterio Lead · 630 posts #7

Ok, here is the database:

CREATE TABLE IF NOT EXIST 'ibwf_xinfo' ( 'uid' int(100) NOT NULL DEFAULT '0', 'sexpre' varchar(100) DEFAULT 'Not Given', 'height' varchar(100) DEFAULT 'Not Given', 'weight' varchar(100) DEFAULT 'Not Given', 'racerel' varchar(100) DEFAULT 'Not Given', 'hairtype' varchar(100) DEFAULT 'Not Given', 'eyescolor' varchar(100) DEFAULT 'Not Given', 'habitsb' varchar(100) DEFAULT 'Not Given', 'habitsg' varchar(100) DEFAULT 'Not Given', 'favsport' varchar(100) DEFAULT 'Not Given', 'favmusic' varchar(100) DEFAULT 'Not Given', 'school' varchar(100) DEFAULT 'Not Given', 'moretext' varchar(100) DEFAULT 'Not Given' ) ENGINE = MyISAM DEFAULT CHARSET=latin1;

mysterio.al - programming is a functional art

Anshul Senior · 296 posts #8

Add if(!$res) echo mysql_error(); after $res update query and post here wat error u get

Mysterio Lead · 630 posts #9

thanks mates, i corected it, and it was my mistake. Because i tried to perform the action with a new user. So, there is not going to be and "UPDATE", but a "SET". I will post full code if you want... Thanks you!

mysterio.al - programming is a functional art

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close