i try to connect with phpmyadmin with string given below
mysql_connect('localhost',root','');
so its does't connect so wht is connection string for x10hosting.com...?
pls frnds solve me
i try to connect with phpmyadmin with string given below
mysql_connect('localhost',root','');
so its does't connect so wht is connection string for x10hosting.com...?
pls frnds solve me
If you're trying to connect to the MySQL server on X10, there's no way you have access to the root MySQL account. Use your own database account.
A failed connection should produce an error; what is it?
On X10, phpMyAdmin is already installed in cPanel. If you're trying to install your own copy, you don't need to.
If instead you're writing your own script and write "phpmyadmin" instead of "MySQL" (two entirely different things), the mysql extension is outdated and on its way to deprecation. Instead, use PDO, which has many useful improvements, such as prepared statements and support for the Traversable interface, so you can loop over results with foreach.
Last edited by misson; 06-27-2012 at 01:10 PM.
Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Jon Skeet's and Eric Raymond's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.Misson, not Mission.
<?php
$host = "yourhost";
$user = "your_user";
$password = "your_user";
$db_name = "db_name";
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
$connect = mysql_connect($host,$user,$password);
if (!$connect){
die('could not connect:'.mysql_error());
}
$db_selected=mysql_select_db($db_name);
if(!$db_selected){
die('cant use '.$dbhost.':'.mysql_error());
}
?>
Code without context isn't very helpful. Code using outdated (the mysql extension) and poor practices (or die, outputting errors to non-admin users instead of logging them) is worse than unhelpful.
Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Jon Skeet's and Eric Raymond's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.Misson, not Mission.