MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 24th, 2004, 03:57 AM
tox tox is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 9 tox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php/mysql (update table)

Problem is, if you try to update, only numbers are applyed. If I want to save words or single letters or numbers/letters mixed, it doesn't work.
I don't know what the problem is. Any of you maybe?

full code:
Code:
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<?
// - connecting and getting information -
$link = mysql_connect("server", "user", "password") or die("Could not connect: " . mysql_error());
mysql_select_db('radar', $link) or die ('Can\'t connect to database: ' . mysql_error());
$query = mysql_query("SELECT * FROM `test`") or die ('<h3>Some error');
while ($data = mysql_fetch_array($query)){
$header = $data['header'];
}
?>
<!-- start of the HTML FORM part -->
<form ENCTYPE="multipart/form-data" action='<? echo"$php_self"; ?>' method="post">
<input type="text" name="name" size="50" <?echo "value='$header'";?>><br>
<button type="submit">save</button>
</form>

<?
// - PHP updating part -
$header = $_REQUEST['name'];
$sql = "UPDATE `test` SET `header` = $header ";
$result = mysql_query($sql);
if ($result){echo "updated <br>";}
if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
echo "<meta http-equiv='refresh' content='1;URL=$PHP_SELF'>"; 
}
?>
</body></html>



here is the url it is running atm: http://www.folklore.ee/radar/test/xxx.php

Database is MySQL. The row "test" has type "text".

Any suggestions/help is welcome. Thanks.

Reply With Quote
  #2  
Old April 26th, 2004, 08:21 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Numbers don't require quotes; string values do. Wrap your string fields in quotes and you should be good to go.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > php/mysql (update table)


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 2 hosted by Hostway