Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase 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:
  #1  
Old May 6th, 2007, 09:45 PM
Souliebaby Souliebaby is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 65 Souliebaby User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 5 m 28 sec
Reputation Power: 4
Something wrong?

I've just done a simple update query and it's not updating my database? Could someone please have a look at my code and see what I've done wrong?

Code:

<?php

require( "dbconn.php" );

		if( array_key_exists( 'header', $_POST ) ){
			
			$selectOther = "SELECT * FROM sn_columnists WHERE writer = '". $_POST['writer'] ."'";
													
			$finalOtherQuery = mysql_query($selectOther);
										
			while ($other = mysql_fetch_assoc($finalOtherQuery)){
			
			$date = $_POST['day'] . ' ' . $_POST['month'] . ' ' . $_POST['year'];
			
			$insertQuery = "UPDATE `sn_articles` SET date = '" . $date . "', header = '" . $_POST['header'] . "', writer = '" . $_POST['writer'] . "', alias = '" . $_POST['alias'] . "', featured = '" . $_POST['featured'] . "', article = '" . $_POST['article'] . "', archive = '" . $_POST['archive'] . "', category = '" . $_POST['category'] . "', menu = '" . $other['menu'] . "' WHERE id = '" . $_POST['id'] . "' ";
			
			$result = mysql_query( $insertQuery ) or die( "There was an error with my query! ".mysql_error()."<br>The query was: ".$insertQuery);
			
			$submitted = '<p align="center"><strong>Your article has been edited sucessfully!</strong></p><p><a href="javascript:history.back()">Back</a></p><p><strong><a href="admin.php">Admin Main</a></strong> | <strong><a href="logout.php">Logout</a></strong></p>';
			
			}
			
		}
			
?>


Thank you

Reply With Quote
  #2  
Old May 7th, 2007, 01:55 AM
Humanetainit's Avatar
Humanetainit Humanetainit is offline
Beyond help
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Location: The Netherlands
Posts: 223 Humanetainit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 32 m 30 sec
Reputation Power: 2
Check out the reserved words for sql; date is among them. You can use it, but make sure there are no spaces behind it.

date='" . $date . "'

should work.
__________________
One World... Humanetainit | Program secure

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > Something wrong?


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