Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. date Use that on your output to contol what is displayed: while ($row = odbc_fetch_array($TrackerData)) { print("<br />" . date('Y-m-d', $row['TheDate'])); } Should print it out without the extra stuff.
  2. Maybe, if you show us some code in the includes section and what the error message is. EDIT: HEADER ERRORS - READ HERE BEFORE POSTING THEM Also take a look at the post.
  3. Yea I just did my testing and found that out =) And I guess I never looked for a function like end good to know =P
  4. Don't just pull last 3 chars, extension could be 1, 2 or 4+ chars. explode works, just do some error checking to make sure that there is a '.' or else you will just end up returning the filename. pathinfo works, but I think it suffers from the same problem as the explode method if the file has no extension. $path_parts = pathinfo('file.ext.ext.php'); $ext = isset($path_parts['extension'])?$path_parts['extension']:''; For explode: $ext = explode(".", "file.ext.ext.php"); $ext = (count($ext)>1)?$ext[count($ext)-1]:''; That would avoid any errors of no path being passed I would believe.
  5. Why not just pull the last 3 characters? $ext = substr("file.ext.ext.php", -3); Or, why not explode or split at the period and pull the last element of the array: $ext = explode(".", "file.ext.ext.php"); $ext = $ext[count($ext)-1]; Or pathinfo $path_parts = pathinfo('file.ext.ext.php'); $ext = $path_parts['extension'];
  6. An idea I just thought of. How many includes do you have that just include a function? Why not put all these functions into one include and just include that one file each time? If the include does nothing more than include a function, I would just combine those files and included a "main.functions.php" As long as it is not something insane like 50 includes, this should be just peachy.
  7. Which is why, when you echo out a piece of code for debugging/testing you should put in an identifier before it such as: echo "SysDate: " . $_POST['SysDate']; What way you know what variable is being printed out and if the right one etc is printing. However I would suggest you re-think putting the date in the form, and read the suggestions above and the warnings, such as data manipulation etc. Either way good luck!
  8. You probably want to dynamically create the where clause. if (isset($_POST['pricerange']) && $_POST['pricerange'] != "0:10000") { list($min,$max) = explode(':',$_POST['pricerange'],2); $whereClause[] = " price BETWEEN '$min' AND '$max' "; } if (isset($_POST['stay'])) { list($minstay,$maxstay) = explode(':',$_POST['stay'],2); $whereClause[] = " duration BETWEEN '$minstay' AND '$maxstay' "; } if (isset($_POST['desination'])) { $whereClause[] = " destination LIKE '%$where%' "; } $whereClause = implode (" OR ", $whereClause); $result = mysql_query("SELECT departureDate, expireDate, airport, destination, resort, hotel, duration, board, price, description, customerRef, mystiqueRef, stars FROM holiday WHERE $whereClause"); That way it only uses the values that have a value. Not sure if that is what you are looking for though, but yea.
  9. See that. And if the date is stored in the database, why do you need to pass it to the form, using UPDATE syntax that date should never change...the reason we are asking is because it seems your logic is somewhat flawed and you are busting your head over something that is null and void. Also are you using any JavaScript on that page?
  10. You can store the history in sessions then use the header tag when the user presses the back button, but this would have to postback to the server, so an extra step. But yes it is possible sortof. The first view of the page PHP will not be able to send back unless you use $_SERVER['HTTP_REFERER'], which can be invalid data. EDIT: Yea I probably meant that.
  11. In your INSERT query use the NOW() keyword in MySQL, to learn more about it google MySQL NOW().
  12. Did you see that question? Why do you need to pass the sys date to it? Since it is the just date with no time/seconds it will be the same on page load...no need to pass it, just call the date function where you were grabbing the post data.
  13. Are you sure you have data for all 3 conditionals? If you do not have data that match all 3 you will not get anything returned. If you want to match any price, you keyed it in your last sentence on your first post "or" $result = mysql_query("SELECT departureDate, expireDate, airport, destination, resort, hotel, duration, board, price, description, customerRef, mystiqueRef, stars FROM holiday WHERE duration BETWEEN '$minstay' AND '$maxstay' OR price BETWEEN '$min' AND '$max' OR destination LIKE '%$where%'"); That query uses the "OR" keyword instead of the "AND" which should pull results if ANY of those conditions are true.
  14. No, you have to change this line: echo str_repeat("_", $charDisp) . $org['firstname'] . "<br />"; To echo out the code you want it to display as. The str_repeat is for the indentation, you can change that value if you want to, then you can surround that in whatever html/css code you want to. You will probably have to play around with it doing trial and error until you get it how you want.
  15. Your including the file twice, of course you will get that error. If you are going to include a file twice (which I have no clue why you would) then you would need to do this: <?php if (!function_exists("testFunction")) { function testFunction() { echo "This is a function"; } } ?> And that should stop the error. Oh and also, the return; value in the include, I do not think that works. So I would just remove that part altogether. But yea, you really should only include it once, there is no reason to have it included multiple times.
  16. $db->sql_query("UPDATE models SET modrating=count+1 WHERE modid = '$modid'"); I do not think mysql has a default field of "count". Is there a field in that table called "count"? Or is modrating the "counting" field. If modrating is the counting field you need to change your query: $db->sql_query("UPDATE models SET modrating=`modrating`+1 WHERE modid = '$modid'"); I am not sure how the sql query function works, so I would assume that it should report an error, if not try this to get the error: $db->sql_query("UPDATE models SET modrating=`modrating`+1 WHERE modid = '$modid'") or die(mysql_error()); Also a blank screen would indicate that you are not getting any results out of the DB, are you sure that you have a valid modid in the database that you are passing through? Or are you checking it to see if the user already voted on that model, if so you would want to do it this way: $result = $db->sql_query("SELECT * FROM models WHERE modid = '$modid'"); if (mysql_num_rows($result) > 0) { echo 'You have already voted'; }else { $db->sql_query("UPDATE models SET modrating=`modrating`+1 WHERE modid = '$modid'"); echo 'Your vote has been placed, thank you.'; } But I also do not understand why you are updating and not inserting. I dunno, your logic seems goofy and flawed. Please explain exactly what this function is suppose to do/react. Since I do not know your structures I am just guessing blindly.
  17. Just got the following error. Yea, I forgot to change all instances of it, sorry. Like I said it used to be a category script =) Thanks DarkSuperHero for correcting it.
  18. Almost buddy, keep the single equals but change mysql_query to mysql_fetch_assoc... $res = mysql_query($query); while($result = mysql_fetch_assoc($res)) { Should correct that issue. EDIT: Looking at your code, you define $result earlier on, so you probably do not need the extra mysql_query, but change that reference to be $res instead, so you do not have to change all instances of $result to be $row
  19. I would change that php file into a heredoc version, then just call $message, here is an example: <?php $message = <<<MESSAGE <html> <head> <title>INFORMATION</title> </head> <body> <p >Hello {$_SESSION['firstname']} {$_SESSION['lastname']},</p> ... MESSAGE; ?> Then the mail example would be: include("lang/email.eng.php"); mail($to, $subject, $message, $headers);
  20. Basically, I was going to use drag and drop for organizing friends. Like a top friends section. If that makes since.... So it has to be able to help put information into a database. How good are you at Javascript and PHP? Really this should be pretty simple, you can either use AJAX to save the data when moved, or make a "Save" button and when clicked it saves the new organization. I know that this code: http://www.webreference.com/programming/javascript/mk/column2/ Would probably be more of the javascript code you are looking for. You just have to figure out how to post the new order to PHP. It really should not be too bad, but you may need to brush up on your javascript, but basically when the "save" button is pushed you send the current order to the php script. That or anytime a friend is changed you can use AJAX to update the DB automatically. EDIT:: And really http://www.google.com/search?hl=en&q=drag+and+drop+lists+php+javascript&btnG=Google+Search&aq=f&oq= There are plenty of scripts doing this...
  21. If there is no PHP in the text file, just text then use this instead: mail($to, $subject, file_get_contents("lang/email.eng.php"), $headers); file_get_contents
  22. Ah, server admins must have also enabled this due to that fact too, I know my server runs php 4.3, but has that enabled. So yea, whoops.
  23. It is straight javascript with PHP. What do you expect to do with this script? http://www.walterzorn.com/dragdrop/commands_e.htm That is a great script to use for Dragging and dropping.
  24. No the forum admins do not believe in karma, if you really want to thank me, donate some money to this site, nothing major like $1-$5 is helpful. (If you can). With that code above, you will have to modify Display Orgs to change the output to be how you want it, this was originally a category script I created so yea, it will go through as many employees/supervisors as there are in the DB since it is recursive. Should work great.
  25. I fail to see where you use "left" and "right" in that code...? And are you still getting the extra slash?
×
×
  • 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.