Jump to content

mogosselin

Members
  • Posts

    116
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mogosselin

  1. If you want to display all the records, you could simply remove the "LIMIT" part of your SQL query in displayProducts. function displayProducts($link, $cat, $prod, $p, $displayAll) { ... $query = "SELECT * FROM prodcat WHERE codes LIKE '$cat' OR codes LIKE '%,$cat' OR codes LIKE '$cat,%' OR codes LIKE '%,$cat,%' ORDER BY sku"; if (!$displayAll) { $query .= " LIMIT $minP, $rangeP"; } ... } A warning note: If you're going to put that live, please read a little bit on SQL injection as your code is not secure. There's this stackoverflow article. I also wrote an article on Injections (I'd like your comments if you read it). Also, you could use a "SELECT COUNT()" instead of retrieving all the rows from the database, it will be more efficient.
  2. Hi Orion! I'll try to help you as much as I can. A lot of jobs will ask for experience, but some will hire junior programmers. If you go the "junior programmer" path, just be careful not to go into a company that only has juniors and run on "cheap labor". You won't learn much in this kind of companies and it'll be stressful and you will probably have to work more hours (without getting paid). Personally, I started web development professionally in 2001 (first as an intern, then they hired me). My program included internship at the end (3 or 4 months if I remember correctly). This is a great way to get experience, but you need to start in a program that has this option. Also, you say that you want to support your family, but it really depends on how much money you need. 30k? 100k? 200k? Everything is possible, but 30k is easier, of course. And, what do you want to do? Get a job? If yes, in a big company? In a small company? Would you prefer to just focus on your coding or also be able to talk to the clients, get their needs, analyze what you're going to do? Would you prefer to work at your home? Would you like to go freelance? Start your own company? Everything is possible, what do you think you would like the most?
  3. Hi Allan! Good luck! Don't hesitate to ask for help in the PHP Help forum
  4. To know what doesn't work, did you try to output the value of "address" (before you add it to the "popup")? Is the value OK? Did you try to add any text in the map popup? Did it work? If not, maybe you should try with a simple empty map and just try to add a popup with a value in it. When you get how this work, you'll be able to add it to your program easily. P.S. I think you might want to remove your API key from your post...
  5. It sounds weird. Did you try with multiple browsers (IE, Chrome, FF, Safari). Do they do the same thing? If yes, can you post the link to your code or paste it in pastebin.com?
  6. Can you tell us what is the piece of code that you have problems with? Maybe the line numbers and what doesn't work with them.
  7. The PHP code you posted is not really formatted. Also, the XML code you posted is way too long for a forum post. If you think something that long is relevant, you can post it to an external site (like pastebin.com for example). Try to format your PHP code correctly (use the "code" feature, it's the <> icon). Also, try to explain what your code is supposed to do, It wasn't really clear (at least, for me )
  8. Like @mac_gyver said, anybody can change anything in a web page. Open up the developer tools of your browser (if you're on Windows, press F12, it should work with Chrome, FF and IE). In the panel where you see all of your HTML, try to find your drop down. You can then edit the value or your drop down element, live, and submit the form. Or the longer way: Save any HTML page on your hard drive that has a form on it. Open it in a text editor. Find the <form> element. Ensure that the action attribute has an absolute link as its value (example: <form action="http://www.thesite.com/form">). Change all the values that you want. Open that HTML file in your browser. Submit the form. That's it, you submitted custom values even if there was "fixed" choices (radio buttons, drop down, etc...).
  9. It would be easier to check your code if you use the "code" button and indent your code. Also, you should check out the str_getcsv() method: http://www.php.net/manual/en/function.str-getcsv.php I never used it but it seems done for what you want to do.
  10. So, you could use a central php script that plays the role of a controller. Then, based on the action, this central PHP script will choose which PHP (that you already have) to include. <?php switch ($action) { case "add": include 'add.php'; break; case "start": include 'start.php'; break; case "stop": include 'stop.php'; break; } ?> So you need your form to always call this script and pass a parameter called "action" depending on the button clicked. Does it make sense?
  11. The code you just posted is doing exactly that. It takes the input, like "abc def hij", split all the words (with the space). And it's looping around all the words and appending it to the query. REGEXP = Regular Expression. It's a special syntax that can "query" a string. Here's some examples: http://stackoverflow.com/questions/16166819/php-regular-expressions You probably mean the mysql_* functions that are deprecated? You can leave the mysql_* methods if you're not going to put your website/webapp live. If you are going to put it online, you can change the mysql_* calls for mysqli_* , it should be easier to start with. Here's a post explaining how to do this: http://stackoverflow.com/questions/1390607/how-could-i-change-this-mysql-to-mysqli If you still want to use PDO, I would try to break it down. Start a new PHP file and try to connect to your database with PDO, then add a simple code that selects data from a single table (SELECT * FROM TABLE). Then, you should be able to take your code and use it into your search form code.
  12. Hello! We'll be glad to help you with your PHP questions
  13. So basically, you want to do this: Get an HTML page Get all the images URL Loop on all of the images If the image has "www.site.com" AND "43x143/" AND ".jpg" in the name download that image on the server somewhere Is that it? So you figured out the point 1, 2 and 3. You need to figure out 3.1 and 3.1.1. 3.1 : Really easy (if you don't want to use a regex. I hate regex ) if (strpos($imageUrl,'www.site.com') !== false && strpos($imageUrl, '43x143' !== false ...) { // the image is fomr the site www.site.com and has 43x143 in it and ... // so download the image } To download the image, I found this code on stackoverflow: if you have allow_url_fopen set to true: $url = 'http://example.com/image.php'; $img = '/my/folder/flower.gif'; file_put_contents($img, file_get_contents($url)); Else use cURL: $ch = curl_init('http://example.com/image.php'); $fp = fopen('/my/folder/flower.gif', 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); Right here: http://stackoverflow.com/questions/9801471/download-image-from-url-using-php-code I found the code looking for "how to download image from url php". The trick is to break what you want to do in sentences. And then search (or ask here) one piece at a time
  14. Hi Vinny! What is your experience? Do you work professionally with PHP? Are you an SEO specialist?
  15. Wow, that's an interesting project! How long do you think it'll take to make? Don't forget to tell us when you have a beta or something!
  16. I'll assume that your PHP scripts are outputting something like this: customer.php: <option value="1">Customer #1</option> <option value="2">Customer #2</option> <option value="3">Customer #3</option> contact.php: <option value="11">Address #1 of selected customer</option> <option value="22">Address #2 of selected customer</option> etc... In your first piece of code, what is this? $(".responsetext").html(response); This is JQuery and it means "take the element with a class "responsetext" and put the content of the variable "response" into it. So ti will select this element: <select name="customer"id="customer" class="form-control input-sm responsetext"> </select> and will stuff whatever customer.php returns. It should already work. But, I would first add a space between name="customer"id="customer" so it's <select name="customer" id="customer" class="form-control input-sm responsetext"> </select> (if it's not just a copy-paste error) And I would change this line: $(".responsetext").html(response); for this line $("#customer").html(response); Instead of "find the element with the class responsetext", it's "find the element with the ID customer". Shouldn't change much, except it's better to use ID if you only want to select one object and it's more efficient too. Now your third piece of code: $("#id").on("change", function() { It means "select the HTML element with the id "id". (the pound # sign means "id", the dot sign means "class") Well, I don't see any element with the id "id". But I see an element with the id "contact": <select name="contact" class="form-control input-sm contactresults" id="contact"> So change it for $("#customer").on("change", function() { This should now work if your PHP returns the correct HTML. You could always try by hardcoding the result in the PHP just to see if it works.
  17. Like trq said, you need to include the class "facility" so that the class "home" knows it exists. Try to add this at the top of your "home.php" file: <?php require('facility.php'); ?> Otherwise, you're telling PHP : Hey, make the class "home" by extending the class "facility". Then PHP tells you: What the hell is the class facility? (it doesn't scan all the files alone, you need to tell PHP what are the file needed to execute your code).
  18. Did you try something with your scripts? What are you having trouble with? Your question isn't that clear and it seems to me that you want somebody to modify your scripts for you?
  19. Hello Tassadar! Good luck with your game! Is it a "text based" game?
  20. Hi there! That's great that you're interested in programming! Since you're thinking about PHP, I guess that you would like to program websites right? Do you want to program back-end administrations or "good looking" websites for "everybody"? What kind of web apps are you thinking about? And how do you think you'll earn money with programming? By yourself as a freelancer? In a big company? Fixing Wordpress sites or building websites from zero? I'm asking because depending on your answers, I'll give you different advice. For example, if you would like to build websites available for everybody with a great design, you'll probably want to look into CSS and HTML. But keep in mind that designing websites AND programming websites are 2 completely separate things and I rarely saw just one person able to do both of those tasks. Since you're saying that you're interested in programming, I would guess that designing websites is not your main priority. However, if you want to work with websites, you'll need to know how to fix a broken CSS or HTML display... So, yes, you should probably learn a bit of CSS and HTML, but you don't necessarily need to dive too much into it... Except if you want to become a front-end developer that "programs" mainly in CSS, HTML and JavaScript. Those "developers" are often the one who takes the designs (made with Photoshop) and turn them into a "basic" website, but they won't do server side programming (like in PHP, C#, etc.) or play with CMS like Drupal, etc.. It's not impossible to do both (front-end and back-end development), but as time pass, it's becoming more and more difficult to follow the evolution and be good at both front-end and back-end development. IMO, the first thing a newbie at web development should know is how the HTTP protocol works. It seems super technical with the "protocol" word here, but it's really easy. Here's a great tutorial about it: http://www.jmarshall.com/easy/http/ Now, if you don't know HTML and CSS, I would recommend that you learn a little bit of it but if you're going to fix already existing design, you can learn along the way too. Just learn the basics of HTML and CSS (and maybe a bit of JavaScript), then go with PHP (a good place to start: phptherightway.com). Then, learn something like MySQL or MongoDB. One trap you should not fall into is to start a big project, for example: I'm going to make a social network. Not a good idea. Start small! First : make a page where you can enter a text and it will output the number of words. Then, make a page where you can store your text in a database and retreive it. Then, make a small tip calculation app. then ... you see the picture It's probably more than you asked but anyway, don't hesitate to ask your questions
  21. Welcome Sash! You want to build a product like Bit.ly? It seems interesting but challenging... You'll probably face a lot of spammers that will want to take advantage of your product.
  22. Hello and welcome! Don't be afraid to ask your questions! Are you new to PHP or programming? Do you know any other programming language?
  23. I know it's not really what you asked for, but what about trying something a little bit easier just to see if it'll work for you? There is this great website that is on Github: http://www.phptherightway.com/ You can contribute to it on Github here: https://github.com/codeguy/php-the-right-way/tree/gh-pages That way, you'll see if you find it fun and continue to contribute on the long run. Then, you could easily "upgrade" to a real code project. Back to your "main question". My advice would be to find something cool for you. Personally, I would probably try to contribute to an open source CMS or a small blog platform, but maybe it's different for you. What do you like? What kind of websites do you use?
  24. Nice start! Try with something like this: <html> <head> <script> function updateNewPrice() { var oldPrice = document.getElementsByName("old_price")[0].value; var discountPrct = document.getElementsByName("percent")[0].value; if (!isNaN(oldPrice) && !isNaN(discountPrct)) { var discount = (oldPrice / 100) * discountPrct; if (discount > 0) document.getElementsByName("new_price")[0].value = discount; } } </script> </head> <body> <form method="post" action="" enctype="multipart/form-data"> old Price : <input onkeydown="updateNewPrice()" type="number" name="old_price" value=""><br> discount : <input onkeydown="updateNewPrice()" type="number" name="percent" value=""><br> new price : <input type="number" name="new_price" value=""><br> <input type="submit" id="submit" value="submit"> </form> </body> </html>
  25. You could use reCAPTCHA. Here's a nice article describing how to use it with PHP: https://developers.google.com/recaptcha/docs/php
×
×
  • 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.