PHP and MYSQL

PHP and MYSQL

am 02.05.2007 03:13:40 von Na Derro Cartwright

------=_NextPart_000_0012_01C78C35.981D4980
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Can PHP 4 work with MYSQL 5?

------=_NextPart_000_0012_01C78C35.981D4980--

Re: PHP and MYSQL

am 02.05.2007 03:30:03 von dmagick

Na Derro Cartwright wrote:
> Can PHP 4 work with MYSQL 5?

Yep.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP and MYSQL

am 02.05.2007 04:25:48 von dmagick

Na Derro Cartwright wrote:
> I am currently running php4 with mysql 5. when I try to run a query
> using the mysql command I recieve and error that reads the resource id
> and a number. What does that mean?

Firstly always cc the list - others will be able to provide their input
and others will also learn from the problem/resolution.

What is the query? What is the error?

If you run it manually through command line mysql or phpmyadmin do you
get an error?

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP and MYSQL

am 02.05.2007 21:25:26 von James Gadrow

Chris wrote:
> Na Derro Cartwright wrote:
>> I am currently running php4 with mysql 5. when I try to run a query
>> using the mysql command I recieve and error that reads the resource
>> id and a number. What does that mean?
>
> Firstly always cc the list - others will be able to provide their
> input and others will also learn from the problem/resolution.
>
> What is the query? What is the error?
>
> If you run it manually through command line mysql or phpmyadmin do you
> get an error?
>
You're probably doing something like:

//Open connection and database
$handle = mysql_connect($host, $user, $pass);
mysql_select_db($database);
//Run query
$result = mysql_query("SELECT foo FROM bar");
//Close connection
mysql_close($handle);
//Show result
echo $result;

The correct way to do this is:
//Open connection and database
$handle = mysql_connect($host, $user, $pass);
mysql_select_db($database);
//Run query
$result = mysql_query("SELECT foo FROM bar");
//use resource id returned from query to fetch actual results (note that
the 0 is a line number so in the case you have more than 1 result you'll
have to use a different method such as mysql_fetch_assoc or something
I'd advise you take a look at the documentation @ php.net)
$result = mysql_result($result, 0);
//Close connection
mysql_close($handle);
//Show result
echo $result;

--
Thanks,

Jim

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP and MYSQL

am 27.05.2007 00:08:14 von Na Derro Cartwright

Chris wrote:
> Na Derro Cartwright wrote:
>> I am currently running php4 with mysql 5. when I try to run a query
>> using the mysql command I recieve and error that reads the resource
>> id and a number. What does that mean?
>
> Firstly always cc the list - others will be able to provide their
> input and others will also learn from the problem/resolution.
>
> What is the query? What is the error?
>
> If you run it manually through command line mysql or phpmyadmin do you
> get an error?
>
When I run the command from the command line I am able to connect to the
server on my local host but when I attempt to run it through PHP i get
an error message that tells me I have to upgrade my client. I am not
really sure what that means. Can someone offer assistance?

C

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP and MYSQL

am 27.05.2007 01:53:53 von Na Derro Cartwright

I am trying to simply display all the values from a simple query but I
am recieveing an error that I have to upgrade my client. I am not sure
what that means.

Chris wrote:
> Na Derro Cartwright wrote:
>> I am currently running php4 with mysql 5. when I try to run a query
>> using the mysql command I recieve and error that reads the resource
>> id and a number. What does that mean?
>
> Firstly always cc the list - others will be able to provide their
> input and others will also learn from the problem/resolution.
>
> What is the query? What is the error?
>
> If you run it manually through command line mysql or phpmyadmin do you
> get an error?
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP and MYSQL

am 28.05.2007 01:01:00 von dmagick

Na Derro Cartwright wrote:
> I am trying to simply display all the values from a simple query but I
> am recieveing an error that I have to upgrade my client. I am not sure
> what that means.

Put the full message in to your preferred search engine - I know the
message you mean and I'm sure one of the top 3 links will tell you the
problem.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php