Jump to content

Love2c0de

Members
  • Posts

    364
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Love2c0de

  1. Thank you very much. The website link that you gave me though, there was a bit about checking whether your host allows mod_rewrite by doing php_info(); in a file and checking the apache modules, but nothing came up about mod_rewrite. I am on a free host, I think that's probably why? Regards, L2c.
  2. When moving my database and tables to another host, do I just export it and then import to the new host? Kind regards, L2c.
  3. Just to let you know that I put your above code into the .htaccess file on my host and it was saying there was a 'crossnetwork' error? I'll give that a read though as it might explain in there. Edit: Damn host doesn't allow mod_rewrite Regards, L2c.
  4. I'll give it a read now. Thanks for the information. Kind regards, L2c.
  5. Good evening, Thanks for your reply. I would prefer it to start with a capital letter yes. Do I need to put that into a file and upload it to my webhost? If so, where abouts would I upload it to? Kind regards, L2c
  6. Good evening, I have a website using php to set the pages up. My URL is showing as: http://localhost/Gardenable/?page=home for example. How can I change it so that it displays as: http://localhost/Gardenable/Home Kind regards, L2c
  7. Fantastic, thank you for your reply. Can't believe I missd that. Cheers! L2c.
  8. Good evening, I am pulling some data from a database but it seems to be displaying the data with id 2 first, rather than the data with id 1 and then 2 etc. Here is my table setup, I have one table called products which holds some general information and a table called product_images which hold product info along with the image name etc. What's happening is that the bird house data is being displayed before the planters data even though the planters data is the first ID. Here is my code which retrieves all the information: <?php //if the code gets this far, we know that the user is viewing the product page and has clicked a link to view. save value to variable. $product = isset($_GET['order']) ? $_GET['order'] : ""; //connect to server, select db, query table. $connection = mysql_connect("localhost","root","") or die("Error connecting to server."); $database = mysql_select_db("gardenable",$connection) or die("Error selecting the database."); //setup variables ready to be used with the database data. $count = 0;//used to iterate through $product_array to store results. //holds the full directory of where this file is located. $full_dir = dirname(__FILE__); //holds an array of directories/files found inside the core folder. $dir_files = scandir($full_dir); //Searches string starting at end, finding first position of '\' and returns everything to the end 'core'. Replaces any occurences of '\' with an empty string. $core = str_replace("\\","",(strrchr($full_dir,"\\"))); //holds the index of where the images folder was found, used to securely select the right index as hardcoding will lead to errors as index may change if files/dirs added. $image_folder = (array_search("product_files",$dir_files)) ? array_search("product_files",$dir_files) : die("Could not locate the images folder."); //holds the full directory of where the images are stored. Will be used in the 'src' attribute to display images. $image_directory = $core."/".$dir_files[$image_folder]."/"; $sql = "SELECT P.productID, P.product_name, P.product_details, I.imgID, I.product_price, I.imgName, I.product_dims, I.product_ref, I.product_desc " . "FROM products AS P,product_images AS I " . "WHERE P.productID = I.productID "; if ($product != "") { $sql .= " AND P.product_name = '{$product}'"; } $sql .= " ORDER BY P.product_name"; $query = mysql_query($sql) or die("error selecting records: " . mysql_error() ); $priorProduct = ""; $output = "<div id='product_holder'>"; while ($row = mysql_fetch_array($query)) { $productName = ucwords(str_replace("_"," ",$row["product_name"])); if ( $priorProduct != $productName ) { $output .= "<hr class='form_hr' />"; $output .= "<h2 id='product_heading'>{$productName}</h2>\n"; $output .= "<p id='product_description'>{$row["product_details"]}</p><br/>\n"; $priorProduct = $productName; } $output .= "<div class='prod'>"; $output .= "<a href='?page=display&id={$row['imgID']}' target='_blank'>"."<img src='{$image_directory}{$row['imgName']}' alt='{$row['product_name']}' title='{$row['product_desc']}' border='0' /></a>"; $output .= "<p id='p_id'>Product ID: <span class='white'>{$row['product_ref']}</span></p>"; $output .= "<p class='dims'>".$row['product_dims']."</p>"; $output .= "<p class='price'>£".$row['product_price']."</p>"; $output .= "</div>"; } $output .= "<hr id='last' />"; $output .= "</div>"; ?> I have attached 2 images of the 2 tables below. Is it the way I am retriving the data? Kind regards, L2c.
  9. Good afternoon Thomas, I don't know much about this but I found this which might be of use to you: http://stackoverflow.com/questions/11394099/how-to-fix-warning-mail-function-mail-smtp-server-response-530-smtp-authe Kind regards, L2c.
  10. I'd create another table called products which holds all the information about the product, and when the retailer adds/updates/deletes products, you insert/update, you can either send the retailer name into the products table, or create a unique string which links to both tables. Each retailer could have a unique id. When they update a product, you send that unique string along with the product information into the products table. This will allow retailers to uplaod the same products and also help when retrieving the information. Kind regards, L2c.
  11. Good evening, You have missed off an ending semi-colon on this line: echo "<tbody>\n" Kind regards, L2c
  12. Good morning Christian, You know it was on the tip of my tongue! Cheers bud L2c
  13. Good morning Psycho, What is the correct naming convention for that style declaration above? Kind regards, L2c
  14. Good evening mmc6e, What you could try, is when the user clicks the 'print this page' link, set it to display none? I'm not sure how printing a page works but it might be an avenue to explore. Regards, L2c.
  15. Good evening lunatic, You can use the array_search() function. //this returns the index or false on failure $index = array_search($_GET['view'],$array_name); Hope this helps, Kind regards, L2c.
  16. Good evening ignace, Could you elaborate a little more on what are my possible options. Do I really need my 'forum_categories' table then? Thank you for your response. Kind regards, L2c.
  17. Good afternoon, I am attempting to create a custom forum for my own personal website which I'm working on but I can't really grasp the concept of how my database should be set up. At the moment I have a 'forum_categories' table with 5 fields; id, forum, topics, posts, last_post. I have put some dummy data into my table so that I can test displaying it. I have attached 2 screenshots, first one is my database structure and the second one is the data. The idea is that when they first visit the forum page, the topics and posts table columns should count the amount of topics and posts for each section and of course, last_post is self explanatory. At this present time I'm not sure on what to do. I know I will need more tables holding the actual posts but I'm not sure how to properly link each topic to the correct section and how to link the topics with the posts. Do I need 2 more tables, one say topics and one say posts and link them with ID's? Is there a standard way to create forums or could anyone point me in the direction of credible tutorials? I look forward to your help. Kind regards, L2c.
  18. In that case, I would create another table where you insert the images by whichever user, but you also insert a unique id of that user at the same time. This will allow you to select only the images with that certain id. Kind regards, L2c.
  19. Good afternoon, Try this code: $number = 1234.56; $english_format_number = number_format($number, 2, '.', ','); print($english_format_number); Read this page here: http://php.net/manual/en/function.number-format.php Kind regards, L2c.
  20. Good morning Luis, Did you manage to get it working? Kind regards, L2c.
  21. Good morning luismc2007, Can you post your error in English please? Kind regards, L2c.
  22. Have you got a live example I can play around with? Kind regards, L2c.
  23. Good evening, Add that color to your <div> with a class of .lol Like this: <div class='lol' style='background: #0E1A24;'> Kind regards, L2c.
  24. Good evening, I'm sorry but it's not clear for me either. So what column are you having issues with if we go from that image you posted? You said you have 2 columns but I see 3. When you say you want them to stack, what exactly do you mean? Kind regards, L2c.
  25. Fantastic that works perfectly now. Kind regards, L2c.
×
×
  • 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.