The PHP book i have been using lauds object-oriented php, yet provides poor details on how far the code it presents is supported in version 4. my server runs 4 and i have been having trouble trying out some code from the book on it. I simply don't know whether it is the php server or my syntax. i normally use

$con = mysql_connect($hostname,$username,$password);

to connect. the book presents this:

@ $db = new mysqli($hostname,$username,$password,$dbname);

this alternate method seems to kill the script entirely :mad: , with no error messages or any response whatsoever. even html after the close of the script (?>) is not printed.

phpversion() returns: PHP version: 4.3.11. any ideas as to why the script dies? does php 4 support the syntax in the second example?

thanks!

matt :cool:

The PHP book i have been using lauds object-oriented php, yet provides poor details on how far the code it presents is supported in version 4. my server runs 4 and i have been having trouble trying out some code from the book on it. I simply don't know whether it is the php server or my syntax. i normally use

$con = mysql_connect($hostname,$username,$password);

to connect. the book presents this:

@ $db = new mysqli($hostname,$username,$password,$dbname);

this alternate method seems to kill the script entirely :mad: , with no error messages or any response whatsoever. even html after the close of the script (?>) is not printed.

phpversion() returns: PHP version: 4.3.11. any ideas as to why the script dies? does php 4 support the syntax in the second example?

thanks!

matt :cool:

The mysqli code is causing a fatal error (not sure that it's available in PHP 4.x), and stopping the rest of the script from executing. If you remove the "@" from in front of the line, you will see the error message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.