-
Posts
5,450 -
Joined
-
Days Won
175
Everything posted by mac_gyver
-
$_SERVER["REQUEST_URI"] contains the path/file and also includes the url query string.
-
this is the same error you had in your first thread on this forum. are you learning from your experience so that you don't repeat the same problems? you also used the mysqli database functions in your second thread on this forum. why now go backwards using the msyql functions?
-
that would be two separate queries or a carefully crafted UNION of two LEFT JOIN queries.
-
the while(){} loop in your code is - a) incomplete, it is only echoing the first line. you should always use opening and closing { } in conditional statements. b) it's unlikely that you have a column named value1, value2.. if your purpose is to loop over any/all columns that the query selected, you would do just that. $row is an array. use a foreach(){} loop to loop over and echo each element in the array.
-
programming is an exact science. the values you are producing in your <option > tags are not just the table name, they contain html <br> tags as part of the value. when you echo <br> tags to a browser what do you see? white-space, specifically a new-line. people with thousands of posts and years of experience wouldn't have told you that the form has a problem if it didn't.
-
we can only help you if we know what errors you are getting and what the corresponding code is.
-
and please use the forum's bbcode tags (the edit form's <> button) around code when posting it in the forum.
-
if the relationship is between jobs and quotes and jobs and messages and there is no relationship between quotes and messages, then you actually need two queries (unless the columns you want to retrieve from quotes and messages happen to correspond exactly so that you could use a UNION query.)
-
the error message contains the database name and the table name to give you as much information about the problem as possible. that the database name is part of the error message is not the problem. the problem is you are supplying a table name that either doesn't exist or has some white-space as part of it or has a capitalization problem (and you are on an operating system that is case-sensitive.) that you are not posting actual information makes it hard to help you, especially since you don't understand the information you are seeing in front of you. i recommend that you post the code producing your form, since you likely have a problem in the code that's providing the value that's being submitted.
-
if there are no messages or no quotes, your straight JOIN won't return any result. to always get the job information, you would use a LEFT JOIN between the jobs table and the other tables. you are also joining quotes to messages. what your query is doing - jobs have messages, messages have quotes. is that the correct relationship? what jazzman is suggesting is to only write out code for things that are different. that part of the query that's the same should only exist once in your code. the only conditional logic should be the part that building the WHERE clause. this will reduce that amount of clutter and make it easier to see what your code is actually doing. next, having just the necessary code, so that you can see what your code is actually doing, would perhaps let you see that you are using mysql_error() on the end of a php string assignment statement, where it won't do any good, and that you are not actually running the sql query you are building.
-
Working out a grand total from multiple mysql tables
mac_gyver replied to Elit3d's topic in Javascript Help
the purpose of your javascript code is to add up and display the total price of the selected items. in order to do this, you must first have the price of the selected item(s). have you considered what information the user is presented with? he would want to see the prices displayed next to each possible choice as that would influence his selection. unless the use of ajax to retrieve the price was part of your assignment, there's no need to get the price on demand, you should already have the price for everything being listed when you (dynamically, using php code) build the radio-button choices by retrieving the information from your database table. -
Working out a grand total from multiple mysql tables
mac_gyver replied to Elit3d's topic in Javascript Help
first of all, there no code in your code to produce a total or even an element to display the total. where's your attempt at doing this? your code should be general purpose, with the fields you want to total up having a specific class name. you can then simply call a javascript function when any of the data changes, to total up the values of the fields having that class name and display the total in another field. using a javascript library like jquery would make this a simple task and you can probably search the web and find numerous examples. -
i think you misunderstand what programming help forums are for. they are for asking programming related questions and getting help with problems and errors in code you have. just stating you want to change how code works, isn't a question and isn't a programming problem or an error. if you haven't attempted to make the changes you have described, you don't have any code that we can help you with and we are not here to make changes to code for you. do you have a specific question about how to do what you want or a problem or error you had in your code when you tried to do this?
-
as to merging the code. in general, your application/web-site should have only ONE database. the two tables you have appear to be for different categories/quantities of items. you should only have one items table that holds the information for all your items/products. and in fact, your file names and functions names (in the javascript) shouldn't be specific to the type of information that's being displayed. it's all just item/product information. as to your sub-total question, that's a javascript coding question and should be posted separately in the javascript forum section.
-
the error you are getting is very common. see the following link for what it means and how to find what's causing it - http://forums.phpfreaks.com/topic/273121-readme-php-resources-faqs/?do=findComment&comment=1428660
-
the most likely cause of the symptom is because the following line - $_SESSION["products"] = $product; is inside the foreach(){} loop and is adding elements to the array that the loop is iterating over.
-
i have a recommendation that will greatly reduce the amount of code. use the item id/code as the array index. this will mean that you can directly test for or access the element in the array. you should also only store the quantity in the cart. the rest of the information is redundant and if you ever allow the chrname or initmod values to be edited or you add more columns of data, you will end up with out of sync data.
-
you would write a SELECT query to retrieve the password field, FROM the correct table, WHERE the username is equal to = the posted username, applying either your database library's string escape function to the posted username or using a prepared query, to prevent errors or to prevent sql injection. if that's a little less than you expected, it's because what you are asking, form and run a query that retrieves a specific column from a specific row in a database table, is a basic skill that you need to learn first, before you can attempt to do it for your data.
-
the array that the database retrieval code is storing the results into is $products. if 1077 is the index value that corresponds to your SMX 800E example, you would use echo $products['1077']; this is why copy/pasting code is not learning. the code that gets posted is only an example to look at, and in just about every case is untested, and can contain syntax errors, hastily typed variable names, logical errors...
-
@asif456, this is why programming help forums are not here to find or to give you programming related things you want or need. we don't know exactly what you are looking for, nor do we know your level of experience and understanding. programming help forums are for helping programmers with code they have written. topic locked.
- 5 replies
-
- event calender
- php
-
(and 2 more)
Tagged with:
-
but, to get the prices from a database table and list them for all the products on the page, YOU WILL BE CHANGING THE ENTIRE PAGE. you might as well dynamically produce the page and save the time it would take you to add php code in 40+ places on the page.
-
the http response for the download request must only consist of the header statements and the content of the file you want to download. what you are seeing in the downloaded file is the content of the file and the html that's being output on your success.php page, making the file invalid.
-
in your download.php code, you would also need to verify that the requested file belongs to the logged in user.
-
in your code, $results will be an array, not an object. if you use echo '<pre>',print_r($results,true),</pre>;, you can see what the structure of the array is.
-
it would be up to you to find code examples at your level of understanding. all a blog is, are - forms, form processing code (that stores submitted data in appropriate database tables), navigation/search/sort code to list or limit entries and pick display order, and code to retrieve/display the correct contents from those database tables in the correct order. you would also need a log-in system with access permissions, to control who can access the forms and the form processing code, a lot of validation and security to prevent nefarious visitors from doing things they shouldn't or to tell legitimate visitors what was wrong with what they did so that they can correct it, and error checking logic on everything so that your code will let the visitor know when the site isn't going to produce any result and to log (or display during development) all the information about each error so that you can find and fix problems.