Jump to content

massive

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by massive

  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]
  15. [!--quoteo(post=365210:date=Apr 15 2006, 09:26 PM:name=mister_t101)--][div class=\'quotetop\']QUOTE(mister_t101 @ Apr 15 2006, 09:26 PM) [snapback]365210[/snapback][/div][div class=\'quotemain\'][!--quotec--] Is there a way to create a shopping cart by just using sessions, not a database? I'm a newbie, and don't want to have to worry about managing a MySQL database at this point. I don't need to for this project, anyway. I have my "shopping list" in an array, and can't figure out how to manage the cart (delete items, etc). If anyone knows of any tutorials, I'd be grateful. [/quote] Hello mister_t101, well i can't give a site for your Session - Based Shopping Cart...but i have a book that has this kind of project a session - based shopping cart...well if you have time to go to your local bookstores heres the title and author of the book you'll get a tutorial there in creating you shopping cart :) "How to Do Everything with PHP & MySQL" written by: Vikram Vaswani Hope this helps
  16. [!--quoteo(post=364697:date=Apr 14 2006, 12:05 AM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Apr 14 2006, 12:05 AM) [snapback]364697[/snapback][/div][div class=\'quotemain\'][!--quotec--] There are some differences, like the newline character being "\n" in the UNIX environment and "\r\n" in Windows. Some functions may also be slightly different -- those are mentioned in the Manual. I do most of my development on a laptop runing WinXP Professional using xampp with PHP 5. The I take the code and run it in either a Linux enviornment or on an OpenVMS machine. All run the Apache webserver, PHP, and MySQL. I've have very little trouble moving scripts from one machine to another. Why do you ask? Ken [/quote] [!--quoteo(post=364943:date=Apr 14 2006, 06:43 PM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Apr 14 2006, 06:43 PM) [snapback]364943[/snapback][/div][div class=\'quotemain\'][!--quotec--] Ken, I do the same as you on my laptop using xampp... If you haven't used linux, don't forget, Capitals matter if you name a file whereas they don't matter in windows... It seems the majority of the differences are when you are working with files and permissions, but I thing graphics may be different, as well... [/quote] [!--quoteo(post=364951:date=Apr 14 2006, 07:29 PM:name=neylitalo)--][div class=\'quotetop\']QUOTE(neylitalo @ Apr 14 2006, 07:29 PM) [snapback]364951[/snapback][/div][div class=\'quotemain\'][!--quotec--] I use Gentoo Linux as my main operating system (only operating system), and after years of writing PHP scripts on a Windows machine, there are really very few differences, most of which are trivial: The new line characters, as kenrbnsn said, are different, however there is really very little practical application for them in Windows or Linux. In Windows, only \n\r officially qualifies as a new line character. However, in my experience, Internet Explorer and Firefox (and maybe others) treat all three forms of new line identically, so there is really no difference. Additionally, the directory delimiters are different - in Windows, directories are separated by a backslash \ [code]C:\Windows\System 32\[/code] whereas in Unix-like operating systems, directories are separated by a forward slash [b]/[/b]. [code]/usr/bin/[/code] And, as AV1611 said, Unix-like systems are case-sensitive. If you save a file as File.php, and try to include() it as file.php, it won't find it - in Windows, that's fine, but not so in *nix systems. There are a few PHP-specific differences, as well - for example, the printing library in PHP does not work in non-Windows operating systems. However, as little as I played with the printing library, the impression I got was that it's not very useful. Also, in non-Windows OS's, you don't have access to PHP's COM library - with good reason. COM is exclusive to Windows. Like the printing library, the COM and .NET libraries in PHP don't seem very useful at the moment. I honestly don't think you'll have a hard time adapting to a Linux environment, especially if you're just using it for an exam. Sure, there are some tips and tricks that may help you in your development, and you're not going to be using your favorite text editor, unless it happens to be an editor also supported in Linux, but they're not necessary for development. [/quote] Thank you guys for your time...i really appreciate your help in giving me what linux is all about with regards to php&mysql programming ^_^...well now at least you three really uplifted my spirit and gain me more confidence in taking the exam Thank you
  17. [!--quoteo(post=364697:date=Apr 14 2006, 12:05 AM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Apr 14 2006, 12:05 AM) [snapback]364697[/snapback][/div][div class=\'quotemain\'][!--quotec--] There are some differences, like the newline character being "\n" in the UNIX environment and "\r\n" in Windows. Some functions may also be slightly different -- those are mentioned in the Manual. I do most of my development on a laptop runing WinXP Professional using xampp with PHP 5. The I take the code and run it in either a Linux enviornment or on an OpenVMS machine. All run the Apache webserver, PHP, and MySQL. I've have very little trouble moving scripts from one machine to another. Why do you ask? Ken [/quote] i see...i thought phpScripting was universal in a sense that it can be done in all kinds of O.S right? but with the exact same coding style...but according to your post you said theres a slite difference....honestly i have a exam this coming monday,,,they say that i'll be programming php&mysql under LINUX environment not WINDOWS environment (X_x) im starting to freak out here...i need to look for references...is the said manual can been seen under the links of DOCUMENTATION? I'm kind of new here according to my number of posts sorry :( have'nt explored the whole site yet. I see your also using xampp with PHP 5 with a nice GUI-interface for MySQL :) Thank you
  18. hello guyz, im puzzled is there any difference with regards to programming PHP&MySQL under WINDOWS environment from LINUX environment? tnx :)
  19. [!--quoteo(post=352445:date=Mar 7 2006, 05:43 AM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 7 2006, 05:43 AM) [snapback]352445[/snapback][/div][div class=\'quotemain\'][!--quotec--] instead of using SELECT *, MAX(Dated) AS most FROM dataz WHERE username = '$username' You could try and use: SELECT TOP 1 * FROM dataz ORDER BY dated DESC that will order the date so latest is at the top and just select that single record.. i think :) [/quote] about the "TOP 1" thing is that the same with "LIMIT 1"?...anyways thanks shocker-z ^__^
  20. [!--quoteo(post=352420:date=Mar 7 2006, 02:37 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Mar 7 2006, 02:37 AM) [snapback]352420[/snapback][/div][div class=\'quotemain\'][!--quotec--] pull them in descending date order [code]$query = "SELECT * FROM dataz WHERE username = '$username' ORDER BY dated DESC LIMIT 1";[/code] [/quote] Thanks Sir Barand ^____^
  21. Hi guyz...its me again heheheh....i was wondering how to view only the recent data by refferring to its date my querying seems to be wrong... For example: a customer paid at the date of 2006-03-02...this is the last time he paid....so when i view his information the most recent date would be or should be view "2006-03-02"...not 2006-03-01...not 2006-02-28....etc... $query = "SELECT * FROM dataz WHERE username = '$username' AND Dated = MAX(Dated) AS most"; "in here i have errors i know my placing of "max(date) as most" is wrong...this comes in handy if i do this" $query = "SELECT *, MAX(Dated) AS most FROM dataz WHERE username = '$username'"; "i was wondering how could i do this in terms of using WHERE....." Algorithm: Select everything from dates where this is the user and the date of the user is the most recent... tnx...^__^
  22. Hi guyz...its me again heheheh....i was wondering how to view only the recent data by refferring to its date my querying seems to be wrong... For example: a customer paid at the date of 2006-03-02...this is the last time he paid....so when i view his information the most recent date would be or should be view "2006-03-02"...not 2006-03-01...not 2006-02-28....etc... $query = "SELECT * FROM dataz WHERE username = '$username' AND Dated = MAX(Dated) AS most"; "in here i have errors i know my placing of "max(date) as most" is wrong...this comes in handy if i do this" $query = "SELECT *, MAX(Dated) AS most FROM dataz WHERE username = '$username'"; "i was wondering how could i do this in terms of using WHERE....." Algorithm: Select everything from dates where this is the user and the date of the user is the most recent... tnx...^__^
  23. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Then I have no idea. [/quote] i see..well thanks for your time ^_^....hmmm i've post my topic also at "PHP HELP" one of the forumers said that i should try changing my method ="POST" into method = "GET"...have'nt tried it yet...
  24. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Try changing your form to [b]method = 'GET' [/b]and make sure your variables are in the address bar correctly. [/quote] oh yeah i have'nt tried that ^_^ and about the address bar the variables are shown fine ^^...but the thing is everytime i press the button it says: "Missing record ID" but my address bar where shown like this for example:(i know you got my point ^_^) somelink.php?id=chicken Step 1 1. source.php <-----where the variables came from Step 2 2. geting.php?id=chicken <------where the variables were transfered and data chickens information was displayed here...yet when i press the button in the geting.php page....click....then "Missing record ID" (T_T) come to think of it the variables where shown in both the address bar and at the status bar im puzzled pls help tnx...
×
×
  • 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.