Jump to content

theverychap

Staff Alumni
  • Posts

    78
  • Joined

  • Last visited

Everything posted by theverychap

  1. I specifically added array and object ways, i didn't know what was in $result. Anyhow, after re-reading the question: "This way one variable holds two values - username and id. How can i assign those values to two different variables?" It would be helpful to see what is returned into $result. Maybe look at list if you want to assign values to different variables.
  2. If i understand correctly, you want the ball to resize too? http://jsfiddle.net/BG8F9/ I added a percentage width to the ball, it will scale with any resizing.
  3. Does pricedata.VechicleName (int) contain vehicles.TableID? if so, something like SELECT pd.yourfields FROM pricedata pd LEFT JOIN vehicles v ON pd.VechicleName = v.TableID WHERE yourwhereclause... may get you on the right track.
  4. I had to create rewrite rules involving hashes recently, i made notes here: http://tizardsbriefcase.com/625/apache/apache-rewriterule-rewrite-url-to-hash
  5. Your foreach is wrong. <?php $query_members = "SELECT username, id FROM members LIMIT 10"; $result = $db->run($query_members); // if $result comes back as an array... foreach ($result as $user) { echo 'username: ' .$user['name'] .'<br/>'; echo 'id: ' .$user['id'] .'<br/>'; } // ...or as an object foreach ($result as $user) { echo 'username: ' .$user->name .'<br/>'; echo 'id: ' .$user->id .'<br/>'; } ?> Hope that helps.
  6. How are you currently getting classes that are inactive / active - is it just a switch (on|off, 0|1 etc?). You'll need to added a "publish_date" or "activate_date" column to the table your store your data in. (Or create a table and join the two together). When creating a class, add in the publish_date to each entry. Then when pulling data from the database, make sure that the publish_date is > NOW(). Hopefully a good starting point, it's more simple than you may first imagine.
  7. Indeed, its valid, but older browser compatibility might be a slight issue you'll need to offer alternatives / workarounds.
  8. is the JS in your PHP page? or is it in a seperate JS file? If it's in your PHP page, you could of course use: $("#autoRefreshBattingDisplay").load('borders/right.php?gameNo=<?php echo $var; ?>');
  9. Maybe take a look at tableDnD - a jQuery plugin - does exactly what you are after! And very easy to use too
  10. Seeing as you are using eregi - you do not need to test for lowercase AND uppercase - the i in eregi is case insensetive, and so will pick up all cases... However, eregi is depreceated, so maybe you should use preg_match, or even stristr would do: if ( stristr($_SERVER['HTTP_USER_AGENT'], 'safari') ) { header('location: http://...'); exit; }
  11. Change: The reason you are getting "Please enter some text" is: You have two elements in your code with the ID of "content". So your javascript is trying to get the val() of the DIV, not the TEXTAREA. --- To stop the page flying to the top when people press "like": <a href="#" class="like" id="<?php echo $clip_id; ?>" name="down"> to: <a href="javascript:void(0);return false;" class="like" id="<?php echo $clip_id; ?>" name="down"> Hope thats helped
  12. You should test for the $_GET'ed ID and also a $_POST['Save'], if bothg of these exist, you know which textarea to "hide" - maybe a style="display:none;" or something?
  13. Set the datatype of the table colum to BLOB - you will then be able to store whatever you like Also, CKEditor is a fantastic editor!
  14. I can't see the problem (or do not fully understand it?) - I pasted your code into a file and loaded it using my browsers (Opera, Safari, Firefox & Chrome on the Mac) and could scroll as i assume is expected, with a static header and footer at the top and bottom...
  15. Is this anywhere near? SELECT * FROM Table1 WHERE job1 IN (SELECT job1 FROM Table2) OR job2 IN (SELECT job2 FROM Table2)
  16. If you don't have too much data yet, it would be best to restructure your database to store it in a more friendly way - this will aid the retreival of data no end! Otherwise you are into crazy uneccessary regex territory: ipreg_match_all ("/".(\\[) .'.*?' .(,) ."/is", $yourCrazyString, $m)) echo '<pre>'; print_r($m); echo '</pre>';
  17. If this code is literally how you have it in your script: mysql_query($sql); $id = "ID"; $sql = "UPDATE comments SET LikeTotal = LikeTotal + 1 WHERE $id = 1"; mysql_close() Then it's never going to work! You'll want to declare the query before executing it: $sql = "UPDATE comments SET LikeTotal = LikeTotal + 1 WHERE ID = 1"; mysql_query($sql);
  18. As soon as the page loads, insert a new record and return the insert id (mysql_insert_id()) or lookup the next available id (mysql_insert_id()). You could then store this id in a session variable to pass from page to page (popping it into a hidden input field if you need to). PDid i understand your question correctly?
  19. You would be a lot quicker using: file_get_contents() to echo the contents of $file: echo file_get_contents($file);
  20. To get the ID too, you may have a slight restructure ahead: Instead of this: while ($row = mysql_fetch_array($result)) { $images[] = "http://URL.org/books/images/{$row['image1']}"; } Do this: while ($row = mysql_fetch_array($result)) { $images[$row['id']] = 'http://URL.org/books/images/' .$row['image1']; } This will require your Javascript function: function mycarousel_getItemHTML(url) to be passed an array (id, url) instead of the single argument (url)... Does that get you on the right track..?
  21. I take it you are not referring to a regular Javascript Alert() pop-up dialog box? (if you are then <span onclick="alert('some text');">click me</span> would do that.) If you want a nicely formatted help tip, it would be best to learn exactly what you are doing, i.e appending elements to the dosument etc. OR you could just pickup jQuery and use one of the many great built in features and/or one of the plugins available...
  22. I'm sure i read somewhere that where comparing like: if ( $var === TRUE ) It's quicker for php to process: if ( TRUE === $var ) An even faster way would be: if ( !$var == TRUE ) And EVEN faster: if ( !empty($var) )
  23. Sorry, i read your code too quickly. You would be better off getting your results from the mysql table beforehand: $array = mysql_fetch_array($result); then instead of the while loop, use a foreach forreach ($array as $row) { ...do you row stuff... }
  24. I agree, stick with what you know best. After all, the main areas you'll be playing with will be the Apache installation (and PHP, mySQL etc) and they are pretty much the same across the board out of the box.
×
×
  • 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.