Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Posts posted by ginerjm

  1. your initial post is meaningless.

    I-m trying to do the following !! (I THINK YOU MEANT TO write I'm instead of I-m.  At least I hope you do.)
    	What is the following?  You don't say what it is you are trying to do.
    
    Listing data in the table !!
    	Listing data is a normal procedure for programmers to accomplish.  What is the problem?  You don't say.
    
    I would like....if the list has 4 rows..whetever the ID list is..make the ID list 1 2 3 4 !!
    Example.....if have a list with ID 1 3 3...make stay 1 2 3 !!
    	If you have an "ID" of some sort in your database then it should not be altered and it should be UNIQUE.  Yet - you are saying that when displayed you want the "ID" to be modified to show your records with a new consecutive list of ids that are not what your database should be showing.  WHY WOULD ANYONE DO THAT?  Maybe you need to explain in English what it is you are trying to do.

     

  2. you are not enabling php error checking or you  would  be seeing a  lot of  error messages.  Turn it on!  For example:

    $row[ID]

    is an invalid line.  Any reference to an array value  must  either be  a  php variable  or a  text  value wrapped in quotes to identify it as text or else a number.

    After that - I don't have a clue what you are trying to write.

    $row['ID']

    This is how it needs to be in your case.

  3. 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.

  4. 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.

  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. 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.

  9. 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

  10. 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?

  11. 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.

×
×
  • 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.