Jump to content

darksniperx

Members
  • Posts

    113
  • Joined

  • Last visited

    Never

Posts posted by darksniperx

  1. Hello,

     

    I run the query(stored procedure) in mssql query analyser , everything works and I get an output. When I run the same code in php and I do print_r, I get rownum => -1. Maybe I need to turn on some features in pear mdb2 so that I could see the results from running a stored procedure.

     

    $qry = $mdb2->query("SET ANSI_NULLS ON; EXEC GetItems @item='1', @page=2");
    

     

    print_r($qry);
    
    [rownum] => -1
        [types] => Array
            (
            )
    
        [values] => Array
            (
            )
    

     

    Update:

     

    If i run a regular select * from table, I get results in php no problem.

  2. Hello,

     

    I run the query(stored procedure) in mssql query analyser , everything works and I get an output. When I run the same code in php and I do print_r, I get rownum => -1. Maybe I need to turn on some features in pear mdb2 so that I could see the results from running a stored procedure.

     

    $qry = $mdb2->query("SET ANSI_NULLS ON; EXEC GetItems @item='1', @page=2");
    

     

    print_r($qry);
    
    [rownum] => -1
        [types] => Array
            (
            )
    
        [values] => Array
            (
            )
    

     

  3. Oh yeah... I just remember that for some reason, GO has to be on it's own line.

     

     

    You could try:

     

     

    $sth =& $mdb2->func->executeStoredProc("SET ANSI_NULLS ON\nGO\n exec GetItems", $bindvars);

    Gives the same error.

    But I just noticed that you're using executeStoredProc.  SET isn't a store procedure, so you should probably just run it in a normal query.  Also, some interfaces don't allow multiple queries in one go, so MDB2 might be like that.

     

     

    So, you could try:

     

    $mdb2->query("SET ANSI_NULLS ON;");

    $mdb2->executeStoredProc("GetItems;", $items);

     

    I get the error which requests ansi_null to be turned on

     

    [Native message: Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.] 
    

  4. I have pear mdb2 module installed on my php sandbox.

     

    I am trying to run a stored procedure and cant get it to work. I get a blank page. The stored procedure it self is fine, since I can use it in sql query analyser.

     

    I have searched the net and found the following code.

     

    <?php
    require_once 'MDB2.php';
    
    $dsn = array(
        'phptype'  => 'mssql',
        'username' => $_POST['user'],
        'password' => $_POST['pass'],
        'hostspec' => $_POST['host'],
        'database' => $_POST['db'],
    );
    
    $options = array(
        'debug'       => 2,
        'portability' => MDB2_PORTABILITY_ALL,
    );
    
    
    $mdb2 =& MDB2::connect($dsn, $options);
    if (PEAR::isError($mdb2)) {
        die($mdb2->getMessage(). ', ' . $mdb2->getDebugInfo());
    }
    
    echo "Connected!";
    
    $sth = $mdb2->prepare("exec getItem") or die($sth->getMessage(). ', ' . $sth->getDebugInfo());
    
      
    $bindvars = array("id" => 'a123',
    			"count" => 8,
    			"location" => 'system');
    $res=$mdb2->execute($sth,$bindvars)or die($res->getMessage(). ', ' . $res->getDebugInfo());
    $result=$res->fetchRow()[0];
    echo $result;
    
    ?>
    

     

    I can connect to db without any issues, I just cant run the stored procedure.

     

    Thank you!

  5. I have 2 tables in my database, hourlyUpdates and archiveUpdates. I would like to create a php script that would cut the data from hourlyUpdates table and append it to archiveUpdates table. The main question is how can I cut the data to be sure that i have removed only exactly what was select statment. For example, hourlyUpdates table has data a,b,c I append the data to archiveUpdates, by the time append has finished hourlyUpdates  has a,b,c,d data. When I remove the data I need to be that I remove only what I have copied.

  6. Dont know if I am in the right section, But I am trying to use phpDoc to generate documents. And phpdoc ignores my code.

     

    <?php
      /**
       * Location Support Page
       *
       * Form that allows users to bypass validation
       * @author Dev Team <devteam@devteam>
       * @version $Id: byPass.php,v 1.0 2008/03/13 13:38:27 cellog Exp $;
       * @package byPass
       */
      
      /**
       * Stores search results.
       * @var string
       * @name $result
       */
      $result = '';
      
      /**
       * @var string
       * @internal Stores sql connection for server A
       */
      $connection = mysql_connect();
    
    ?>
    

     

    OUTPUT:

     

    Description:

     

    Location Support Page

     

     

    Form that allows users to bypass validation

     

     

    author: Dev Team <devteam@devteam>

    version: $Id: byPass.php,v 1.0 2008/03/13 13:38:27 cellog Exp $;

     

     

    php doc ignores all of my @var,@internal,@name,.. tags. Any ideas?

     

     

  7. Query failed
    Resource id #18
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #18' at line 1
    

     

    $result_a = mysql_query("SELECT * FROM authortoperson WHERE feed_id = '$feed_id' AND entry_id = 0 ");
    	//test code
    	if ($sql = mysql_query($result_a)) 
    	{
    		// query was successfull.
    		if (mysql_num_rows($result_a)) 
    		{
    	  	// rows were found, fetch array and display result.
    		} 
    		else 
    		{
    	  		echo "No rows found";
    		}
        } 
    	else 
    	{
    		echo "Query failed<br />$result_a<br />" . mysql_error() ."<br />";
        }
    

     

    give me the error message above, cant figure out why, any hints would be helpful!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.