Sure change this code:
$querya = "SELECT $pageid FROM pagecounter";
$exec = MYSQL_QUERY($querya);
$oldvalue = $exec;
$newvalue = $oldvalue+1;
To:
$querya = "SELECT $pageid FROM pagecounter";
<b>$result</b> = MYSQL_QUERY($querya);
<b>$oldvalue = mysql_fetch_row($result);
$newvalue = $oldvalue[0]+1;</b>
That will get your row that is fetched, and put the data into the array $oldvalue, then you take the value at position 0 (the first value) and add 1 to it and put it in your variable $newvalue.
But instead you should change the way your table is laid out so that you have a cleaner set of code, something like this.
create table pagecounter(
page_id int not null auto_increment primary key,
name varchar(255),
page_count int);
Then fill this table with all of the names of your pages (this way if you add a new page you don't have to change the table, just add a new record).
Now you can change your queries to this:
select page_id, page_count from pagecounter where name = '$pageid';
and
update pagecounter set page_count = $newvalue where page_id = $page_id;
Using the field page_id as an auto incrementing primary key will give you an indexed unique ID for each record in your table executing your queries faster when you use the page_id. If you used page_id instead of name in your select query you'd get even better performance.
This type of setup is why you have a database, the setup you were using doesn't get you any benefits, other that using SQL.