Jump to content

[SOLVED] mysql query help


jeppers

Recommended Posts

i am not sure if i am just missing something but i thought i would just ask to see what you think .

i have uploaded my site online. but i am having issues with it connecting my database. i no where its happening but i just don't see the problem. maybe there is something which i have not done but i am baffled.

 

the error is: could not connect to mysql plonk: Lost connection to MySQL server during query

 

my code is

 

DEFINE ('DB_USER', 'example');
DEFINE ('DB_PASSWORD', 'example);
DEFINE ('DB_HOST', 'example');
DEFINE ('DB_NAME', 'example');

// make the connection 
$dbc = @mysql_connect (example, example, example) OR die ('could not connect to mysql plonk: ' .mysql_error());

 

i have used a database checker to see if the info i was entering was in correct but i was able to gain connection. so have you any idea what it could be and where i should look to sort it out.

 

thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/132956-solved-mysql-query-help/
Share on other sites

This mysql connection is already defined as it mysql.......

 

<?php

$db=mysql_connect("localhost","username","password");
$res=mysql_select_db("PLONK",$db);

if(!$res){

echo"DATABASE CONNECTION PROBLAM!";
}

?>

 

 

all you need to do is use it as a function, and call that function,or use it on a page and include() it.....

 

mysql is already using a defined method to be added in php, it dosent need to be defined....

 

DEFINE ('DB_USER', 'example');
DEFINE ('DB_PASSWORD', 'example');
DEFINE ('DB_HOST', 'example.com');
DEFINE ('DB_NAME', 'example');

// make the connection 
$dbc = @mysql_connect (example, example, example) OR die ('could not connect to mysql plonk: ' .mysql_error());

//select the db 
@mysql_select_db(DB_NAME) OR die ('Could not select the database: ' . mysql_error());

 

this code works on my local host not sure what you mean by the code you have suggested. the code i am using is being used via a include file. the problem is that it don't give me an error message i have seen before. could it be a problem when i have uploaded my database to my server or a problem in my code.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.