Jump to content

mac_gyver

Staff Alumni
  • Posts

    5,448
  • Joined

  • Days Won

    174

Everything posted by mac_gyver

  1. last time i looked, there were about 20,000 php cart tutorials posted in the Internet. most of the php code posted on the Internet wasn't done by professional programmers, but by php coders, that barely got their code to "work" at all, thought they had accomplished something unique, and posted it for anyone to stumble upon. when creating php code, it's best if you rely on yourself and just sit down and define what you want your code and data to do, rather than to rely on code you find posted on the Internet, especially if money or personal information is involved. when defining what you want code to do, you need to list what input(s) you have available, what processing you want the code to do, and what result or output you need that code to produce. for an 'add to cart' block of code - input: one product id from the url processing: condition/test/validate input id - is the id present and a positive integer greater than 0? if(id > 0) check if id exists in products table if(id in table) if(cart doesn't exist) create empty cart if(id not in cart) create entry in cart with quantity 1 else increment quantity in cart result/output: cart entry for the submitted id/error messages from your code i do have a recommendation for your cart definition, use the product id as the array index and the array value is the quantity. this will make finding/modifying information in the cart easier with less code. there's also no need for $_SESSION["counts"]. that's just redundant information.
  2. you have a timeout error when doing what? if this is in any way related to one of your existing thread, why didn't you post this in the relevant thread?
  3. the error means that you didn't fetch the data from the result set. before you can use php/mysql for your data, you must first learn how to use php/myqsl for any data. you need to read a basic php/mysql tutorial/book so that you understand the steps needed to form an sql query statement, run that query, check if the query executed without any errors, and then fetch any resultant data from that query.
  4. i do have a question about your godaddy hosting, is it based on an Apache web server so that a .htaccess file will even work? if you have an IIS web server, a .htaccess file has no meaning.
  5. perhaps you missed my first post in this thread - your pm, less the actual domain names is information you should have included in the first post in this thread. no one here knew the issue is that a url like - yourdomain.com/properties or is it actually /property had anything to do with the problem. Since i'm not very good with url rewriting, i probably cannot help you beyond this, but here's the relevant and sanitized information from your pm that you should have just posted so that someone here could help you - We currently have a web site hosted with GoDaddy, which is an exact replica of two web sites we have hosted somewhere else. Everything is identical apart from the colours... When you navigate to the available properties page, www.somedomain.com/properties - it generates a 404 error....if I navigate to properties.php - it works. The other websites we have (two other domain names at a different host) all work absolutely fine on this model - that's why i'm convinced it's something to do with the .htaccess (although it has been copied from a working site) or the root path in the config file. in typing this reply, i realized that the .htaccess you showed references property, but everything else you have been typing is for properties. which is it? what does the actual menu link that doesn't work end in? yes, it matters, because computers only do exactly what they are told to do.
  6. you need to troubleshoot to find out why your menu links are not valid. have you looked at the 'view source' of the page to try to identify what is wrong with the links? you either have a wrong protocol, domain name, path, file in them or some other error in the actual information making up the link. are you sure that the menu links don't work correctly, but something in the code on the target page of the links is then redirecting to the 404 non-existent page? what's the actual final url in your browsers address bar? we cannot possibly help you with this task without seeing at least one of the links to be able to identify what might be wrong with it. this isn't your web host's problem unless they wrote or sold you the script. all they are selling you is web hosting. it's not their job to setup or troubleshoot your scripts.
  7. you need to troubleshoot WHY your code is not doing what you expect. you know, actually examine the values that are being tested that cause it to take the execution branch that it is. i'll give you a hint, you have far too much logic. you need just the right amount of logic, not too little or too much (edit: because typing or copy/pasting excess amounts of code often leads to mistakes and you have one in a post variable name.) text/textarea from fields that have been submitted will be set. once you test that your form has been submitted, with if (isset($_POST['register'])) {, you don't need to test if each field is set and if your fields are all required, you should individually test if each one contains expected content and output a specific error message for each one that doesn't.
  8. only summery and statues were post variables from the form - $_POST['summery'], $_POST['status'] the other things were strings that you were testing if the $_POST variables were equal to.
  9. there's nothing functionally wrong with your code because mysql_fetch_assoc($r); will return a false value if the query did not match any row (or if the query failed due to an error). this also assumes that your redirect() function executes an exit/die statement after the header() redirect to prevent your code from continuing to run. however, if you are not going to use the actual data from the query and just need to find out if there's a matching row(s) with some value, it is more desirable to use COUNT() in a query, then get and test that count value - $r=query_wrapper("SELECT COUNT(*) FROM tblmembers WHERE mem_email = ?",$mem_email); list($count)=mysql_fetch_row($r); if($count > 0) redirect("/message.php?message=already_a_member");
  10. your first code has this - if ((summary==High). how are you expecting the defined constant summary to be equal to the defined constant High? then you changed it to - if (('summary'=='High'). how are you expecting the string 'summary' to be equal to the string 'High'? summery is from your form field, which you correctly used $_POST['summery'] in one place. you would need to use $_POST['summery'] every time you want to reference the submitted form field, same for $_POST['status'].
  11. okay, your next step will be to read the php.net documentation for what data a function returns. mysqli_fetch_array() returns both a numerical and an associative array, so looping over the data it returns will duplicate the output. you will generally use mysqli_fetch_assoc() if you want to reference data by the the associative column names.
  12. mysqli_query() and mysqli_error() both require the $con mysqli connection as a parameter and would be producing php error messages. this indicates that you don't have php's error_reporting/display_errors turned on. don't wasted any more of your time trying to program in php until you have turned on these settings as you are just blindly spinning your wheels getting nowhere without them being on. your first step will be to set php's error_reporting to E_ALL and display_errors to ON in the master php.ini on your development system. restart your web server to get any changes made to the master php.ini and make sure that you are getting php error messages being output from your code. your second step would be to read the php.net documentation for the mysqli_query() and mysqli_error() functions so that you know the proper usage of them. it's impossible to program without knowing what parameters the functions you are using require.
  13. your post doesn't identify what result you want (i'm guessing you want to preselect the area of the current user when producing the first drop-down select menu.)
  14. you are setting $i = 1; use the following (after the point where you calculate $start) - $i = $start + 1;
  15. you haven't shown us any of these links, but based on your statement about the "root path", you are attempting to use the server's file system path in links. the document root path is only relevant on the server for file operations and doesn't have anything to do with links that the browser requests. links are absolute/relative to your domain name not to root paths on the server. show at least one of the relevant links that doesn't work. if it contains any information you don't want to post, x that part of it out, but don't change the basic syntax of what you are posting.
  16. next try this - http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_convert-tz ---------- well, yes you can. if you are using php date/time functions you can set the timezone php uses to GMT using date_default_timezone_set() and you can do the same for mysql date/time functions using the SET time_zone = ... query that requinix showed you. ------------ you should store the date/times as GMT. then if the timezone database that mysql is using is up to date, the mysql convert_tz() function should take into account the DST start/stop dates of the timezones you put into it.
  17. if you look at the color highlighting in your posted code, it will lead you to the source of the problem, because the colors change to that of a quoted string and don't change back. hint: there's a missing single quote ' near the end of a line.
  18. because the definition contains ; delimiters, you must temporarily change the delimiter to something else so that those characters can be stored in the definition instead of being treated as a delimiter. how are you importing this?
  19. what dimensions are the smiley1.png image? it may be that you are just copying a small back section of it onto the other image.
  20. there's nothing in the errors that are specific to the database name. the SK_MySQL part is a class name. it may have been the same name as the database name, but that's not the reason for it appearing in the error message. the only thing that the error you posted tells is that the connection is failing. to find out specifically why it is failing, you would need to echo mysql_error();
  21. $num = "1234567890"; echo number_format($num,0,'', ' ');
  22. the code i posted isn't a copy/paste 100% complete tested solution, especially since no one here knew you were even outputting this to flash. it is an example showing how to use shuffle() to sort the rows in your $arr and to loop over the resulting random rows. if your code is doing more than that, it is up to you to take the method shown in the example code and modify it to suite your needs.
  23. that code cannot produce repeated questions, unless you have rows in your database table that are repeats. since we only see the information that you post, perhaps you should copy/paste what you see in the browser.
  24. you would post the same section of code that is in the first post in this thread, but what it currently is.
  25. cannot possibly help you with your current problem without seeing the code that produces the problem. changing one character or one line in code can completely change the result.
×
×
  • 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.