-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Using POST or not is not the problem. The problem is you have to review your code when you switch from one thing to another and apparently you probably didn't. Don't blame it on POST - blame it on the programmer.
-
What doesn't work? The mail never arrives or never gets sent? Do you get a response from your script? Is error checking turned on?
-
You're still using GET instead of POST?
-
I hate seeing repeated closing/opening php tags in a script. Demonstrates a lack of understanding and poor script structure IMHO. Also a lot of single /double quotes in the query string that can be simply avoided. VALUES('$id','$name','$email','$item_number','$txn_id','$payment_gross','$currency_code','$payment_status')"); works just as well as the messy string you used. Also - for those values that are numbers you don't even need quotes. Of course a better approach would be to use a prepared statement and make your query more secure. As for your code in general: 1 - why expose all your data to the user via a GET method instead of POST one? 2 - WHY ARE YOU NOT SANITIZING your inputs - especially after using the GET? Tsk, tsk, tsk.
-
Create Products Variant depended on different category
ginerjm replied to Kavish's topic in PHP Coding Help
Perhaps you know what a 'product variant' is but the rest of us have no clue. Can you explain it to us laymen? -
I see a mysqli query call, a mysqli connect error check and a MySQL (no I) error code display. But I don't see how you made your db connection. Dare I ask if it was MySQL (no I)? Are you doing error checking during your development as a good programmer usually (always?) does? And of course the faulty query statement that Barand previously pointed out. PS - you don't think that people who post across multiple forums aren't noticed by those who visit the boards regularly? On what planet do you live? If I were you I would be more concerned about the weakness in your debugging ability that was pointed out to you.
-
An if else s/b the last option. Too much maintenance. If you have cats and sub cats and assigned products to each, why the tags? Seems like duplication of effort. Again - work this thru in a thinking manner. Forget all about programming. Pretend it is not a computer problem but simply a business problem. Get a good design based on clear detailed thinking. What do you mean you have by this line: ... and the final presentation of this homework will be in 2 other professors. You have one professor giving you an assignment and no help and 2 others grading you? B.S! Last question: What is the title of this course you are taking? What is the main subject matter you are trying to learn from it? Design & Analysis? Coding? Database technology?
-
You need to sit down and visualize this problem. After all that's how all computer algorithms are developed. A problem is described, the data and processes are analyzed and the result is the solution. Then the programming begins. In your case you have products that you want to take you to categories and from categories to other 'products', ie, the advertisements. So? You have to connect the dots here. Correct? Your products in the first case have to have some attributes to help you connect them to categories. Remember - some products may be so generic that you cannot make a positive connection so what are YOU going to do there? For most though you can probably make multiple category associations so what will you do in that case? This is the hard part. Do you assign multiple possible categories to a product and then lump them all together into some kind of query that seeks the most common category for the person based on multiple product selections? Decisions, decisions. That is the dilemma of any systems analyst. Once you have the category selected the link to the actual ads you want to show becomes much clearer of course. Going from the distinct category to multiple ads will be easy since they can rotate or be presented in groups, whatever you want to do. The hard part is the above part when you are trying to go from multiple choices down to one or more categories. How you implement this (so far we haven't thought about coding yet) is the last part. Tables/array/ifelse string/ etc. are the last things to work out. You have to visualize your problem and the pitfalls and make the decisions that will complete YOUR design. Then work out the implementation. See why careers are made from this? Perhaps you could write up a 500 word synopsis of your thoughts on the problem and the possible solutions and/or pitfalls and present that to your professor to show how well you have analyzed the problem He might just be testing you on your thinking and not your programming.
-
You want to design something for a "homework" project that other people make careers out of. Is this project one of your own choice or was it really a hard assignment?
-
In the time it took for you to post this query and to get a response you could have just entered the desired script name in the action attribute of your form tag.
-
Huh? That has to be longest sentence I have ever read. And I don't understand it. Really? You can't describe your problem any better?
-
Your attitude sets you up to be ignored by us and others who truly want to help you. That said - You are being advised nicely that your database design is bad. It is not how dbs are meant to be done. There are whole sets of documents and rules on the subject of data normalization out there. This is not one person's pet theory. It is a long and durable method that has been in place for decades. You are just finding out about it and not realizing how far out of the loop you are here. There are steps involved in getting a normalized database that go into the 5th, 6th, and (maybe) even the 7th levels before the data is truly structured properly. Helping you "solve your problem" here would be an injustice to you and be bad advice that would live on forever in the internet archives and be the source of some other person's future path down the same rocky road. Do yourself a favor and apologize to the forum and then do some research on "data normalization" and see what the story is. And have a great new year!
-
1 - error 1 tells you something very specific. Have you read the manual to see how the bind_result has to be built? Fix the number of args in your call - that is what it is telling you. 2 - If you had PROPERLY done error checking on your bind call, or on your query call you wouldn't have reached the fetch call which won't work since the query probably failed because of error #1
-
Help with redirecting to specific nav-pill on same page
ginerjm replied to rodb's topic in PHP Coding Help
I'm gonna guess that the page reference is part of the url, not part of the query string. Try that. -
Help with redirecting to specific nav-pill on same page
ginerjm replied to rodb's topic in PHP Coding Help
You're using bootstrap per Benanamen. Greek to me! I'll say good bye -
Help with redirecting to specific nav-pill on same page
ginerjm replied to rodb's topic in PHP Coding Help
Does this involve some framework or plug-in that you are using? What is a "nav-pill"? I see you have some classes similar to that term, but what are you really trying to do here? -
Total noob, need help with basic If condition
ginerjm replied to JeffInho's topic in PHP Coding Help
If you are REALLY going to try and learn php the first thing would be to learn how to keep your html code separate from the php code. Makes things easier to code and to maintain and to read. Calculate all your values into php vars and then insert them into the html code where appropriate instead of switching in and out of php mode to do the calcs. A sample of variable insertion would be: echo "The time is $time_no"; Note the use of the double quotes to wrap the string and the var in. Single quotes won't work on a variable. Try doing the calcs first then do your output. -
Where is $paid given a value? Your posted code doesn't set it here. And if as Barand says you have code elsewhere, I will step away since I don't like to waste my time.
-
You need to be careful how you use the words page and script. The script is where your code resides. IMHO, the 'page' is what you see on the client screen. When your code above executes you make a choice between showing page 1 or page 2. Now if the script is triggered from a URL then the two headers that you propose are correct. If you are in the running script with the above code because say, page 1, triggered it, and your script decides that page 1 needs to be displayed again, then let your script do that like it already did perhaps. If the other page is desired, then the header call will do it for you. This question makes me wonder what you are thinking about since it is a pretty elementary concept.
-
This may be semantics but what you are saying is you want a script to check a db table and depending upon what it is, go to a specific page. As you wrote it you make it sound like you are doing this while looking at the page which you can't do since php is running server-side. Of course the whole idea is elementary. Do your query. Write an if statement. Make a header() call to the appropriate script/page.
-
Explode value from database column then count it
ginerjm replied to cobusbo's topic in PHP Coding Help
As Barand said - you REALLY need to normalize (look it up) this data. Not a good table design at all! Create a new table with the appropriate cols for your data. Then write a script to query the whole table, then loop thru the results and for each record do your explode (and grab any other fields you haven't told us about) and do an insert query into the new table to post the individual values in their respective columns. Voila - a proper designed table with all your data. -
If you liked that you should read the manual for the switch statement usage. Even easier to setup. PS - I don't think you need the p tags inside your option tags. Kind of doesn't make sense to add extra html levels to a simple list element which the option tag really is.
-
Change all this redundant code: if ($regarding == 'Human Resources'){ // form action email(sophiaw@jamaicainn.com, $subject, $message) then redirect to } elseif ($regarding == 'Guest Relations'){ // form action email(shickling@jamaicainn.com@jamaicainn.com, $subject, $message) } elseif ($regarding == 'Spa'){ to something more logical: if ($regarding == 'Human Resources') $to = "sophiaw@jamaicainn.com"; elseif ($regarding == 'Guest Relations') $to = "shickling@jamaicainn.com"; elseif ($regarding == 'Spa') ... Then simply get your subject and message and headers setup into their variables and send your mail using the to you create above. One mail call.
-
If the fear is that someone is preventing you from getting a valid referrer, why not write your code to demand a valid referrer and, in one's absence, reject the request. Furthermore you could have any valid url requests include a POST value that has to be present as well.
-
Need help trying to shorten my code into a loop
ginerjm replied to chrisyroid's topic in PHP Coding Help
Uh - what exactly don't you see? The code does what you tried to demo, but you will have ot make some changes to your form data names in order to use it.