Article View: be.comp.programming
Article #9828Re: <? Tabel genereren, hoe? ?>
From: webmasterATarea32PUNTbe Area32
Date: Tue, 02 Apr 2002 17:38
Date: Tue, 02 Apr 2002 17:38
158 lines
4118 bytes
4118 bytes
Ik heb jou class eens geprobeerd, ik kreeg
2 fouten:
Warning: Supplied argument is not a valid MySQL result resource in
C:\apache\htdocs\mysql.php on line 25
Warning: Supplied argument is not a valid MySQL result resource in
C:\apache\htdocs\mysql.php on line 34
Dit is mijn code met jou aanpassingen:
<?
include("config.inc.php");
include("functies.inc.php");
jumpbox_cat();
if($categorie){
?>
<table width="100%">
<?php
include ('mysql.php');
$dbconn = new mySQL;
$dbstmt = "SELECT kaarten.col1, kaarten.col2,
kaarten.col3 FROM kaarten ";
$dbres = $dbconn->RecordSet($dbstmt);
$count = $dbconn->RecordCount($dbres);
$dbdata = $dbconn->GetRows($dbres);
for ($i = 0; $i < $count; $i++):
?>
<tr>
<td><?php echo $dbdata[$i]['col1']; ?></td>
<td><?php echo $dbdata[$i]['col2']; ?></td>
<td><?php echo $dbdata[$i]['col3']; ?></td>
</tr>
<?php endfor; ?>
</table>
<?
}
else {
echo "<br><strong>Er werd geen categorie
geselecteerd.</strong>";
}
?>
Hopelijk raak je er wijs uit....
Op Tue, 02 Apr 2002 13:42:45 GMT, Philip Paeps <philip@paeps.cx>
schreef:
> Area32 <webmasterATarea32PUNTbe> wrote:
> > Ik probeerde het met een functie maar hoe meer ik probeerde hoe meer
> > fouten ik krijg :-(
>
> Probeer eens met mijn class:
>
> class mySQL
> {
> var $dbname = "database"; // database name
> var $dbhost = "hostname"; // mySQL server
> var $dbuser = "user"; // user for conn
> var $dbpass = "password"; // users' pass
>
> // Executes a query and returns the recordset
> function RecordSet($SQL)
> {
> $link = mysql_connect($this->dbhost, $this->dbuser, $this->dbpass);
> mysql_select_db($this->dbname);
>
> $rs = mysql_query($SQL);
>
> return $rs;
>
> $this->DBClose($link);
> }
>
> // Counts the number of rows in a recordset
> function RecordCount($rs)
> {
> return mysql_num_rows($rs);
> }
>
> // Returns a 2D associative array of rows
> function GetRows($rs)
> {
> $arr = array();
> $counter = 0;
>
> while ($row = mysql_fetch_array($rs))
> {
> $arr[$counter] = $row;
> $counter++;
> }
>
> return $arr;
> }
>
> // Close the database connection
> function DBClose($link)
> {
> mysql_close($link);
> }
>
> // Print an error
> function Status()
> {
> $errno = mysql_errno();
> $error = mysql_error();
>
> return "($errno)<br/>$error";
> }
> }
>
> Hier nooit last mee,
>
> Wat voor errors krijg je zoal?
>
> - Philip
>
> --
> Philip Paeps philip@paeps.cx
>
> You sure have to borrow a lot of money these days to
> be an average consumer.
*********************
http://www.area32.be/
*********************
Technical Details
Message-ID:
<3ca9eb50.28637116@news.skynet.be>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!195.40.4.120.MISMATCH!easynet-quince!easynet.net!proxad.net!proxad.net!skynet.be!skynet.be!louie!not-for-mailReferences:
<3ca96e59.6467148@news.skynet.be> <LEgq8.44267$DE4.6005@afrodite.telenet-ops.be> <3ca9ae47.13009807@news.skynet.be> <pziq8.44524$DE4.6013@afrodite.telenet-ops.be>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,b7c233b1ef59c2b9 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2002-04-02 09:54:09 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!195.40.4.120.MISMATCH!easynet-quince!easynet.net!proxad.net!proxad.net!skynet.be!skynet.be!louie!not-for-mail From: webmasterATarea32PUNTbe (Area32) Newsgroups: be.comp.programming Subject: Re: <? Tabel genereren, hoe? ?> Date: Tue, 02 Apr 2002 17:38:20 GMT Organization: Area32.be Reply-To: webmasterATarea32PUNTbe Message-ID: <3ca9eb50.28637116@news.skynet.be> References: <3ca96e59.6467148@news.skynet.be> <LEgq8.44267$DE4.6005@afrodite.telenet-ops.be> <3ca9ae47.13009807@news.skynet.be> <pziq8.44524$DE4.6013@afrodite.telenet-ops.be> X-Newsreader: Forte Free Agent 1.21/32.243 Lines: 159 NNTP-Posting-Host: 217.136.93.11 X-Trace: 1017769943 reader0.news.skynet.be 264 217.136.93.11 X-Complaints-To: abuse@skynet.be