Hi all, I need someone to help me out, I am trying to call a .php file
with php variables -

include('Code.php?buyer='.$lastid.'&oid='.$oid.'&bid='.$bid.'');

when i edit the url myself using values from the database it works like it should do.
but when I am calling the php file using include, i am not seeing the results I am expecting.

I would appreciate some pointers in the right direction please.

You could not use the $_GET variables into the include funtion. You can get it done by the following method...

$_GET = array();
$_GET['buyer'] = $lastid;
$_GET['oid'] = $oid;
$_GET['bid'] = $bid;
include('Code.php');

Ways to set $_GET variables into local includes.

Member Avatar for diafol
include('Code.php?buyer='.$lastid.'&oid='.$oid.'&bid='.$bid.'');

DO you really have to have them in GET?

$lastid = ... (could be from a previous $_GET)
$oid = ...
$bid = ...

include("code.php");

You could even pass on previous $_GETs

//assume $_GET['buyer'] etc exists already from url
include("code.php");

Hi gents thanks for your help, I have tried everything that has been suggested but I am still getting an error.

I am trying to use the lastid from a mysql database

$result = @mysql_query($qry);
        //
        //        //get last auto id
        $lastid = mysql_insert_id ();

        //Check whether the query was successful or not
        if($lastid > 0)
        {
           
		 $_GET = array();
		 $_GET['last'] = '$lastid';
		 $_GET['oid'] = '$oid';
		 $_GET['bid'] = '$bid';
         	 include("Code.php");		
		  print "updating";
		 	
		  //<img src='images/loadingsms.gif'>
		 
		   
	}

any ideas why this would still not be working....its driving me mad

Member Avatar for diafol
$_GET = array();
$_GET['last'] = '$lastid';
$_GET['oid'] = '$oid';
$_GET['bid'] = '$bid';

won't work as you're trying to place a literal $lastid inside a single quote. Use double quotes if this is the way you have to do it. persoanlly, I'd leave off the quotes altogether.

Hi Ardav, thanks for helping out :)

Iv got it working now thanks for your help again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.