php problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Helpers,

here are the 2 files I cannot make work. I have installed php in c:\php, my php.ini file is in Windows directory and my path to pear reads "include_path 
= .;C:\php\pear" in the phpinfo.php output.

I have switched on error reporting and have received the following error 
messages:

a.) PHP Fatal error:  main() [<a 
href='function.require'>function.require</a>]: Failed opening required 
'DB.php' (include_path='C:\php\pear') in C:\sambar64\docs\BondMovies.php on line 11

b.)PHP Parse error:  syntax error, unexpected ';' in 
C:\sambar64\docs\ButtonMaker.php on line 17

BondMovies.php

<html><head><title>Bond Movies</title></head>
<body>

<table border=1>
<tr><th>Movie</th><th>Year</th><th>Actor</th></tr>

<?php

//connect

require_once('DB.php');
$db = DB::connect("MySql://root:lithos@localhost/Bond");
if (DB::iserror($db)) {

die($db->getmessage("You didn't connect this time"));

}

// issue the query

$sql = "SELECT FROM Bond.title,movies.year,actors.name
FROM movies, actors
WHERE movies.actors=actors.id
ORDER by movies.year ASC";

$q = $db->query($sql);

if (DB::iserror($q)) {

die($q->getMessage("Your query failed!"));

}

// generate the table

while ($q->fetchInto($row)) {
?>
<tr><td><?= $row[0] ?></td>
<td><?= $row[1] ?></td>
<td><?= $row[2] ?></td>
</tr>
<?php
}
?>

ButtonMaker.php

<?php

if (isset($_GET['message'])) {

//load font and image, calculate width of text

$font = 'times';
$size = 12;
$im = ImageCreateFromPNG('button.png');
$tsize = imagettfbbox($size,0,$font,$_GET['message']);

//centre

$dx = abs($tsize[2]-$tsize[0]);
$dy = abs($tsize[5]-$tsize[3]);
$x = ( imagesX($im) - $dx ) / 2;
$y = ( imagesy($im) - $dy / 2 + $dy;

//draw text

$black = ImageColorAllocate($im,0,0,0);
ImageTTFText($im, $size, 0, $x, $y, $black, $font, $_GET['message']);

//return image

header('Content-type: image/png');
ImagePNG($im);
exit;
}
?>
<html>
<head><title>Button Form</title></head>
<body>

<form action= "<?=PHP_SELF ?>" method="GET">
Enter message to appear on button:
<input type="text" name="message" /><br />
<input type="submit" value="Create Button" /> </form>
</body> 

All I get is the html output in "Bond Movies" and no output from "ButtonMaker". 
Any ideas?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux