-
Posts
1,033 -
Joined
-
Last visited
-
Days Won
17
Everything posted by gw1500se
-
Part of the problem is way you generate your IDs. How do you know that it is the same Jim? For your immediate problem, you don't have the submit button associated with a form. You need to tell PHP what mode you are using (POST or GET).
-
You are confusing me. PHP DOES only execute when the submit button is clicked. What makes you think it gets executed otherwise? Then you need to check for identical IDs. You didn't post your schema so it is difficult to be more specific.
-
Your SQL statements section is where you need to eliminate duplicates. Check to see if the record exists and if it does don't insert it. Perhaps you just do an update instead or let the user know it is an attempt to insert the same data.
-
PHP data matching dropdown with qr code scan
gw1500se replied to Bramhowl's topic in PHP Coding Help
So far you have not explained what pieces of data you want to match. We cannot help you until you make it clear what you are trying to accomplish. You are getting the same thing when you submit because you are processing the same page. Keep in mind that PHP is stateless. That means it does not know what happened the last time it was executed. I see nothing in your code that checks to see if the page is output the first time or output because of a submit. If you want something different to happen on a submit you need to know that button was clicked and do whatever for the submit. I am not sure what submit does when it is not part of a form or has no 'onclick' attribute. -
PHP data matching dropdown with qr code scan
gw1500se replied to Bramhowl's topic in PHP Coding Help
Yes but again you should use the code icon. Now when you run the script you can follow the flow and determine what is going wrong, where. Also make sure you have error reporting turned on. Put this at the top of your script: error_reporting(E_ALL); -
What did you try? What error(s) did you get? What is not working as you expect? Do you expect us to use our clairvoyance to understand your code? When you post your code be sure to use the code icon (<>) and specify PHP or HTML as appropriate.
-
PHP data matching dropdown with qr code scan
gw1500se replied to Bramhowl's topic in PHP Coding Help
'echo' your data throughout the script so you can see what the variables are as the logic progresses. -
PHP data matching dropdown with qr code scan
gw1500se replied to Bramhowl's topic in PHP Coding Help
Start by editing your post and using the code icon (<>) and select PHP for your code. The formatter makes your code much easier to read. Second, tell us what error you are getting on what line or what you expect vs. what you are getting. -
I suggest you are going about it the wrong way. Use DOM instead.
-
You don't show which is line 157 but it is fairly obvious the problem is with $file and the fopen. Make sure you have error reporting turned on at the beginning of your script: ini_set('display_errors',1); error_reporting(E_ALL); A better way to do what you want is: if ($file = fopen("csv3.csv","r")) { echo "<pre>"; print_r(fgetcsv($file)); echo "</pre>"; } else { print("Error opening file: ".error_get_last()); There are several other weird things in your script but this addresses your immediate problem. I'm guessing the error is "file not found" since the file will not be uploaded to the document root. You should be using $_FILES to get the uploaded file.
-
How can i create a bitcoin/e-cash deposit and withdrawal with PHP
gw1500se replied to Blacbizzy's topic in PHP Coding Help
Search engines are you friend. https://www.blockchain.com/api -
I can't but there are others that likely will. Post your request in the Job Offerings forum.
-
You are correct, it doesn't check for required fields. The most user friendly way to do that is with a javascript before the form is submitted. That way the user does not get frustrated when inadvertently missing a field and not knowing it until the server responds after the submit. That being said you should check again in PHP before using the fields in case someone is messing with your form.
-
Nope. Don't make people go to a 3rd party site. This forum is specifically designed for posting code here. Be sure to use the code icon (<> at the top) and select PHP or HTML as appropriate.
-
Since PHP 'strtotime' accepts the string 'weekdays' you don't have to worry about weekends. $delivery=strtotime("5 weekdays"); You then only have to account for holidays.
-
After careful analysis and deliberation of the original post I would tend to agree. 🙂
-
Elapsed Time Does Not Increment by Seconds or Minutes.
gw1500se replied to phreak3r's topic in PHP Coding Help
Keep in mind that PHP is server side and it is stateless. That means when you refresh the page, it is the same as issuing the page the first time unless you use sessions. It is not clear to me exactly what you are trying to accomplish but it perhaps you want to use javascript which is client side. -
Post the actual error and line to which it refers.
-
That is not the code I suggested. In any case, that error appears to mean the database or network is down. It is coming from the connection code not the loop after the query.
-
Not quite. FetchAll will retrieve all the rows at once. If you want to use it then: $rows = $result2->fetchAll(PDO::FETCH_ASSOC) foreach ($rows as $key=>$value) { . . .
-
Try reading this.
-
You need to put the output in a loop. Fetch only gets 1 row. Your HTML only outputs 1 row. You need to move the fetch and loop on it where you start a new row. Also, don't use * in your select. List only those columns you will actually use. Since you don't use '$count' you don't need that statement.
-
You need to 'ORDER BY' in your query on state. Then keep a running total of 'UOMPVOLUMETOTAL' until the state changes or you reach the end or your data. At that point output your total and line break and reset the total to 0.