You are here: Re: PHP 5.2 and Mysql « PHP Programming Language « IT news, forums, messages
Re: PHP 5.2 and Mysql

Posted by Jerry Stuckle on 11/21/06 21:23

eholz1 wrote:
> Hello Again,
>
> Thanks for checking my post. Well, as to errors - I am not getting
> any. I will double check the php page that is supposed to access the
> db.
> I do a "SELECT * FROM pet" and display about 10 records. I will double
> check to see if I do any error checking, etc.
>
> Below is the php code to connect to the database:
> <table class="maintable" border=1>
> <tr class="rowbar"><th>Pet Name</th><th>Owner</th><th>Pet
> Type</th><th>Gender</th><th>Date of Birth</th></tr>
> <?php
> // connect
> require_once('DB.php');
> $db = DB::connect("mysql://abc:password@myserver/menagerie");
> $dbhost = 'myserver';
> $dbuser = 'abc';
> $dbpass = 'password';
>
> if (DB::iserror($db))
> die($db->getMessage());
> //else
> // echo 'Congratulatons! Connected to Database!<br></br>';
>
> ?><!--center-->
> <?php
> $sql = "SELECT * FROM pet";
> $q = $db->query($sql);
> if (DB::iserror($q)) {
> die($db->getMessage());
> }
>
> // generate the table
> while ($q->fetchInto($row)) {
> ?>
> <tr>
> <td><?= $row[0] ?></td>
> <td><?= $row[1] ?></td>
> <td><?= $row[2] ?></td>
> <td><?= $row[3] ?></td>
> <td><?= $row[4] ?></td>
> </tr>
> <?php }
> ?>
> </table></center>
>
> This code works fine when I am running the older Apache (2.0), and PHP
> 4.3.9.
>
> Thanks,
>
> eric
>

One other thought. Do you get anything if you add the following to the
start of your PHP code?

error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация