Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Functions with @?

Status
Not open for further replies.

welshtroll

Programmer
Nov 29, 2001
55
GB
I have a website that has PHP 4.0.1 installed on the server.
To aid in the development I have just installed apache, mysql and PHP locally.

When i try a view existing pages it get problems with the functions unless i place a @ infront of them.
I have searched the tek-tips forum and PHP site trying to find out why this is the case, but i can't find the answer to my question which is:
If i apply the @function_name all of my php pages locally, will my online server versionof PHP be able to handle this.
Also, why have I had to do this @ thing, is it due to the version i'm running or because it's local?

An example of this would be:
$query = "SELECT * FROM my_table";
$result = mysql_query($query) or die("Query failed");

Changes to
$result = @mysql_query($query) or die("Query failed");

Cheers,
'Does my thumb look big in this?'
homebut.gif
elshtroll
 
Forgot to say, local version of PHP is 4.2.1 'Does my thumb look big in this?'
homebut.gif
elshtroll
 
1st, remove the @ sign from every line of code. That's stupid programming. Not echoing the errors is not solving them. Until you solve your problems you are going to have, even if your code works now.

Then, just read the error, and if you don't understand, just post here the error, and a LITTLE piece of code. I skip all posts that have more than one page of code.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Here is the code:
link = mysql_connect("mysql_host", "mysq_user", "mysql_password") or die("Could not connect");

Error: "Fatal error: Call to unsupported or undefined function mysql_connect() in .."

I was lead to believe that MYSQL was already switched on in PHP4.

Thanx 'Does my thumb look big in this?'
homebut.gif
elshtroll
 
You need to enable mysql support for PHP, im not sure how you do this under linux, but windows PHP comes with mysql support built in --BB
 
If you compiled PHP yourself, you need to reconfigure and remake PHP. You have to configure with the --with-mysql=/path/to/mysql option. There are also MySQL modules available out there, though using the --with-mysql option is supposed to be much better. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top