PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 20, 2022

[FIXED] Return data from mysql where value equals URI

 January 20, 2022     mysql, mysqli, php, phpmyadmin     No comments   

Issue

I'm trying to return a row from my database however, when I replace the page='url' with $filePath = $_SERVER["REQUEST_URI"]; page='.$filePath.' it returns nothing.

I'm assuming the answer is simple however, I can't see to find the solution.

Full Code

$filePath = $_SERVER["REQUEST_URI"];

$query = "SELECT * FROM Meta WHERE page=' . $filePath . '";
$result = mysqli_query($connection, $query);

while ($row = mysqli_fetch_assoc($result)) { ?>
  <title><?php echo $row["title"]; ?></title>
<?php } ?>

Solution

try the query like this

$query = "SELECT * FROM Meta WHERE page = '" . $filePath  . "' ";


Answered By - samehanwar
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing