Documentation Index
Fetch the complete documentation index at: https://mintlify.com/wreyesus/Sencillo_Carrito_de_Compras_en_PHP/llms.txt
Use this file to discover all available pages before exploring further.
detalles.php is the single-product view page for the YUME|TEC store. It receives a product identifier via the id_producto GET parameter, uses the Dreamweaver-generated GetSQLValueString helper to safely cast the value to an integer, and then runs a SELECT against the productos table to fetch the matching row. The page then renders the product’s full name, multi-line description, and a large detail image, alongside an Add to Cart form that POSTs directly to carrito.php.
URL and parameters
Every product in the catalog links here from both the category listing pages and the thumbnail images. The only required parameter isid_producto:
productos.id_producto primary key column in the database. If no id_producto is present in $_GET, the script defaults $colname_detalle_proce to "-1", which returns no rows and renders an empty detail layout.
Database query
The product lookup is handled through the DreamweaverGetSQLValueString utility, which casts the raw GET value to an integer before it is spliced into the query string:
mysql_fetch_assoc returns the first (and only expected) row as an associative array keyed by column name. All subsequent output on the page is drawn from $row_detalle_proce.
Displayed fields
The detail layout is built as a single-column HTML table with four rows, one for each piece of displayed data:| Field | Column in productos | Notes |
|---|---|---|
nombre | nombre | Displayed as a paragraph inside .producto_titulo |
descripcion | descripcion | Passed through nl2br() so line breaks render in the browser |
imagen | imagen | Loaded from imagenes/productos/detalle/ at 200 × 200 px |
precio | precio | Embedded as a hidden field in the Add to Cart form |
nl2br is important because product descriptions stored in bd.sql use plain newline characters (\n) to separate specification lines. Without it, all specs would appear on a single line in the browser.
Add to Cart form
The purchase button at the top of the detail table is an<input type="image"> element, which submits the form on click just like a standard submit button. Three hidden fields carry the product data to carrito.php:
1 on the first add. Once the item appears in the cart (carrito.php), the shopper can adjust the quantity or remove the item from there. Note that nombre and precio — not id_producto — are what get posted to the cart; the cart therefore stores product names and prices directly rather than looking them up again by ID.
GetSQLValueString helper
GetSQLValueString is a Dreamweaver-generated utility function defined inline at the top of detalles.php (and each category listing page). It performs two jobs: it strips magic-quote escaping when the PHP version is below 6, and it normalises and type-casts the value before injection into a query string.
"int" type used in detalles.php, the function calls intval() on the value, which means any non-numeric input (including SQL injection strings) evaluates to 0 rather than being executed. An empty string produces the literal NULL.