Jump to content

wwfc_barmy_army

Members
  • Posts

    320
  • Joined

  • Last visited

    Never

Everything posted by wwfc_barmy_army

  1. Thats what I thought but if I don't use the global part then when trying to call the returned variable on the page that I called the fuction on i get this error: Notice: Undefined variable: sectname in... Any ideas about that? Think I have sorted the SQl problem.
  2. Hello. I have this function: <?php function getsectfromid($sect){ $sql="SELECT sect_name FROM sect WHERE sect_id = $sect"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_query($result); global $sectname; $sectname = $row['sect_name']; return $sectname; } ?> Although I am getting the error: Unknown column '$sect' in 'where clause' I cant figure out what it's saying $sect is an unknown column as i've specified the column as 'sect' not '$sect'. Any ideas? Thanks.
  3. Hello. I have this rewrite code: Options +FollowSymLinks RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^([0-9]+)$ index.php?id=$1 [QSA,L] RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)$ index.php?id=$1&width=$2&height=$3 [L,QSA] It works if i go to say: mydomain.com/1 but not if i go to: mydomain.com/1/ To take care of the following slash can i just do this: Options +FollowSymLinks RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^([0-9]+)$ index.php?id=$1 [QSA,L] RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)$ index.php?id=$1&width=$2&height=$3 [L,QSA] RewriteRule ^([0-9]+)/$ index.php?id=$1 [QSA,L] RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/$ index.php?id=$1&width=$2&height=$3 [L,QSA] Would that work or cause errors? Thanks.
  4. Thanks. I'll have a play with it now. It's close but having a few problems but i think the rewrite is ok.
  5. Hello, I have this rule at the moment: Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$ index.php?id=$1 [QSA] RewriteRule ^(.*)/(.*)/(.*)$ index.php?id=$1&width=$2&height=$3 [L,QSA] This is what happens with the following: mydomain.com/1/200/300 - Doest exactly what I want mydomain.com/1/ - Goes off it some wild loop of kind of a mixture of both Any ideas how i can get around this? I want 2 different rules depending on the url. Thanks for any help.
  6. Yes. Phpbb should run fine. Ensure you read up on it first to avoid problems. Enjoy.
  7. Not sure what you mean by "connect phpbb with php page then how bout the database?". Please elaborate. I've had phpbb running on XAMPP in the past before. Should run without any problems.
  8. Hi. I have an array of a few numbers eg. 80 100 120 160 If a number is used such as 85 I need to it find 100, so the next highest number. Any ideas how i could go about this? Any ideas? thanks guys.
  9. Hi. I have this htaccess rewrite: Options +FollowSymLinks RewriteEngine on RewriteRule ^([0-9]+)/([0-9]+)$ index.php?width=$1&height=$2 I keep getting a 500 error tho. I'm looking to do this kind of rewrite: mydomain.com/index.php?width=100&height=200 to mydomain.com/100/200 Any ideas? Thanks.
  10. Unfortunatly not, the table has duplicates of user_id, but i used the same concept and tried: SELECT * FROM table WHERE id= " . $user_id . " ORDER BY date DESC LIMIT 1 I have a date column, but my next question is will it work properly? It does in the test account I have but does it actually see it as a date or just a big number? Thanks for any advice.
  11. Is there an easy way/SQL comment to get the last entered record from a table with a certain userID? Thanks for any advice.
  12. Ahhh, spotted it: echo '' . $set_limit . ''; was coming after the correct number as there was no line space inbetween. Thanks anyways guys, knew it was something stupid lol. ::edit:: I tend to tidy up my code after i get it working (bad habit lol)
  13. The output from the total records is coming out a lot more than it should be. Was 80 (first page of paginiation) and 85 (second page), but now i've added 1 more record it's gone up to 90 (first page) and 95 (second Page). Should be 8 and 9. Any ideas?
  14. But i need that code there to be able to get the total number of records at the top of the page.
  15. Here we go: <?php $result2 = mysql_query("SELECT * FROM inputs WHERE user_id = " . $userid); if(!$result2){ die("Error quering the Database: " . mysql_error());} $total_items = mysql_num_rows($result2); echo "Total Number of records in Database: " . $total_items; $limit= $_GET['limit']; $page= $_GET['page']; //Set default if: $limit is empty, non numerical, //less than 10, greater than 50 if((!$limit) || (is_numeric($limit) == false) || ($limit < 10) || ($limit > 50)) { $limit = 5; //default } //Set default if: $page is empty, non numerical, //less than zero, greater than total available if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) { $page = 1; //default } //calcuate total pages $total_pages = ceil($total_items / $limit); $set_limit = ($page * $limit) - $limit; echo '' . $set_limit . ''; ?> <table width="80%" border="1" class="sortable"> <thead> //////// ////////.. Table Headers ... //////// </thead> <?php $sql = "SELECT * FROM inputs WHERE user_id = " . $userid . " LIMIT " . $set_limit . ", " . $limit; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ // //...Some outputs...// ?> <tr> //...Some outputs...// </tr> <?php } echo "</table>"; //prev. page: $prev_page = $page - 1; if($prev_page >= 1) { echo("<a href='?limit=$limit&page=$prev_page'><< Prev</a>"); } //Display middle pages: for($a = 1; $a <= $total_pages; $a++) { if($a == $page) { echo(" $a | "); //no link } else { echo(" <a href='?limit=$limit&page=$a'>$a</a> | "); } } //next page: $next_page = $page + 1; if($next_page <= $total_pages) { echo("<a href='?limit=$limit&page=$next_page'> Next > > </a>"); } ?>
  16. Hello. I have this piece of code: $result2 = mysql_query("SELECT id FROM mytable WHERE user_id = " . $userid); if(!$result2){ die("Error quering the Database: " . mysql_error());} $total_items = mysql_num_rows($result2); echo "Total Number of records in Database: " . $total_items; It works, but is producing a much larger value than the database is. The value from the code above is showing 80 on page 1 and 85 on page 2. (should be exactly the same) and the table only shows 5 on page 1 and 3 on page 2. They are using virtually the same sql (the table using a wildcard to get all records) Can anyone see what I'm doing wrong? I used a tutorial similar to this to create pagination if that helps: http://mtbud420.com/?p=76 Thanks.
  17. I've just tried a blank .htaccess in the subdirectory and it didnt' work.
  18. Hello. I have this code: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^([^/]+)?/?$ index.php?do=$1 [L,QSA] Which works fine for what i need it for eg: www.mydomain.com/google.com but if i want to show a subdirectory they it messes it up eg mydomain.com/subdirectory/ UNLESS i use eg mydomain.com/subdirectory/index.php. Any ideas how i can allow subdirectories? Thanks.
  19. Hello. I have a database with two tables, car makes and car models. The car makes is setup like this: make_id | make_name 1 ford etc etc car models is setup like this: model_id | make_id | model_name 1 1 mustang etc etc I've got a dropdown box with all the makes in, but when a make is chosen i need it to activate another text box and display the models for that make_id. Any suggestions on how i might do this? thanks.
×
×
  • 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.