Jump to content


Photo

NEWBIE...need help..Again


  • Please log in to reply
7 replies to this topic

#1 cnagra

cnagra
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 17 April 2006 - 06:15 PM

i got it to work, but suddenly jus stopped.
only data to the first field out of two gets data added to it. there is something wrong with the html file or the php file.

database is called data2, the fields are name and topic

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]html file code[!--colorc--][/span][!--/colorc--]

<form name="form" method="post"
action="add_workin.php">

Name: <input type="text" name="name"><br>
Test: <input type="text" name="topic"><br>

<input type="Submit">
</form>

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]php code[!--colorc--][/span][!--/colorc--]

<?php

mysql_pconnect('localhost');
mysql_select_db('test2');

mysql_query("insert into test values ('$name','$topic')");

?>

thanks...please help

#2 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 17 April 2006 - 06:34 PM

$sql = mysql_query("INSERT INTO test(name,topic) VALUES('$name','$topic')");

#3 cnagra

cnagra
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 17 April 2006 - 06:43 PM

[!--quoteo(post=365621:date=Apr 17 2006, 01:34 PM:name=Richard181)--][div class=\'quotetop\']QUOTE(Richard181 @ Apr 17 2006, 01:34 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
$sql = mysql_query("INSERT INTO test(name,topic) VALUES('$name','$topic')");
[/quote]

hi, that worked fine, but only with numbers, they are both set to VARCHAR, so i dont get why this is ?


#4 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 17 April 2006 - 06:46 PM

what you mean it only works with number? the database should receive anything you put in the text area

#5 cnagra

cnagra
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 17 April 2006 - 06:54 PM

[!--quoteo(post=365625:date=Apr 17 2006, 01:46 PM:name=Richard181)--][div class=\'quotetop\']QUOTE(Richard181 @ Apr 17 2006, 01:46 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
what you mean it only works with number? the database should receive anything you put in the text area
[/quote]


yeah thats what i thougt, but if input numbers in the fields, it works...but dont except text?....so strange....do u know why?

#6 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 17 April 2006 - 06:59 PM

not really you would have to wait untill someon that knows better if they know was wrong, becuase i got a form like that and it gets the values the right way..

#7 cnagra

cnagra
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 17 April 2006 - 07:06 PM

thanks anyway..

please someone help...it still only adds numbers!!

#8 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 17 April 2006 - 07:27 PM

one more thing did you define thefields as veriables?

or what you showed is the whole code?





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users