Hi all, Im designing a database to go with my website project and going through the php for dummies book but I have an error and cannot figure it out. I paste my code in
<?php
/*
Config file
@author Imran Rashid
*/
// global variables
$base_url = "http://localhost/petstore/";
$base_path = "/xampplite/htdocs/petstore/";
// database stuff
$host="localhost";
$user="root";
$password="tenchu";
$dbname = "pets";
//firstmethod
$cxn = mysqli_connect($host,$user,$password) or die("could not connect to database");
// now connection2 is set up, select the database
mysqli_select_db($cxn, $dbname);
//$cxn = mysqli_connect($host, $user,$password,$php_blog)
//or die ("could not connect server");
?>
Thats my config file for my connection variables
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pet Catalog</title>
</head>
<?php
/* Program: getPets.php
* Desc: Displays list of items from a database
*/
require_once("config.php");
function getPetInfo($petName)
$petInfo = getPetInfo("Unicorn"); //call function
$f_price = number_format($petInfo ['price'] ,2);
echo"<p><b>{$petInfo['petName']}</b><br />\n
Description:{$petInfo['petDescription']}<br />\n
Price: \${$petInfo['price']}\n"
?>
<body>
</body>
</html>
and thats my file im working on
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\petstore\getdata.php on line 37
this displays error, im new to this forum and new to php and programming is my weak point, so hopefully you guys can go easy on me as I could pester you a lot of the times
thanks