-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
You seem to contradict yourself. First you say 'this is how the data is stored' then you say that a function 'returns the data as an array'. So is it NOT stored as an array? And just how is it stored - as a table or a flat file or some other method? It's been 3 days since you asked for help yet nobody is able to manage that for you yet. Perhaps you need to work on that data storage algorithm.
-
Is an array really necessary? A db would give you something manageable and useable a persistency rather than all of the levels of data you are currently displaying. Forgive me and my personal gripe - just don't see the fascination with arrays that some posters have.
-
Do you have error checking turned on? Have you tried using a different image in place of the nouser one? Just to see what happens. And if that works, then what does that tell you?
-
Jane should have an image and John should NOT. Your code says that if there is an image set you will see the nouserback.jpg in the url and otherwise (if there IS NO image set) show the image that has been set.
-
type='hidden'
-
I could not follow your code. That is why I asked what I asked. Forget your plan. Describe what you would like to do from the beginning.
-
You are trying to use PHP to write something to a client's clipboard? That is not possible since php runs on the server and not the client. But then you think that JS can do that for you. That MAY be true but it won't happen until the php script is done and the page is loaded on the client. Is that what you are seeing? How about you backup and tell us what your plan is and let us think about the programming?
-
Actually I was most appalled at the approach to combine multiple instructions into one statement making it difficult for a new user to find or recognize any error that may occur within that stage of operation. For an instructor (or syllabus) to demonstrate this method is definitely no way to help a beginner to understand what is going on. Just my $.02
-
To be brief and exact as I asked, are you saying that you want to grab a piece of data from a query result (row) and place it into an input tag on our table? Since I see you are able to do a query (although you need to improve that) you simply take the value of that fetch and add it to the value attribute of the input tag as you output it with your html code. Over and over. So - as you retrieve a row you then output the next html table row beginning with a tr tag then multiple td tags and end with a closing tr tag. Then do another fetch (it's a loop). Yes - I am being very simplistic here but since you showed us A WHOLE LOT OF CODE I had to wonder what bit you were unable to do.
-
In a few words tell us what you don't know how to do. I can't make sense out of this. Sure - it appears to be a crowded page with a lot of fields. Are you trying to update multiple records from this one input page? What exactly do you want to do? Keeping it simple will help someone here understand and help you.
-
Stopwatch (server side) to see from severals clients
ginerjm replied to elsafraslastra's topic in PHP Coding Help
PS to my previous. No doubt the answer to a new topic (as suggested) will include some JS that will operate on a timer function that uses ajax to keep up with a server-side time. Just a thought that I haven't dug into but it seems logical. -
Stopwatch (server side) to see from severals clients
ginerjm replied to elsafraslastra's topic in PHP Coding Help
If you want the clock to run on the server and show the time on each client that is connected I don't know how PHP can do this for you since it doesn't run on the clients and the clock (as said) is on the server. Getting the picture? If the clock ticks one second by, how does it update each (or any) client? Sounds like a lot of bandwidth for this app - sending time updates every second to every client. How about posting a new topic relative to how to display a clock to a user? -
If you really think you have to do this then what you should do - since you have to validate any 'changed' values before using them - is to hide the original values in your form along with the visible input fields. Then upon the submit check if an input value is new (id, <> original value) validate it and add it to the query. If it is unchanged don't. If a new value is not valid then create an error message and when done with this step either re-output the form or do the update using only the values you want to put into the query.
-
Overhead? For including some fields that weren't altered? I don't think it is a concern at all.
-
Why does this topic resemble very strongly another one that is currently being posted in 2 separate pieces?
-
Good morning Guys, I hope you are all doing well. I need a help
ginerjm replied to gildas-Milandou's topic in PHP Coding Help
@gildas-Milandou: I hope you can decide to use the info that Barand has supplied you (twice) to improve your entire script. And also that you can learn how to make good posts on this forum and any others you visit. As well as begin to use the 3 pointers that I gave you in the first response to this query of yours. Otherwise I'm afraid that the regulars here may just not respond to you any longer. -
Good morning Guys, I hope you are all doing well. I need a help
ginerjm replied to gildas-Milandou's topic in PHP Coding Help
@Barand : Did you not give the OP a better query option on Sat. in his first topic that he apparently is now COMPLETELY ignoring? What's the point if he/she's not listening? -
Good morning Guys, I hope you are all doing well. I need a help
ginerjm replied to gildas-Milandou's topic in PHP Coding Help
Did you check that your query ran? I don't see any code for that. Did you check that your input value was a proper numeric entry? ALWAYS validate any input you get from the user. You are not. After that - do an echo statement to show you those two values that are invalid to see if they are numeric. Lastly - I don't see how your table is designed to work. One record per ip address but all it has on it is a quantity? No item id or item price - just a quantity for a specific ip address which could itself be used b multiple users. Does not make sense. $get_ip_add = getIPAddress(); if(isset($_POST['update_cart'])) { if (!is_numeric($_POST['qty']) { echo "Invalid quantity value - must be numeric<br>"; exit; } $quantities = $_POST['qty']; $update_cart = "update cart_details set quantity=$quantities where ip_address='$get_ip_add'"; if(!$result_products_quantity = mysqli_query($con,$update_cart)) { echo "Query did not run properly<br>"; exit(); } $total_price = $total_price * $quantities; } -
Hello every body, I hope you are all fine.
ginerjm replied to gildas-Milandou's topic in PHP Coding Help
Do you error checking enabled? Why are you doing a query inside that loop? You should do your data collection with a single query. -
Ahmedarain24 : You DO realize that you are posting answers to topics that have not been active for at least or month and more. Kind of a waster of your time.
-
You probably need a dollar sign in this line: product_keywords like `%search_data_value%`"; if you are trying to match the contents of that variable. And that is why the query failed to execute
-
I offer this correction to your code. It makes it easier to read and is better in the long run to learn to code this way. you have: if(newent.value == 'B' || newent.value == 'P' || newent.value == 'T' || newent.value == 'D' ) {EnterSw.value=0;return true;} else{alert('INVALID HAND / MAIN INVALID');newent.select();return false;}} This would be much better: if(newent.value == 'B' || newent.value == 'P' || newent.value == 'T' || newent.value == 'D' ) { EnterSw.value = 0; return true; } else { alert('INVALID HAND / MAIN INVALID'); newent.select(); return false; } Note how I inserted the lines within the {} under the if and under the else. Also - it is better to only put one statement per line to make it easier to find statements when you are developing that may be causing you problems. Joining them into one line makes them harder to find.
-
you did something else as well. Enabling error checking didn't solve your problems. It would only tell you what coding mistakes you had. And stop using the ?> line. You don't need to do that all the time.