473,480 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
2 1425
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
Just forget the whole question.

Have a nice day
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3711
by: Dominique Javet | last post by:
Hello, I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this "newbie" question... I've found no answer in the forum ... I've a date problem with my formular. In my mysql DB...
1
2422
by: JL | last post by:
I have the following problem. I have a form created on the fly via a perl script that maintains a MySQL table. Any field that has spaces does not display properly. Only the text up to the first...
0
2750
by: Wil | last post by:
Hello I was wondering if there were any reasons why I would not want to just use MySql as a standalone server, instead of having requests brokered. The client is a java application, not applet...
0
1462
by: Massimo Fiorentino | last post by:
Hello there! I am a bit of a newbee into the mySQL world and I have a question regarding switching from one DB to another. I have for a couple of years used a very simple CMS-system created by...
2
2644
by: terence.parker | last post by:
I am often faced with the dilemma of whether to use a JOIN query across three tables in order to grab a bunch of results - or whether to create another table to represent what I want. The latter is...
102
5563
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
188
7035
by: christopher diggins | last post by:
I have posted a C# critique at http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up the following issues : - unsafe code - attributes - garbage collection -...
1
4486
by: linux | last post by:
Sorry if this is a really dumb question. I am trying to connect to our remote MySQL server (which is running just fine). I have a perl script which worked just fine on my other Fedora 4 box (all...
15
2655
by: harvey | last post by:
How do I make PHP create a database for mysql please? I can see how to make tables and I have read all the documents I can find but I don't understand how to make the database itself. All...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7061
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6763
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4503
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3015
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
574
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.