FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


mysql errors. No error given by mysql_error()





devroom
Hello

Here is my local server config:
PHP 5.1.6, Apache 2.0.59, MySQL 5.0.24a and phpmyadmin 2.8.2.4

Here are the codes which arent working. I have tried 'or die(mysql_error())' but no error was given but it did die sometimes.

Code:
$query = "UPDATE #__pms SET timezone = '$timezone', mailonnew = '$mailonnew', blocked = '$blocklist'\n WHERE userid = '$user_id'";
$db->setQuery($query);


Code:
//receipent has space left for a message?
$query   = "SELECT COUNT(*) FROM #__pms \n"
      . "WHERE toid = '$receiver'";
$db->setQuery($query) or die (mysql_error());
$total      = $db->loadResult() or die (mysql_error());
    
if ($total < $config['maxmessages'] || $system) {
  $query   = "INSERT INTO #__pms (`id`, `toid`, `fromid`, `subject`, `message`, `inbox`, `outbox`, `readed`, `system`, `disablereply`, `datetime`) \n"
        . "VALUES ('', '$receiver', '$user_id', '$subject', '$message', '1', '1', '0', '$disable', '$system', '$datetime') ";
     $db->setQuery($query) or die ('not written because: '.mysql_error());
if (!$db->query()) {
  JError::raiseError( 500, $db->stderror());
}


Code:
$query      = "SELECT id, toid, fromid, subject, message, inbox, outbox, readed, system, disablereply, datetime FROM #__pms WHERE id = '$messageid' ";
  $db->setQuery($query);
  $result = $db->loadRow();
  if (!$db->query()) {
   JError::raiseError( 500, $db->stderror());
  }

  #TODO Make user able to read. Somehow its not working
  //Can user view choosen message?
  if (!$result) {
    $mainframe->redirect( "index.php?option=com_pms&Itemid=$Itemid" , JText::_('MUST SELECT') ).$messageid; exit;
  } else if ($result['toid'] == $user_id || $result['fromid'] == $user_id) {
   $ok = 1;
  } else {
   $mainframe->redirect( 'index.php?option=com_pms&Itemid='.$Itemid.'&t='.$result['toid'] , JText::_('MUST SELECT') ); exit;


If you give help that let it work ill pay you for it. It just frihs, but its about the idea

Grtx and thx in advance Cool

Edit: This code is developed for joomla 1.5
hexkid
devroom wrote:
Hello


Hi, what is $db->setQuery() definition?
What is $db->loadResult() definition?
What is $db->loadRow() definition?
What is $mainframe->redirect() definition?
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.