Jump to content

DaveyK

Members
  • Posts

    289
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by DaveyK

  1. yes, that makes perfect sense. Thank you!
  2. You guys all make cute couples. Lol. @Jessica, so what you are saying is: just store the position of every box and update them if you need to. I am not using jQuery, this project involves no JS. I thought of that, just wanted to check if that is in fact the best solution
  3. Hey freakers, I am using PDO and php 5. something. Regardless, I am craeting a tile like interface. These tiles are fetched from the database, but I need to define the order in which theyre displayed. So this is both a PHP/database question. Say I have 4 tiles, tile 1 till tile 4 and I wish to order them 3, 1, 4, 2. What tips do you guys have ? I can imagine a static order but thats not really ideal is it. I could set each tile to have a static position, so first second third and so forth, but I would really love to calculate this on the go since the design is fluid. I have no idea where to start on this :/ Do any of you guys know a solution to this? Share some wisdom!
  4. Why dont you address the issue at the source rather than adding more redundant code?
  5. and you expect anyone to know what you need?
  6. You could run through the array with a loop and then stop if you find the name you need, like so: foreach($places as $place) { if ($place['name'] == $_GET['city']) { $info = $place; } } Another way to do this is, is to create a seperate array which would be an index for the places. $index_array = array(); foreach ($places as $k => $place) { $index_array[$place['name']] = $k; } // $index_array = array(cabot_cove => 0, smallville = 1, gotham city = 2, etch) if (array_key_exists($_GET['city'], $index_array)) { $info = $places[$index_array]; }
  7. DaveyK

    ajax

    Can you verify that the ajax is actually sending to the correct file? Any errors in the console?
  8. In addition, show relevant code in code blocks rather than posting the file, please! Code tags are identified by the "<>" icon when adding a post!
  9. This will only trigger if the time is exactly sunday at 00:00:00, which is pretty specific. Why do you do this anyway?
  10. First things first. You are trying to tackle two issues at the same time, which is great if you are up for it. Focus on one of the problems and leave the other one. I would say you focus on the first script first. The update script. First of all, I recommend you use firefox. If you do, install firebug add on. This allows you do inspect element, change the html live and above all: monitor ajax calls (and a lot more). If you use chrome, this is available without add on but I prefer firebug anyway. Comment out the js for the second script and focus on the first. What you are going to want to do is right click and then inspect element with firebug, then click console on the top left. You should see a list of the ajax calls. if the timeout is working you should see one every second. If its not working, your console will be empty and the issue lies with the js. Keep me posted.
  11. perhaps: $stmt = $mysqli->prepare("DELETE FROM races WHERE name = ? "); if ($stmt->execute(array($horse))); { echo "You have deleted " . $horse; }
  12. You are checking if the statement is being prepared or not. Just because it is prepared correctly, doesnt mean its executed correxctly. You need to check the execute of the statement.
  13. Are you for real? You want something done, hire someone. We are not here to do your stuff. Put your code in code blocks, show RELEVANT code only and ask us what you need to move forward and we will help you get there. You will find that people are MUCH more willing to help you out if you show your own effort and what you have tried so far. With that attitude, no one is going to try and help you.
  14. Set a static variable inside the query itself ( SELECT 'users' as 'table' FROM users ) UNION ALL ( SELECT 'messages' as 'table' FROM messages )
  15. Delete the sessions when you are done using them? I dont really understand why you are using sessions in this form... You check if the $_POST is not empty ( You couldve used if(!empty($_POST[$var]) herre as well, but okay) and if it isnt empty, you set it to a session and you then check the session and return either echo the session of the post variable (which will always have the same value?!). Why are you using sessions for this? Also, its good practise to make the function return something, rather than echoing it.
  16. Please put your code in code blocks, identified by the "<>" in the top menu when writing a post.
  17. RewriteEngine on RewriteCond %{HTTP_HOST} =example.co.uk [OR] RewriteCond %{HTTP_HOST} =www.example.co.uk RewriteCond %{REQUEST_URI} !^/?$ [NC] RewriteRule ^ http://example.co.uk?$1 [R=301,L] Try that. I am really just guessing but I use $1 in my htaccess.
  18. Lol that was rather badly written by me. What else to store in a database than data. Regardless, I am assuming this is not the case and even if it is, less probably has a much cleaner solution.
  19. Why would you store variables in a database. less can use different files, with a single file to import all of them to a single .css file. For one, I have this styles.less // this is the file that has the styles .h2{ color: @red; &.big{ width: @full_width; } } variables.less // this holds the variables @dark_red : #a30f0f; @red: #ff0000; @full_width: 980px; bootstrap.less // this combines both using @import "variables.less" and @import "styles.less" // Core variables and mixins @import "variables.less"; @import "styles.less"; With simpless or winless, if you compile that bootstrap.less file you will get a bootstrap.css file looking like this: bootstrap.css h2{ color: #ff0000; } h2.big{ width: 980px; } also, if one fetches styles from the database on load I would love to see the loading times. Less can be compiled on either the server (using JS) or on your machine, in which case you just upload the CSS. The time difference is little to none, tho for peace of mind I always use the latter.
  20. I think what he is trying to do is output a .css file from a .php file, which is redundant when you use Less.
  21. Use Less, it was DESIGNED with this in mind. http://lesscss.org/ it works like this: @white: #fff; .div{ background-color: @white; } What else do you want?!
  22. Ajax is nothing but Javascript and PHP combined. What you want to do is something like function test () { console.log('test'); } setInterval('test', 1000); Then, if you check your console in, say, firebug (if you use firefox) or in the chrome console you should see that its being logged every second. and see if that works
  23. <IfModule mod_rewrite.c> Options +FollowSymlinks -MultiViews RewriteEngine On </IfModule> RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] This doesnt work? For me, using XAMPP, this enables: localhost/index localhost/user Where index.php and user.php are files in my folder.
  24. maybe this will help you understand the structure a little better <?php $results = $db->select("mytable"); echo '<pre>' . print_r($results, true) . '<pre>' ; ?> Its really straightforward.
×
×
  • 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.