By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Another Mysql problem. (This Time it is not so dumb)

P: n/a
Hi, me again ;-)
So i have this code:

<?php
$db = new db();
$sql = "SELECT id FROM contentobject_attribute WHERE contentobject_id=2
AND contentclassattribute_id=1";
$result = $db->query($sql);
while ($row = $result->fetch_assoc()) {
$result2 = $db->query("SELECT * FROM contentclass");
$version = $result2->fetch_assoc();
echo var_dump($version)."<br />";
}

class db {
private $mysqli;
private $result;

function __construct() {
$this->mysqli = new mysqli("host", "user", "pass", "db");
}

function query($Query_String) {
if ($Query_String == "")
return 0;

// New query, discard previous result.
if ($this->result) {
$this->free();
}

$this->result = $this->mysqli->query($Query_String);
// Will return nada if it fails. That's fine.
return $this->result;
}

function free() {
$this->result->close();
}
}
?>

Try to run it and you get an warning. Now if i replace the free() method
with the following:

function free() {
$this->result->free;
}
everything works as expected. But if i try to use this in my app, apache
segfaults. Wanted to issue an Bug report, but cant reproduce it in an
small example.
So what can i do? Perhaps a small redesign of the class?
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Now if i replace the free() method
with the following:

function free() {
$this->result->free;
}
everything works as expected. But if i try to use this in my app, apache
segfaults. Wanted to issue an Bug report, but cant reproduce it in an
small example.

Just forget that crap!
Jul 17 '05 #2

P: n/a
Just forget the whole question.

Have a nice day
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.