L
L
LordPrimes2018-02-23 14:44:15
PHP
LordPrimes, 2018-02-23 14:44:15

How to fix a GET request?

Good afternoon. There is such a code

$id = $_GET['id'];
$query = "SELECT * FROM products WHERE products_id='$id'  ";
$result = $conn->query($query); 
if (mysqli_num_rows($result) > 0 ){
$row = mysqli_fetch_array($result);
$row['image']!="" && file_exists("resources/tovarimages/".$row["image"]);
$img_path ='resources/tovarimages/'.$row["image"];
$maxwidth = 300;
$maxheight = 550;
list($width,$height) = getimagesize($img_path);
$rheight = $maxheight/$height;
$rwidth = $maxwidth/$width;
$ratio = min($rheight,$rwidth);
$width = intval($ratio*$width);
$height = intval($ratio*$height);       

     
   
 }
var_dump($id) ;

The problem is that when checking, it gives such a string(12) "view_content" value, although view_content?id=2 is passed in the url line of the id of a separate page. If I set before $id = $_GET['id'] request $id = 2; it will give me the value of this id. As I understand it, the request after the question mark is not transmitted to me. How can I fix this?
htaccess file code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?id=$1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2018-02-23
@VladimirAndreev

RewriteRule ^(.*)$ index.php?$1 [L,QSA]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question