# The requested \<URL path\>'.$\_SERVER\['PHP\_SELF'\].' was not found on this server

**URL:** <https://www.phphelp.com/t/the-requested-url-path-server-php-self-was-not-found-on-this-server/22512>\
**Category:** General PHP Help\
**Created:** [April 14, 2014, 9:03pm UTC](https://www.phphelp.com/t/the-requested-url-path-server-php-self-was-not-found-on-this-server/22512 "2014-04-14T21:03:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://www.phphelp.com/uploads/default/original/2X/2/243e9ed5d93c5653ce3186f18df16e019ce38445.png) [@system](https://www.phphelp.com/u/system)\
**Post date:** [April 14, 2014, 9:03pm UTC](https://www.phphelp.com/t/the-requested-url-path-server-php-self-was-not-found-on-this-server/22512/1 "2014-04-14T21:03:03Z")

</div>

Hi  
I’ve a page, index.php, which does CRUD operations and displays data from MySQL with pagination. Everything’s working fine except the “Edit” and “Delete” links in the grid table.

Here’s the code  
[php]\<?php

$connection=mysql\_connect(‘localhost’,‘root’,’’) or die(mysql\_error());  
mysql\_select\_db(‘test1’,$connection) or die(mysql\_error());

//displaying 5 results per page  
$per\_page = 5;  
//number of adjacent links to show left and right of the current page.  
$adjacents = 5;

//execute a mysql query to retrieve count of total users in table  
$pages\_query = mysql\_query(“SELECT COUNT(‘id’) FROM users”) or die(mysql\_error());

//get total number of pages to be shown from total result  
$pages = ceil(mysql\_result($pages\_query, 0) / $per\_page);

//get current page from URL ,if not present set it to 1  
$page = (isset($\_GET[‘page’])) ? (int)$\_GET[‘page’] : 1 ;

//calculate actual start page with respect to Mysql  
$start = ($page - 1) \* $per\_page;

//execute a mysql query to retrieve all result from current page by using LIMIT keyword in mysql  
$query = mysql\_query(“SELECT \* FROM users order by id DESC LIMIT $start, $per\_page”) or die(mysql\_error());

// @@@@@@@@@@@@@@@@@@@@@ Pagination starts here @@@@@@@@@@@@@@@@@@@@@@@

//store pagination result in a string so that we can place any where in page.  
$pagination="";

//if current page is first show first only else reduce 1 by current page  
$Prev\_Page = ($page==1)?1:$page - 1;

//if current page is last show last only else add 1 to current page  
$Next\_Page = ($page\>=$pages)?$page:$page + 1;

//if we are not on first page show first link  
if($page!=1) $pagination.= ‘First’;

//if we are not on first page show previous link  
if($page!=1) $pagination.=’`<<`Previous’;

//we are going to display 5 links on pagination bar  
$numberoflinks=5;

//find the number of links to show on right of current page  
$upage=ceil(($page)/$numberoflinks)\*$numberoflinks;

//find the number of links to show on left of current page  
$lpage=floor(($page)/$numberoflinks)\*$numberoflinks;

//if number of links on left of current page are zero we start from 1  
$lpage=($lpage==0)?1:$lpage;

//find the number of links to show on right of current page and make sure it must be less than total number of pages  
$upage=($lpage==$upage)?$upage+$numberoflinks:$upage;  
if($upage\>$pages)$upage=($pages-1);

//start building links from left to right of current page  
for($x=$lpage; $x\<=$upage; $x++){

//if current building link is current page we don’t show link,we show as text else we show as linkn   
$pagination.=($x == $page) ? ’ **‘.$x.’** ’ : ’ ‘.$x.’’ ;  
}

//we show next link and last link if user doesn’t on last page  
if($page!=$pages) $pagination.= ’ Next\>\>’;  
if($page!=$pages) $pagination.= ’ Last’;

//display final pagination bar.  
?\>

\<?php //while we going through each row we display info while($row = mysql\_fetch\_object($query)){ ?\> \<?php } ?\>

| Id | First Name | Last Name | Created | Edit/Delete |
| \<?php echo $row-\>id; //row id ?\> | \<?php echo $row-\>fname; // row first name ?\> | \<?php echo $row-\>lname; //row las tname ?\> | \<?php echo $row-\>created; //row created time ?\> | Edit | Delete  
 |

\<?php echo $pagination; ?\>
[/php]

“edit” and “delete” is in separate files, but these files are included in index.php page  
When edit and delete are run separately they work fine, but when i include then in index.php  
the links “Edit” and “Delete” show

“The requested ‘.$\_SERVER[‘PHP\_SELF’].’ was not found on this server” error

What am I doing wrong? Kindly help!

Thanks  
Naz

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [April 14, 2014, 11:56pm UTC](https://www.phphelp.com/t/the-requested-url-path-server-php-self-was-not-found-on-this-server/22512/2 "2014-04-14T23:56:13Z")

</div>

Unless I am missing something, your error is because you are using Php variables outside of Php code tags.
