Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. Ok...do that. Which part do you not know how to do? If you don't know any PHP, you'll need a "learn php" book. I personally recommend "Web Database Applications with PHP & MySQL" from O'Reilly press. -Dan
  2. There is no scrolling code in that page you provided. The function anythingslider appears to be the culprit, but since I don't have IE and I don't feel like digging through wordpress javascript, that's as far as I'm going to go. The two most common ways to scroll the page on click are the scrollTo method or an anchor tag containing a "#" in it. -Dan
  3. I've merged the three threads on this topic into one, and left it in the JS forum. -Dan
  4. You didn't say you already had a loop that was generating these arrays. $newArray = array(); while($row = mysql_fetch_array($run_mysql_query)){; //this is wrong, no semicolon here. $models = $row['text_value']; $attribute1 = $row['attribute1']; $attribute2 = $row['attribute2']; $array = explode(',', $models); $newArray = array_merge($newArray, $array); foreach($array as &$value) { $value = $row['varchar_value'] . " - " . $value . " - " . $attribute1 . " - " . $attribute2; } } print_r($newArray);
  5. ...and this is why we recommend not storing HTML in a database. You run into this very problem. What you might want to do is: strip the HTML find the 49th and 50th word. use a regular expression to trim the original article down to the content up to those two words (which may be separated by one or more HTML tags) Print the resulting string, with any weird tags removed. -Dan
  6. $newArray = array(); foreach ( $array as $val ) { $newArray = array_merge($newArray, $val); } print_r($newArray); -Dan
  7. AJAX is supported by all major browsers, especially if you download an ajax toolkit which is maintained by a separate party. -Dan
  8. Sanjib's suggestion makes sense until he starts talking about CSS files. CSS has nothing to do with this. PHP Includes are the way to go for this. Make your header.php that prints out the titlebar, navigation, etc. Make your footer.php that prints out the footer, copyright, and any necessary footer code like tracking pixels or whatever. Then, every page on your site looks like this: <?php include("header.php"); //page contents include("footer.php"); If you require a database connection, make it in header.php. If you have functions that are required on every page, require them in header.php, etc. Header and footer can also be page-aware. The various $_SERVER variables like the request string and the page name are set by the user's REQUEST. If they visit your "aboutUs.php", then the request URI will be "aboutUs.php" even inside header.php, so you can highlight the page they're on in the navigation menu and everything. -Dan
  9. What do you mean "it follows the code above"? Do you mean that it executes code that you put on the page? Debug this yourself. Echo the value of $giveto. Echo your query. Don't just stare at the code and say "why isn't this working" out loud. -Dan
  10. 1) Use the DATETIME datatype, which stores the timezone if you provide one. 2) If you're running PHP5.3+ you can use the DateTime object (not to be confused with the DATETIME mysql datatype) to compare dates. -Dan
  11. You're just switching the item with the item above or below it. Example: Moving item 1 (pageOrder 2) down to pageOrder 3. UPDATE table SET pageOrder = 2 WHERE pageOrder = 3; UPDATE table SET pageOrder = 3 WHERE id = 1; -Dan
  12. What they're trying to say here is: You haven't done anything OOP. You've changed $html into $class->html. All that's done is add memory and processor overhead. Yes, technically, you've used a class, but you haven't done anything particularly handy with it. Classes are designed to be tools that hold their own data and functionality. The general idea is that you can take a class from one project, copy the class file into another project, and use the class in the second project exactly like it was used in the first. Classes are modular and designed to be self-contained. Classes are also very mutable, they change often and rely on inputs to their constructors and functions. Not to take you off this forum, but I wrote three good posts about OOP in PHP5 a few years back. Not much has changed in PHP since then because PHP6 was pushed back. -Dan
  13. This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=325948.0
  14. Also, this question is database only. Perform all these queries inside your database software (substituting for $id, obviously) until you get a query that functions the way you expect it to, THEN insert it into your PHP script. For all we know, something inside your loop (which you haven't shown us) is ruining your output. -Dan
  15. This is correct, the existence of the poorly named "id" and "sid" fields (as well as filtering by "id" on both queries) got me confused. The proper query, based on your first code, is: SELECT b1.* FROM block b1 JOIN block b2 ON b1.sid = b2.id WHERE b2.sid = {$id} ORDER BY b1.`id` DESC This is still confusing, and is only a guess based on the queries you pasted. -Dan
  16. Then do that. We're not going to write your code line by line. If you don't know how to output the results of a mysql query, you can: 1) Copy and paste the example from the PHP manual page for mysql_query 2) Hire someone to do it. 3) Stop this project, learn php, then come back when you know how. -Dan
  17. Use a JOIN query instead of nested loops. SELECT b1.* FROM block b1 JOIN block b2 ON b1.sid = b2.sid WHERE b2.sid = {$id} ORDER BY b1.`id` DESC -Dan
  18. What do you need other than what you've already said? SELECT userId, MAX(field_you_order_records_by), some, other, fields FROM theTable GROUP BY userId Display that, with a link to a page that will: "SELECT * FROM theTable where userId = " . mysql_real_escape_string( $_GET['userId'] ) -Dan
  19. It would be best if you added timing code to the application, so that you could narrow down the problem to a few dozen lines of PHP or a single database query, then post just that small snippet to the board. Not many people are going to be willing to eyeball your code to look for potential slow spots.
  20. Print the actual query, none of this "col2" and "tablename" stuff. Obviously your fake pseudo-query would work fine. Do a SHOW CREATE TABLE on the table, post that here. Do an INSERT on the table, post that here as well as the error. -Dan
  21. $rs = mysql_query("SELECT key, value FROM table1"); while ( $row = mysql_fetch_array( $rs ) ) { $array[$row['key']] = $row['value']; } Setting up the table and cleaning up this code is left up to the reader. -Dan
  22. That should do it, yes, but there's some place where a call like this already exists. You can simply call this function again like this, or find the right place to add this code and do it there. Not that this solution is wrong, it's perfectly acceptable, but one day you're going to be wondering why the word "cable" still links to google even after you find and remove the large block of linking code. -Dan
  23. This topic has been moved to Website Critique. http://www.phpfreaks.com/forums/index.php?topic=325213.0
  24. I stand corrected. A semicolon is unnecessary in this syntax: <?php echo "hello" ?> World! <?php echo " and now goodbye" ?>
  25. cURL has nothing to do with this conversation at all. cURL is a server-side function in PHP. It does not run on the client, and will not help you obfuscate HTML form elements. What are you actually trying to do?
×
×
  • 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.