when I use this:
Failed opening required 'diggstyle_code.php?page=1' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\4ajax\gallery_core.php on line 198
include) will open the file corresponding to the path/name they receive.
Which means that, with your code, you would have to have, on your disk, a file called
diggstyle_code.php?page=1 -- it's obviously not the case, so it fails.
Quoting the Variable scope page of the PHP manual :
The scope of a variable is the context within which it is defined.
For the most part all PHP variables only have a single scope.
This single scope spans included and required files as well.
So, in your case, you do not need to pass the variable : if you have a variable in your current script, it will also exist in the script you include.
(Outside of functions, of course, which have their own scope)
So, in your main script, you should have :
$page_no = 10; require 'diggstyle_code.php';
echo $page_no; // Or work with $page_no the way you have to
Remember that including/requiring a file is exactly the same as copy-pasting its content at the line it's required.