File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
examples/official-site/sqlpage/migrations Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -26,17 +26,18 @@ select
2626from products;
2727```
2828
29- Using `sqlpage.link` is better than manually constructing the URL with `CONCAT(' ' product?product_name=' ' , name)`,
30- because it ensures that the URL is properly encoded.
31- The former works when the product name contains special characters like `&`, while the latter would break the URL.
32-
3329In `product.sql`, you can then use `$product_name` to get the name of the product from the URL parameter:
3430
3531```sql
36- select ' ' text' ' as component;
37- select CONCAT(' ' Product: ' ' , $product_name) as contents;
32+ select ' ' hero' ' as component, $product_name as title, product_info as description
33+ from products
34+ where name = $product_name;
3835```
3936
37+ > You could also have manually constructed the URL with `CONCAT(' ' product?product_name=' ' , name)`,
38+ > but using `sqlpage.link` is better because it ensures that the URL is properly encoded.
39+ > `sqlpage.link` will work even if the product name contains special characters like `&`, while `CONCAT(...)` would break the URL.
40+
4041### Parameters
4142 - `file` (TEXT): The name of the SQLPage file to link to.
4243 - `parameters` (JSON): The parameters to pass to the linked file.
You can’t perform that action at this time.
0 commit comments