Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. the error message and line number would help
  2. what exactly does $row['numComments'] print out? is it the same as mysql_num_rows()? Try using group by (I gave a link above) and grouping by the posts.id
  3. The third example is completely wrong, and doesn't make any sense really. you probably want to do something like $locations = array();//create an empty array while(blah blah){ extract($row); $locations[] = array($location_name, $requested_by, $address, $phone_number_1, $phone_number2, $e_mail);//push stuff into array } print_r($locations);//show structure of the array However, the keys won't be preserved. The new array will become numeric (which may or may not be what you want). You could preserve the keys by simply doing $location[] = $row; in the while loop
  4. A list of all server variables: http://www.php.net/manual/en/reserved.variables.server.php have you tried using $_SERVER['SCRIPT_FILENAME'];? check out that manual page and see if one of those will work
  5. no, the Where clause has to go after the select clause. so it should be select blah blah blah where blah blah the count() part is part of the select clause
  6. oh, didn't notice that. yeah you should definitely include your WHERE clause you had before
  7. instead of using $num_rows you would probably want to use $row['numComments']
  8. If there is no prefix, then leaving the prefix parameter blank is correct
  9. Why don't you just use a limit clause? that would make the pagination a lot simpler. And yeah, that logic is slightly off. For example, say I have, in category shirts, 10 items. They have ids as follows 1 3 4 5 6 7 9 10 14 17 Say im at the shirt with id of 4. Well based on your logic, the prev button will produce the shirt with an id of 1 (since 1 < 4, and 1 comes up first because you order by the id).
  10. you can, as you put in your post, send it as $_GET[] data. or you can store it in a session. you can also just retrieve the information in page 2 (IDK why you get the info in page1, but if its just to send it to page2, you might as well just get the info in page2)
  11. to send html emails, the content type header must be set $headers = "blah blah \r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  12. this tutorial explains it pretty well. It logs people out in 10 minutes (rather than 5) but the basic logic is there.
  13. what do you mean by opposite? as in reverse the order? $xCounter = $counter0+=1; $totU = $totUsers0 + 1; $refNum1 = floor($refNum0); $refNum0 = $counter0 / 4; $totUsers0 = $counter0 - 4; $counter = 2; but that doesn't really make sense (and will produce notices) Can you explain a little better what you want? Also explaining what this code does would help too
  14. based on the documentation, and your info, $wgAuth = new AuthPlugin_vBulletin("localhost", "db_etc123", "123", "db_db123", "vb_"); SHOULD work. But the last parameter is what is confusing things I think. That is the prefix. Are you sure vb_ is the prefix? The prefix is basically the string before any of your tables that are connected to the wiki. You should have been able to set that up when you installed mediawiki. If you have phpmyadmin (or another tool like that) look at your wiki tables, and see if they have a common prefix. Whatever that is should be what you pass as the last parameter
  15. You just want a link? well a google search turned up a couple: http://www.phpfreechat.net/ http://www.phpopenchat.org/ list of a bunch: http://php.resourceindex.com/Complete_Scripts/Chat/ I haven't tried any of them though
  16. The first sticky on this page: http://www.phpfreaks.com/forums/index.php/topic,117475.0.html
  17. yeah your second example looks about right. Why don't you try it?
  18. Yeah, num_rows will return all the comments (since your query effectively retrieves all the comments from the table. You probably want to use Mysql's count() function instead of mysql num rows. As lonewolf said, I don't know your DB structure, so it will be somewhat difficult to guess what the changed query would be, but something like $sql = "SELECT posts.id, comments.post_id, count(comments.post_id) as numComments ..... "; you may also want to use group by in your query
  19. you probably want the literal strings, rather than variables $wgAuth = new AuthPlugin_vBulletin('localhost', 'vb_etc123', '123', $wgDBname, "vb_db123"); but I don't know what variables you have in your script, nor what values said variables may contain
  20. is it the same string every time? if so a simple str_replace will do. if not a more complicated preg_replace using regex would probably suffice. a sample of what the extra code looks like would help
  21. alright, in that case, try printing the value of $vi to the screen. Make sure those are what you expect them to be. also print $size to the screen and verify that is what you expect it to be. also try turning error reporting on by adding the following to the top of the page error_reporting(E_ALL); ini_set("display_errors", 1);
  22. alternatively, you can use the mysql Date Format function to format the date inside the query itself
  23. theoretically, yes
  24. The foreach{} construct and while(list(x) = each(y)) construct are exactly the same, so replacing one with the other will do nothing. the logic in that code seems fine. You do realize that filesize() returns returns the size in bytes right? is ~150kb what you expect most images to be under? Check your ftp/where ever the images are stored, and verify that the file sizes are what you think they are. if not, you may have to alter your if statement
  25. you can use the GLOB_BRACE flag to specify that you want to use the brace syntax in the glob pattern. you can use that to specify different extensions. for example $glob = glob("director/*.{pdf,doc,docx}", GLOB_BRACE); check out the manual entry for more information
×
×
  • 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.