Jump to content

ginerjm

Members
  • Posts

    6,900
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. You say you are getting stuck at a certain line. What does stuck mean? Error message? No response from script?
  2. And try to get new sets of 'data' in a better format. A PDF is something that someone created to deliver data/info to you. Why can't they deliver it to you in a truly readable format? I mean, have you ever viewed the contents of a pdf document? It is unreadable by the human eye. It must be read by something that knows how to interpret the format that Adobe created years ago to provide info in a format that anyone (not a data processor) could read with Adobe's product line as well as (now) any one of many tools that have been written to interpret them as well.
  3. But none of those 'things' are true 'data providers'. They are documents. Data must be stored in a retrievable way. That means it can be easily read and analyzed and presented as the user wishes. A manual is meant to be visually read. Same for an invoice, a letter in digital format (or in printed format) or sheet music. A pdf is also meant for that purpose. If someone is trying to provide 'data' they should not be creating a pdf out of it. It's really pretty simple. If you have no option other than to try and decipher these pdfs that you already have then you probably need to keep trying to find the proper tool that you can handle.
  4. pdf is a presentation tool to provide a view of things to people using a common format. Why would you think of it as a db format?
  5. What tools have you tried? I did a quick google and see several packages available but have no interest in exploring them for you. FYI - when someone sends me something that I wish to process using php I ask them to provide me the same data in a proper data format rather than a pdf.
  6. Do you have php error checking enabled? I dont think so. How do you know that $_POST['nazov'] actually exists? What is this line supposed to do for you? : if ($klucik = $SQLKEY) I ask that since this is an assignent, not a valid test which I think is what you are looking for. I could probably go on but these 2 lines are enough for now.
  7. That is good to here - that you are a coder. So - do you want to write this in JS or PHP? If JS then you should move to the appropriate forum since this is PHP. If PHP - Do some googling for this topic and see what's out there. Play with it and write something and put some echo statements in it to show what is happening and run it to test it out. Be sure php error checking is turned on. If you get problems that's the time to show us the code and point out where your error message is pointing to and ask for help with that. We're really good at that stuff.
  8. Do you know how to code at all? Cause if you don't you ARE in the wrong place. And - if you are doing this project for a friend, he/she had better be a very forgiving friend.
  9. And what have you attempted to do so far? We help. We don't write.
  10. You have 2 forms defined in this code. Which one isn't working?
  11. How do you define a page? What are these pages? How will you read them? Adding what to what when you find something? So many questions that you could have provided answers to as part of your opening.
  12. I see that you have a few lines that analyzes pieces of a date value and issues a known response. Now where it the 'counting' supposed to and what is the set of data being counted?
  13. Can you just describe the problem and what you are trying to do? Better than us trying to figure out your code it would help if you described the task. When someone tells us that they have 2 query results arrays the better answer is to change the query to only make one result.
  14. It appears to be a very simple problem. What have you tried so far? Show us so we can help you out. Or you just asking us to write a script for you?
  15. I dont do this often but perhaps you are doing a GET request so the POST array doesn't exist?
  16. It means that your form is missing 2 fields named 'param1' and 'param2'.
  17. So the script does some of its work but then just stops? Are you getting any messages? Do you have PHP error checking turned on? Have you tried placing some echo lines in the code to see what steps it does get through?
  18. I see no effort in this piece code that does any of that. Care to enlighten me as to how that is being accomplished? And please stop writing code like this. Way too complicated and completely unnecessary. Please look at how I rewrote your post to be clearer and it does not unnecessarily switch in and out of php mode. If you don't wish to do that then I will bow out now and let you continue
  19. I've taken the OP's original presentation of his code and made it a bit more readable for those of us who don't see what the attempt here is. Isn't this below a bit more readable as well as understandable? foreach ($pedidos as $dato) { $codigoPedido = $dato['Codigo_pedido']; $razonSocialCliente = $dato['Razon_social']; $tipoPedido = $dato['Tipo_pedido']; $nombreEmpleado = $dato['NombreEmpleado']; $estadoPedido = $dato['Estado_pedido']; $fechaPedido = $dato['Fecha']; $descripcionProductos = explode('<br>', $dato['DescripcionProductos']); $cantidadProductos = explode('', $dato['CantidadProductos']); $precioTotal = $dato['PrecioTotal']; $numProductos = count($descripcionProductos); if (count($cantidadProductos) !== $numProductos) continue; echo " <tr> <td rowspan='$numProductos'>$codigoPedido</td> <td rowspan='$numProductos'>$razonSocialCliente</td> <td rowspan='$numProductos'>$tipoPedido</td> <td rowspan='$numProductos'>$nombreEmpleado</td> <td rowspan='$numProductos'>$estadoPedido</td> <td rowspan='$numProductos'>$fechaPedido</td> <td>{$descripcionProductos[0]}</td> <td>{$cantidadProductos[0]}</td> "; $primerProductoPrecio = obtenerPrecioProductoPedido($codigoPedido, $descripcionProductos[0]); echo " <td>$primerProductoPrecio</td> <td rowspan='$numProductos'> <a href='borrarPedido.php?id=$codigoPedido' onclick='return test_click();' class='btn btn-danger'><i class='fas fa-user-minus'></i></a> <a href='actualizarPedido.php?id=$codigoPedido' class='btn btn-info'><i class='fas fa-pen'></i></a> <a href='agregarremito.php?id=$codigoPedido' class='btn btn-info'><i class='fas fa-bars'></i></a> </td> </tr> "; for ($i = 1; $i < $numProductos; $i++) { echo " <tr> <td>{$descripcionProductos[$i]}</td> <td>{$cantidadProductos[$i]}</td> "; $productoPrecio = obtenerPrecioProductoPedido($codigoPedido, $descripcionProductos[$i]); echo " <td>$productoPrecio</td> </tr> "; } } echo "</tbody>"; Now - what is the problem here?
  20. 1 - Stop using multiple php tags - on and off. When you have to echo out stuff you don't need to leave php mode unless it is a whole lot of html code. If your script is well-organized you shouldn't need to do it ever. 2 - Be careful with your use of braces. Personally I always place them on a line by themselves so that they are clear and the code is easily scanned. You have an error already in this sample of your 'new' code. 3 - When posting code here be sure to open the code window using the <> icon at the top of the window so that the code sticks out in the forum like my sample did for you.
  21. Place your test logic inside the loop - if there is one. You should test the # of rows returned and if it is not 1, you have a problem. If it is only 1, then you can simply do a single fetch and use the returned value in your remaining logic.
  22. Here is another way of writing this $User = current_user(); // I assume this 'current_user function is something you wrote $sql = 'SELECT fk_usertypes_id FROM users WHERE email=:User'; $statement = db()->prepare($sql); $parms = array('User'=>$User); if (!$statement->execute($parms)) { echo "Query did not run"; exit(); } // You probably don't need a loop here, but here you go while($row = $statement->fetch(PDO::FETCH_ASSOC)) { echo "UserType " . $row['fk_usertypes_id'] . '</br>'; } // this code makes no sense since you are not in the loop here. /* if ($bob == 1) echo "Hello 1"; else echo "Hello 2"; */ echo "<p><a href='index.php'>Home</a></p>"; view('footer'); // I HAVE NO IDEA WHAT "view" IS SUPPOSED TO DO FOR YOU Made some changes to your use of PDO and the way your query results are being processed. Of course, as already mentioned, you probably only have one results row since the email should be unique (perhaps). And I'm assuming that 'bob' is representing the sole result value, the usertype id, hence I left it out.
  23. Show us your new line of code then
  24. And you should show us the exact line of code that you are adding as well as where you put it.
  25. Not familiar with Bootstrap but since all I see here is an attempt to use a CSS(?) class to do your formatting. If that is what you are using, how about showing us the CSS?
×
×
  • 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.