Jump to content

Help me Non-Static method DB::....


golemicata

Recommended Posts

Strict Standards: Non-static method DB::connect() should not be called statically in C:\xampp\htdocs\chaperter10\results_generic.php on line 35

 

Strict Standards: Non-static method DB::parseDSN() should not be called statically in C:\xampp\php\PEAR\DB.php on line 520

 

Strict Standards: Non-static method DB::isError() should not be called statically in C:\xampp\php\PEAR\DB.php on line 551

 

Strict Standards: Non-static method DB::isError() should not be called statically in C:\xampp\php\PEAR\DB.php on line 557

 

Strict Standards: Non-static method DB::isError() should not be called statically in C:\xampp\htdocs\chaperter10\results_generic.php on line 38

 

Strict Standards: Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\DB\common.php on line 2195

 

Strict Standards: Non-static method DB::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\DB\common.php on line 1217

 

Strict Standards: Non-static method DB::isError() should not be called statically in C:\xampp\htdocs\chaperter10\results_generic.php on line 48

 

1. ItemType: t-shirt

size: L

Price: 5.00

 

 

 

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

  <title>xxx</title>

</head>

<body>

<h1>xxx</h1>

<?php

  // create short variable names

  $searchtype=$_POST['searchtype'];

  $searchterm=$_POST['searchterm'];

 

  $searchterm= trim($searchterm);

 

  if (!$searchtype || !$searchterm)

  {

    echo 'You have not entered search details.  Please go back and try again.';

    exit;

  }

 

  $searchtype = addslashes($searchtype);

  $searchterm = addslashes($searchterm);

 

  // set up for using PEAR DB

  require('DB.php');

  $user = 'xx';

  $pass = 'xx';

  $host = 'localhost';

    $db_name = 'xxx';

 

  // set up universal connection string or DSN

  $dsn = "mysql://$user:$pass@$host/$db_name";

 

  // connect to database

  $db = DB::connect($dsn, true);

 

  // check if connection worked

  if (DB::isError($db))

  {   

    echo $db->getMessage();

    exit;

  }

 

  // perform query

  $query = "select * from item where ".$searchtype." like '%".$searchterm."%'";

  $result = $db->query($query);

  // check that result was ok

  if (DB::isError($result))

  {

    echo $db->getMessage();

    exit;

  }

 

  // get number of returned rows

  $num_results = $result->numRows();

 

  // display each returned row

  for ($i=0; $i <$num_results; $i++)

  {

    $row = $result->fetchRow(DB_FETCHMODE_ASSOC);

    echo '<p><strong>'.($i+1).'. ItemType: ';

    echo htmlspecialchars(stripslashes($row['ItemType']));

    echo '</strong><br />size: ';

    echo stripslashes($row['size']);

    echo '<br />Price: ';

    echo stripslashes($row['price']);

    echo '</p>';

  }

 

  // disconnect from database

  $db->disconnect();

  ?>

 

</body>

</html>

 

:(

 

Can you help me?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.