Jump to content

wwfc_barmy_army

Members
  • Posts

    320
  • Joined

  • Last visited

    Never

Everything posted by wwfc_barmy_army

  1. Hello. I have this htaccess file: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} !\.(exe|jpg|jpeg|png)$ RewriteRule ^([^/]*)$ page.php?slug=$1 [L] I accessed localhost/test/test-here...it works ok, but the slug variable is outputting 'page.php'. So I tried this: RewriteRule ^help/([^/]*)$ page.php?slug=$1 [L] I accessed localhost/test/help/test-here... and it worked and the slug variable was 'test-here'. The htaccess is in the root of the 'test' folder. Any ideas? Thanks.
  2. Thanks for your reply! The .htaccess is in the root dir yes. When I visit the mentioned pages and then check the logs there is nothing (even for my IP), but there are sometimes 10+ of the same 'missing page' for the same IP at exactly the same time. But these pages work fine for me and have done on every machine i've ever tested on! I've visited all pages with firebug running and I received no errors and the odd ajax post. Seems really strange to me, but errors keep appearing in the logs. Any other ideas?
  3. Hopefully this is the right section to post this in. I've been checking through our error logs and I've noticed quite a few like this: [Thu Jul 07 09:36:01 2011] [error] [client ip_here] File does not exist: /home/username/public_html/company-search Now we have a htaccess mod-rewrite on and this part is: RewriteRule ^company-search$ companylist.php RewriteRule ^company-search/$ companylist.php It works fine, and when I go to mydomain.com/company-search it works fine. But this would indicate to me that it isn't working for some people. At it seems to be doing the same on other pages that are similar. Any ideas?
  4. How do I return more than 1 value back from the query if I only wanted to select a distinct product_id? Thanks.
  5. Hello, $sql = "SELECT DISTINCT products.product_id, category_matchup.match_cat_id, products.product_name FROM category_matchup INNER JOIN products ON category_matchup.product_id = products.product_id WHERE match_cat_id IN (1870,1871,1872,1875,1880,1881,1882,1883,1884)"; $result = mysql_query($sql, $connex) or die(mysql_error()); if(mysql_num_rows($result)!=0){ $i = 0; while($row = mysql_fetch_array($result)) { .................. Output etc.................. It works, but despite the distint still being in there it is returning multiple records. I have 2 tables for this Product table and a match up table as 1 product can be in many categories. So an example of the matchup table could be: match_id product_id cat_id 1 12 532 2 12 535 3 12 356 4 12 36 5 12 3436 6 13 3436 7 15 3436 For example if I looked for products in category 3436 AND 36 it will return product ID 12 twice (based on the above example). Can anyone shed any light on this? Thanks.
  6. Hello, I just thought i'd check but i can't seem to find any information anywhere, Can you replace a query like this: SELECT * FROM tablename WHERE name = "name" OR name = "name2" OR name = "name3" with something like; SELECT * FROM tablename WHERE name = "name", "name2", "name3" or some shorthand way of having multiple where conditions on the same column? Thanks.
  7. I think is issue is thats it's trying to use the temp file twice. After the first use does the temp image file get removed? I've put in another upload box for the same image and it works, but ideally I want to do it from 1 upload box.
  8. You are breaking the echo at <a href="?. Try the following: else { echo "<p align='center'> <a href='?file=../example1.html'>Example1</a><br/> <a href='?file=../example2.html'>Example2</a><br/> <br/> <em>Click on the links above to edit the files.</em><br/> <a href='?index.php'>logout</a></p>"; }
  9. Thats just the file that the script is running from. Just didn't want to post my full path to the file thats all
  10. It's over there - http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php The error I get is: The original (none resized image) uploads in seconds.
  11. Sorry I should have explained better. The second image is resized. The First upload ($_FILES['theFile']['tmp_name']) is unrelated.
  12. die("Cannot write to file."); Line 46 - semi-colon on the end of die
  13. Hello. I'm using an Amazon S3 class to uploaded to S3. I have 2 upload boxes - The first uploads once and the second needs to upload twice - 1 full size, 1 thumb. The issue i'm having is that the 2nd image (the thumb) seems to be failing, although if I don't save the first full sized image I am able to upload the thumb. So I think the issue is with using the temp file twice? This is my code: //retreive post variables $fileName = $randomString . "_" . $_FILES['theFile']['name']; $fileTempName = $_FILES['theFile']['tmp_name']; $fileName2 = $randomString . "_" . $_FILES['theFile2']['name']; $fileTempName2 = $_FILES['theFile2']['tmp_name']; //move the file if ($s3->putObjectFile($fileTempName, "containerhere", $fileName, S3::ACL_PUBLIC_READ)) { echo "<strong>Uploaded Image</strong>"; }else{ echo "<strong>Something went wrong while uploading your file... sorry.</strong>"; } //move the file if ($s3->putObjectFile($fileTempName2, "containerhere", $fileName2, S3::ACL_PUBLIC_READ)) { echo "<strong>Uploaded Image</strong>"; }else{ echo "<strong>Something went wrong while uploading your file... sorry.</strong>"; } include('simpleImage.php'); $image = new SimpleImage(); $image->load($_FILES['theFile2']['tmp_name']); $image->resizeToWidth(100); $image->save($_FILES['theFile2']['tmp_name']); $fileName3 = $randomString . "_" . $_FILES['theFile2']['name']; $fileTempName3 = $_FILES['theFile2']['tmp_name']; //move the file if ($s3->putObjectFile($fileTempName3, "containerhere", "thumbs/" . $fileName3, S3::ACL_PUBLIC_READ)) { echo "<strong>Uploaded Image</strong>"; }else{ echo "<strong>Something went wrong while uploading your file... sorry.</strong>"; } Can anyone offer any advice? Thanks.
  14. Thanks thorpe, Muddy_Funster and Kickstart. Kickstart was spot on, i've put the 'true' into the second connection and passed the connection string to the function and it's working ok now. Thanks for your help guys! P.s. I must use error reporting more
  15. Hello Guys, I've come to try it this morning but I am still getting an error. My database connection file: $conn_local2 = mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('db1',$conn_local2) or die(mysql_error()); $conn_local = mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('sb2',$conn_local) or die(mysql_error()); Calling the function: <?php echo get_News(3, $conn_local2); ?> The function: function get_News($limit, $connx) { $sql = "SELECT * FROM news_items ORDER BY news_date DESC LIMIT 0,$limit"; $result = mysql_query($sql, $connx); if(mysql_num_rows($result)!=0){ while($row = mysql_fetch_array($result)) { .... The error: Can anyone see where I'm going wrong? Thanks.
  16. Brill. Thanks. Learn something new everyday. I'll work on it.
  17. Ok Thanks Guys. I will look into everything you've mentioned Without maybe sounding stupid, I have a number of functions already that I have been calling which have been working fine from the database without me passing a connection variable through to the function. Is that fine as long as there isn't multiple connections like i've now tried to do now? Also PFMaBiSmAd, my error_reporting is already set to E_ALL and display_errors is on but I still don't get an undefined noticed message on the $conn_local. Thanks again guys.
  18. The database file is included in the header of the website so it there on all pages, although the code is in a function in a functions.php page. I've tried echo'ing $conn_local although nothing is displayed (i know I wont get anything back other than an object but I would expect something to be displayed if it exists). Although surely if it's included at the top of the page is should be there when called within the function. Although, I have figured that if I do this: $sql = "SELECT * FROM dbname.news_items ORDER BY news_date DESC LIMIT 0,$limit"; $result = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($result)!=0){ while($row = mysql_fetch_array($result)) { then it appears to work. (adding the dbname.table) Although I didn't really want to go through specifying database names in the queries as these will change when it goes live. Any suggests on what I could try? Thanks.
  19. Hello Thorpe. Thanks for your reply. It is for now, but wont be when it goes 'live'. Never the less should the method above not work? Or is there a different way? Thanks.
  20. Hello, I'm using this code in a php file to connect to 2 databases (something that I need to do): $conn_local = mysql_connect('localhost','root','',TRUE); $conn_local2 = mysql_connect('localhost','root',''); mysql_select_db('db1',$conn_local); mysql_select_db('db2',$conn_local2); I'm then trying to use this code to call it from the 1st Database: $sql = "SELECT * FROM news_items ORDER BY news_date DESC LIMIT 0,$limit"; $result = mysql_query($sql,$conn_local); if(mysql_num_rows($result)!=0){ while($row = mysql_fetch_array($result)) ...etc Although I am getting this error: If I ONLY include the 1 database and don't bother putting the ',$conn_local' into the mysql_query it will work fine and return the records needed. It only seems to be when I try and include more than 1 database. Any ideas where I'm going wrong? Thanks.
  21. My test page is simply: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <h1>My test page</h1> <div id="header"></div> <div class="total_price">£44.99</div> <div id="footer">FOOTER</div> </body> </html> Any ideas? 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.