Jump to content

massive

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

massive's Achievements

Member

Member (2/5)

0

Reputation

  1. Your URL directory was this: [code]$filename3 = "/www/htdocs/images/"[/code] try changing it into this instead, every single url you have change your 'singel slashes' to 'double slashes'. . . [code]$filename3 = "//www//htdocs//images//"[/code] or the other way [code]$filename3 = "\\www\\htdocs\\images\\"[/code] hope this helps
  2. Hi,there I have an attendance report and employees logs in and logs out for that specific date and time. I want to get the employees first log-in of the day and the last log-out of the day from its timestamp but in a day..employees logs-in and logs-out quite often I tried to use DISTINCT but the timestamp is still unique so my reports generates like this lets say: Employee1 08:02:11 Employee1 08:03:32 Employee1 08:10:23 Employee1 08:12:11 Employee1 08:20:11 Employee1 08:20:16 Employee2 08:02:11 Employee2 08:03:32 Employee2 08:10:23 Employee3 08:12:11 Employee3 08:20:11 Employee1 08:20:16 i only need this: Employee1 08:02:11 in Employee1 08:20:16 out and so on... heres the my code its a join query [code] $query  = "SELECT DISTINCT concat( users.lastname, ', ', users.firstname ) AS name, time_log.log,                time_log.ts FROM users, time_log WHERE time_log.user = users.userID AND time_log.ts LIKE '2006-05-25 08:%' ORDER BY ts ASC"; [/code] thanks in advance
  3. Follow up to my question...why im asking this is because i have trouble submitting my forms, i always receive "missing record Id" even though the datas where displayed correctly getting the information from the other page. Script1.php <include/class.php> //<<<---------i'm using classes if((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing record ID!'); } $id = $_GET['id']; <html> the data were displayed here coming from the other script </html> ok it displays perfectly now when i submit it: message: missing record id... i have trouble submitting my forms when it come to classes in a way when i include the: if((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing record ID!'); } $id = $_GET['id']; thing...tnx any ideas of getting data from other pages when it comes to object-oriented programming?
  4. Hi, i have a question is there another way of getting your data from another page besides this: [code] if((!isset($_GET['id']) || trim($_GET['id']) == ''))         {             die('Missing record ID!');         }     $id = $_GET['id']; [/code] thanks :)
  5. Try this: Drop-down for Month: [code] <select name = "month"> <option value="<? echo $_POST['month']?>"><? echo $_POST['month']?></option> <option>------------------------------------</option> <--try adding this also to seperate the selected item :) <option value ="January">January</option> etc....until December [/code] Drop-down for Day: [code] <select name = "day"> <option value="<? echo $_POST['day']?>"><? echo $_POST['day']?></option> <option>------------------------------------</option> <--try adding this also to seperate the selected item :) 1 to 31 same here... [/code] Drop-down for year [code] <select name = "year"> <option value="<? echo $_POST['year']?>"><? echo $_POST['year']?></option> <option>------------------------------------</option> <--try adding this also to seperate the current selected item :) <option value ="1905">1905</option> [/code] Hope this helps
  6. Form1.php [code] <?          $sql     = "SELECT * FROM users WHERE user_id = 1";          $result = mysql_query($sql) or die (mysql_error()); ?> [/code] [code] <html> <? if (mysql_num_row($result) > 0)     { ?>       <table>                    <? while($row = mysql_fetch_object($result))                         {  ?>         <tr>               <td><? echo $row->FirstName ?> </td><td><a href =edit.php?[b]id=<? echo $row->id?>[/b]>               </td>        </tr>        <? } ?>      </table>      <? } ?> </html> [/code] you have notice why i've bold the link so you can easily identify what i'm pointing out here :) let's continue Form2.php [code] <? if((!isset($_GET['id']) || trim($_GET['id']) == ''))         {             die('Missing record ID!');         }     $id     = $_GET['id'];     $mysql  = "SELECT * FROM user WHERE user_id = '$id'";     $result = mysql_query($mysql) or die(mysql_error());     $row    = mysql_fetch_object($result); echo <? $row->LastName; ?> [/code] // here i outputted the last name of the user from form1 by using [b]$_GET['id'][/b] the "id" inside the $_GET[' '] was declared from form.1: <a href =edit.php?[b]id[/b]=<? echo $row->id?>> hope this helps :)
  7. [!--quoteo(post=378376:date=May 30 2006, 09:12 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 30 2006, 09:12 AM) [snapback]378376[/snapback][/div][div class=\'quotemain\'][!--quotec--] You should use something like this: [code]$query = mysql_query(SELECT * FROM table") or die(mysql_error()); while ($row = mysql_fetch_row($query)) {    echo $row['information']; }[/code] [/quote] i think your query is outside the class? i could apply this if i was not using classes :) i think...:(
  8. Hi :) , i have trouble displaying my datas in my html pages...i could but i can only display one data... i've made a class script named zql.php: so [code] Class Zql {          function Zql()          {           some task...                   }       now here we go lets concentrate here:        function getData()      {         $query  = "SELECT *                        FROM   meals";             $result = mysql_query($query, $this->connection);                          $data = mysql_fetch_array($result);             return $data;             } }        $file = new Zql; [/code] Displaying page: Display.php [code] <?       //I'm trying to get every information here      include("include/Zql.php");      $information = $file->getData(); ?> [/code] lets say we had some html codes here: <html> blah blah blah....so when i display it... like lets say: <table> <tr> <td><? echo $information['FoodName']?></td> </tr> </table> </html of course it will only display one data...i tried doing while conditions and for conditions but its seems im not doing it right its easy to (while conditon) if it was outside the class i would have done it like this: [code] $q = "select * from meals"; $r = mysql_query($q) or die (mysql_error()); <table> while($row = mysql_fetch_object($r)) //i used object instead of arrays {     <tr>         <td><? echo $information->FoodName?></td>          </tr> } </table> </html [/code] but i need to display multiple datas using the class: is it: while($information) { echo "$information"; } or foreach($information as $key) { echo "$key"; } im confuse...tnx
  9. while i was waiting for your replies i tried to search the benefits of an oo-programming heres the link [a href=\"http://www.onlamp.com/pub/a/php/2005/07/28/oo_php.html?page=1\" target=\"_blank\"]http://www.onlamp.com/pub/a/php/2005/07/28...php.html?page=1[/a] i hope this would also help others regarding to my question :) @ nogray and thorpe i thank you for your reply :)
  10. whats the diff. from reusing functions for future projects using plain standard functions w/o OOP from reusing functions w/ Object oriented programming?
  11. solved instead of this: c:\some directories\file\tmp it was change to this: c:\\some directories\\file\\tmp :)
  12. hi guys i've seem to have some trouble transfering some of my files here is the code but i know this really works but in my case does'nt... :( heres the simple code that i can't run: [b]If i do this:[/b] [code] <?         $getting_this_file ="C:\mysql\bin\dbases.txt";         $putting_to_this_directory ="C:\dbases.txt";         if (!copy($getting_this_file , $putting_to_this_directory)) {                 print ("failed to copy into directory $getting_this_file...<br>\n"); } ?> [/code] [b]This is the error msg that comes out [/b] Warning: copy(C:\mysql\bin\dbases.txt) [function.copy]: failed to open stream: No such file or directory in C:\some directory\htdocs\phpscript\copy.php on line 4 failed to copy into directory C:\dbases.txt... Then i Added an "@" sign before copy ======> '!@copy': [code] <?         $getting_this_file              ="C:\mysql\bin\dbases.txt";         $putting_to_this_directory ="C:\dbases.txt";         if (!@copy($getting_this_file , $putting_to_this_directory)) {                 print ("failed to copy into directory $getting_this_file...<br>\n"); } ?> [/code] [b]Then This is the error msg comes out which i did when failed of copying a certain file [/b] failed to copy into directory C:\dbases.txt... i'm using php version 5.0.5 and apache 2 under windows environment...im puzzled right now (X_x) thanks
  13. Correct me if i'm wrong...are you trying to use an image button instead of the usual submit button? If thats the case try using CSS :)
  14. [!--quoteo(post=367760:date=Apr 23 2006, 02:39 PM:name=Adri)--][div class=\'quotetop\']QUOTE(Adri @ Apr 23 2006, 02:39 PM) [snapback]367760[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hey, I have a site with a survey. After the first page, this is the script that I run: [code]include 'db_connect.php'; $inleiding = mysql_query("SELECT * FROM inleiding") or die(mysql_error()); $count_inleiding = mysql_num_rows($inleiding) or die(mysql_error()); echo $count_inleiding; $id = $count_inleiding + 1; echo $id; $cookie_data = $id; if (setcookie("enquete", $cookie_data, $time+31536000)==TRUE)     {     if (isset($_COOKIE['enquete']))         {               $cookie_info = explode("-", $_COOKIE['enquete']);               $uid = $cookie_info[0];                      if ((empty($_POST[v01a1]))             && (empty($_POST[v01a2]))) ... ... [/code] It doesn't do anything. echo $count_inleiding doesn't give any result and neither does echo $id; The table is empty. Anybody knows what I'm doing wrong? [/quote] try this... [code] <? include 'db_connect.php'; $query = "SELECT * FROM inleiding"; $result = mysql_query($query) or die (mysql_error()); ?> ----FORM-------------- <form action = "<? echo $_SESSION['PHP_SELF']; ?>" method = "POST"> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=--= -=-=-in this part it will only display one result of a certain row =-=-=-=--=-=-=-=-= <? if(mysql_num_rows($result) > 0) {     while($row = mysql_fetch_object($result))     {          echo $row[0];     } } ?> </form> [/code]
×
×
  • 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.