You are here: Re: PHP4 and this function « PHP Programming Language « IT news, forums, messages
Re: PHP4 and this function

Posted by Jon on 01/23/06 22:02

On 2006-01-22 21:50:34 -0600, "Tony Marston" <tony@NOSPAM.demon.co.uk> said:

>
> "ming" <myhusky@gmail.com> wrote in message
> news:vEWAf.9838$43.6013@nnrp.ca.mci.com!nnrp1.uunet.ca...
>> I think it the -> problem. php5 class is different with php4 class
>
> No, this works in both PHP 4 and 5 as I use it all the time.
>
>> Jon wrote:
>>> function query($query, $return = false)
>>> {
>>> $fetch = mysql_query($query, $this->connection) or
>>> die2(mysql_error($this->connection));
>>> if($return)
>>> return $fetch;
>>> }
>>>
>>> mysql_error(): supplied argument is not a valid MySQL-Link resource
>>>
>>> the line that begins with $fetch is my problem. This was originally a
>>> PHP5 script that I am retrofitting.
>>> The $query is used all over, and it is really gumming things up.
>
> Ths function can only be used in an object as $this->connection refers
> to a property called $connection within the current object. Have you
> checked to see if $this->connection actually refers to a valid
> resource? Where did the previous call to mysql_connect() store its
> result?


function constructor($host, $user, $pass, $database)
{

$this->connection = mysql_connect($host, $user, $pass) or die2

This was modified from a more PHP5 compatible __constructor, and
function cnstructor allowed it to "work" apparently, but not as well as
I need it to.

jon

 

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

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