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 August 18th, 2003, 11:51 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 19 sec
Reputation Power: 6
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
Problem getting function to update DB From Form

I have a function which is suppose to take data from a form and place it into a MySQL table. For the most part it is working except for the text area portion. It changes whatever I type to the word "array".

Attached is the file with the form and below is the function
PHP Code:
function editnews($type$title$article$articleid)
   {
    
mysql_query("UPDATE news SET type='$type',title='$title',news='$article' WHERE id='$articleid'")or die('Could not enter the news article in the database. Please inform the webmaster immediately '.mysql_error());
    
mysql_query("OPTIMIZE TABLE news")or die("Unable to optimize table news. Please inform the <a href=mailto:webmaster@suanhacky.org>webmaster</a> all information pertaining to this error. ".mysql_error());
    
$newsquery=mysql_query("SELECT * FROM news WHERE id='$articleid'")or die('could not preview the Article. Please inform the webmaster immediately '.mysql_error());
    
$news=mysql_fetch_array($newsquery);
    
$posted=date("m/d/Y"strtotime($news['date']));
    require_once(
"class.newstype.php");
    echo 
"<table width=100% cellspacing=2 cellpadding=2 border=1><th bgcolor=#400000><center>".$news['title']." - ".$newstype." - ".posted." Posted by: ".$news['added_by']."</center></th><tr><td>".$news['news']."</td></tr></table>";
    
setcookie ('suanhackyeditnews',$articleid,time()-1800);
   } 
Attached Files
File Type: zip editnews.zip (1.1 KB, 260 views)
__________________
CHornJr
"One day I'll know what I am doing"
My Blog
Suanhacky Lodge #49
Rebel Squadrons

Reply With Quote
  #2  
Old August 19th, 2003, 06:56 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
I don't see problems in either the generated HTML (except that field names aren't quoted, which probably wouldn't cause a problem like what you've encountered) or the code. Maybe you've got a scope issue and $article is set as an array elsewhere in your code. Try doing print_r($article) to see what it contains and see if that helps you debug.

Reply With Quote
  #3  
Old August 19th, 2003, 07:18 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 19 sec
Reputation Power: 6
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
I got it working now. I changed it to use the super global ($_POST['BLAH']) Which I should have done before

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Problem getting function to update DB From Form


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 1 hosted by Hostway
Stay green...Green IT