Jump to content

Recommended Posts

if (isset($_POST['docreate']) && isset($_POST['news']))

{

SQLQuery('INSERT INTO `'.SQLTable('news').'` (`ID`, `PostedTime`, `Title`, `Text`) VALUES (\'\', '.time().', \''.$_POST['title'].'\', \''.$_POST["news"].'\');'); print 'News added to database<br><br><hr>';

}

?>

 

 

Whats wrong with the bold part of things?

 

instead of:

SQLQuery('INSERT INTO `'.SQLTable('news').'` (`ID`, `PostedTime`, `Title`, `Text`) VALUES (\'\', '.time().', \''.$_POST['title'].'\', \''.$_POST["news"].'\');'); 

 

try this:

mysql_query("INSERT INTO `news` (`ID`, `PostedTime`, `Title`, `Text`) VALUES ('".time()."', '".$_POST['title']."', '".$_POST['news']."')") or die("Error: ".mysql_error()); 

dont you need another variable to actually execute the query?

 

eg. $result = mysql_query($SQLQuery) or die (mysql_error());

 

Not for an insert statement.

 

$result = SQLQuery('SELECT ID,Day,Month,Year,ShortDescription FROM `'.SQLTable('party').'` WHERE `ClubID`='.$_GET['view'].' ORDER BY `Year` DESC,`Month` DESC,`Day` DESC');

 

$result = SQLQuery("SELECT ID,Day,Month,Year,ShortDescription FROM `".SQLTable('party')."` WHERE `ClubID`=".$_GET['view']." ORDER BY `Year`,`Month`,`Day` DESC");

 

You do not need to put DESC after every single column in the order by. And for debugging purposes I would add this to that line

 

$result = SQLQuery("SELECT ID,Day,Month,Year,ShortDescription FROM `".SQLTable('party')."` WHERE `ClubID`=".$_GET['view']." ORDER BY `Year`,`Month`,`Day` DESC") or DIE(mysql_error());

 

--FrosT

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.