GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 4.50 average.
  #11  
Old 21-Aug-2003, 09:17
dexthageek dexthageek is offline
New Member
 
Join Date: Aug 2003
Posts: 4
dexthageek is an unknown quantity at this point
Im not sure I fully understand what you are trying to do, but

if you are pulling dates from a mysql Database then you can use the date_format() function and manipulate the date in many different ways.

do a search on the different settings you can specify, its a tough function to find info on but its out there.

Hope this helps

Mike

Thanks again for the help
  #12  
Old 21-Aug-2003, 10:03
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello mike,

I am glad you've solved your issue in this thread but I don't think it's wise to post your email in any posts here. I will edit your email addresses above but next time, please use example@example.com in your sample code or posts.

We never know which email harvester is making it's rounds here...
  #13  
Old 22-Aug-2003, 11:26
matthias
 
Posts: n/a

i can't find my mistake here


Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/partyguide/admin/pp/main.php on line 112

It's late, but i'm kinda stuck

function upload_flyer()
{
if( $_FILES['flyer']['tmp_name'] == "" )
{
return "";
}
if( $_FILES['flyer']['size'] >= 1400000 )
{
print "Upload fout: de flyer is te groot.";
return -1;
}
else if( !strstr( $_FILES['flyer']['type'], "image" ) || ( substr( $_FILES['flyer']['name'], -4 ) != ".jpg" && substr( $_FILES['flyer']['name'], -4 ) != ".gif" && substr( $_FILES['flyer']['name'], -4 ) != ".png" ) )
{
print "Upload fout: de flyer is geen figuur.";
return -1;
}
else if( UPLOAD_ERR_OK == $_FILES['flyer']['error'] )
{
$hash = md5_file( $_FILES['flyer']['tmp_name'] );

$filename = "images/pp/".$hash.strrchr($_FILES['flyer']['name'], '.' );
move_uploaded_file( $_FILES['flyer']['tmp_name'], $filename ) or die( "move_uploaded_file( $_FILES['flyer']['tmp_name'], \"images/pp/\".$hash.strrchr($_FILES['flyer']['tmp_name'], '.') ) failed" );
return $filename;
}
else
{
print "Upload fout: ". $_FILES['flyer']['error'];
return -1;
}
}
  #14  
Old 22-Aug-2003, 11:33
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello matthias,

Where is line 112? If it's late there, it's very, VERY late here and please use the [ php ] syntax highlighting bbcode to paste php codes.
  #15  
Old 22-Aug-2003, 13:18
matthias
 
Posts: n/a
PHP Code:

move_uploaded_file( $_FILES['flyer']['tmp_name'], $filename ) or die( "move_uploaded_file( $_FILES['flyer']['tmp_name'], \"images/pp/\".$hash.strrchr($_FILES['flyer']['tmp_name'], '.') ) failed" ); 


  #16  
Old 22-Aug-2003, 15:57
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Ah, that's much better and the error is much easier to pin-point:

Try this:
PHP Code:

<?php
move_uploaded_file( $_FILES['flyer']['tmp_name'], $filename )
  or die( "move_uploaded_file( {$_FILES['flyer']['tmp_name']}, \"images/pp/\".$hash.strrchr({$_FILES['flyer']['tmp_name']}, '.') ) failed" );
?>

  #17  
Old 26-Mar-2004, 23:41
xochi xochi is offline
New Member
 
Join Date: Mar 2004
Posts: 1
xochi is on a distinguished road
Wink

this totally helped me out


Quote:
Originally Posted by ukrspp21
Surround your variables like
PHP Code:

'".$var."' 



it should work.

This was totally my problem and it helped, thank you ukrspp21 very much!!
  #18  
Old 22-Jul-2004, 08:55
sblaw sblaw is offline
New Member
 
Join Date: Jul 2004
Posts: 3
sblaw is on a distinguished road

one more


I have no idea what might be wrong about this source

PHP Code:

<html>
<head><title>My Library</title></head>
<body>
<?php

class BookList {
  var $parser;
  var $records;
  var $record;
  var $current_field = '';
  var $field_type;
  var $ends_record;

  function BookList ($filename) {
    $this->parser = xml_parser_create();
    xml_set_object($this->parser, &$this);
    xml_set_element_handler($this->parser, 'start_element', 'end_element');
    xml_set_character_data_handler($this->parser, 'cdata');

    // 1 = single field, 2 = array field, 3 = record container
    $this->field_type = array('title' => 1,
                              'author' => 2,
                              'isbn' => 1,
                              'comment' => 1);
    $this->ends_record = array('book' => true);

    $x = join("", file($filename));
    xml_parse($this->parser, $x);
    xml_parser_free($this->parser);
  }

  function start_element ($p, $element, &$attributes) {
    $element = strtolower($element);
    if ($this->field_type[$element] != 0) {
      $this->current_field = $element;
    } else {
      $this->current_field = '';
    }
  }

  function end_element ($p, $element) {
    $element = strtolower($element);
    if ($this->ends_record[$element]) {
      $this->records[] = $this->record;
      $this->record = array();
    }
    $this->current_field = '';
  }

  function cdata ($p, $text) {
    if ($this->field_type[$this->current_field] === 2) {
      $this->record[$this->current_field][] = $text;
    } elseif ($this->field_type[$this->current_field] === 1) {
      $this->record[$this->current_field] .= $text;
    }
  }

  function show_menu() {
    echo "<table border=1>\n";
    foreach ($this->records as $book) {
      echo "<tr>";
      $authors = join(', ', $book['author']);
      printf("<th align=left><a href='%s'>%s</a></th><td>%s</td></tr>\n",
             $_SERVER['PHP_SELF'] . '?isbn=' . $book['isbn'],
             $book['title'],
             $authors);
      echo "</tr>\n";
    }
    echo "</table>\n";
 `?? }

  function show_book ($isbn) {
    foreach ($this->records as $book) {
      if ($book['isbn'] !== $isbn) {
        continue;
      }

      $authors = join(', ', $book['author']);
      printf("<b>%s</b> by %s.<br>", $book['title'], $authors);
      printf("ISBN: %s<br>", $book['isbn']);
      printf("Comment: %s<p>\n", $book['comment']);
    }
?>
Back to the <a href="<?= $_SERVER['PHP_SELF'] ?>">list of books</a>.<p>
<?
  }
};

// main program code

$my_library = new BookList ("books.xml");
if ($_GET['isbn']) {
  // return info on one book
  $my_library->show_book($_GET['isbn']);
} else {
  // show menu of books
  $my_library->show_menu();
}

?>

</body></html> 


Last edited by JdS : 23-Jul-2004 at 07:26. Reason: Please insert [php] & [/php] tags between your example PHP codes
  #19  
Old 23-Jul-2004, 07:29
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
What's this bit here: `?? (in your code example above)?
  #20  
Old 26-Jul-2004, 00:15
sblaw sblaw is offline
New Member
 
Join Date: Jul 2004
Posts: 3
sblaw is on a distinguished road
i've already deleated this bit, but it still doesn't work...
 
 

Recent GIDBlogMatch IP in CIDR by gidnetwork

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:43.


vBulletin, Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.