0

hi i am having a problem with a php script. i have 3 files index.php, home.html.php, form.html.php.
home.html.php is working fine, if has a form that is submitting fine but when it submits i get a problem. maybe someone can help me out please i would be grateful as i am new. the is nothing wrong with anything else mysql database is running fine and there is no problem with connection.

index.php (you can ignore what is commented out)

<?php
 include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
 //$_GET['id'] is categoryid
if (isset($_GET['id']))
{
	include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';

	$id = mysqli_real_escape_string($link, $_GET['id']);
	$sql = "SELECT businessid FROM businesscategory WHERE
          categoryid LIKE '$id'";    
  $result = mysqli_query($link, $sql);
  if ($result !='')
  {
	$businessid = mysqli_fetch_array($result);
  $sql = "SELECT content FROM business WHERE
          id LIKE '$businessid'";  
  $result = mysqli_query($link, $sql);  
  }
  if ($result !='')  
  {
  $content = mysqli_fetch_array($result);
  include 'form.html.php';
	exit();
  } 
}  

/*
	// The basic SELECT statement
	$select = 'SELECT content';
	$from   = ' FROM business';
	$where  = ' WHERE TRUE';

	$id =  mysqli_real_escape_string($link, $_GET['id']);
	if ($category != '') // An owner is selected
	{
		$where .= " AND categoryid='$categoryid";
	}

	$categoryid =  mysqli_real_escape_string($link,
			$_GET['category']);
	if ($categoryid != '') // A category is selected
	{
		$from  .= ' INNER JOIN businesscategory ON id = business';
		$where .= " AND categoryid='$categoryid'";
	}

	$text = mysqli_real_escape_string($link, $_GET['text']);
	if ($text != '') // Some search text was specified
	{
		$where .= " AND content LIKE '%$text%'";
	}

	$result = mysqli_query($link, $select . $from . $where);
	if (!$result)
	{
		$error = 'Error fetching businesses.';
		include 'error.html.php';
		exit();
	}

	while ($row = mysqli_fetch_array($result))
	{
		$businesses[] = array('id' => $row['id'], 'text' => $row['content']);
	}

	include 'form.html.php';
	exit();
}  
  
  */
  
  
  
  
  
  
$result = mysqli_query($link, 'SELECT id, name FROM category ORDER BY name');
if (!$result)
{
	$error = 'Error fetching categories: ' . mysqli_error($link);
	include 'error.html.php';
	exit();
}

while ($row = mysqli_fetch_array($result))
{
	$categories[] = array('id' => $row['id'], 'text' => $row['name']);
}

include 'home.html.php';
?>

form.html.php

<?php include_once $_SERVER['DOCUMENT_ROOT'] .
		'/includes/helpers.inc.php'; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title>Business</title>
  </head>
  <body>
       it works
       <?php echo $content; ?>
  </body>
</html>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by EricIskhakov
0

you are using mysqli_*
try using mysql.
i think mysqli is for SqlLite...
not sure.

and what's the problem?
i mean u get an error, you don't get results, etc.

Edited by EricIskhakov: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.