Jump to content

How To Setup Script In Phpmyadim In Wampserver 2.0?


Talent87
 Share

Recommended Posts

HI, I have a probelm in how I set up script in phpMyAdim in wamp server package 2.0 , to connect MySql db with php script in on Vesta platform, I don't now where is to go change my configuration , after I have installed wampserver 2.0 I don't gived my data base login and password when I want to connect to the local host , the connection will be fail, if any one can help me in solving this problem soon, thanks :):)

Link to comment
Share on other sites

(1)check IIS is disabled(2)click on (where clock is displayed) wampserver dial, should be white (not with yellow, or red showing within dial), at the bottom it should say 'put offline' if it says 'Put online' obviously this is the problem, click it to 'Put Online'. This will resatrt the server.(3) if it is already online click restart all services.open notepad and create script<?phpecho "Hello World";?>and save it in wamp/www/ directoryopen browser and enter localhost/filename.phpand hopefully you should see Hello World displayed.

Link to comment
Share on other sites

thanks for your explain , but my problem is not in working wampserver and how to check it , its very easy but I want to connect from my script that I have write in my editor and connect it to my local host using this code$con=mysql_connect ("localhost","username","password") , but also I have asked this yesterday and you answered me but the answer was not what I wantI want to create connection , I have some viduo tutorials and explain it how to do that but on Mac platform but my platform is windows vesta , I mean where is I go on PhpMyAdim to setup script so that I can build connection between the MySql Data base and php Script

Edited by talent87
Link to comment
Share on other sites

this is a typical script that works on my wampserver, to connect to database just change commented values to your own requirements, but remember table name, field names etc are all case sensitive, and so these should match exactly.mysqlconnection.php<?php$hostname = "localhost";$database = "databasename"; //change to your databasename$username = "root"; //change to your username$password = "password"; //change to your password$connection = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database, $connection);$sql = "SELECT * FROM mytable"; //change to your database TABLE name$query = mysql_query($sql, $connection) or die(mysql_error());$myrow = mysql_fetch_assoc($query);$totalRows_Recordset1 = mysql_num_rows($query);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> </head><body><table border="1" cellpadding="0" cellspacing="0"> <tr> <td>ID</td> <td>Category</td> <td>Name</td> </tr> <?php do { ?> <tr> <td><?php echo $myrow['ID']; ?></td> <!--change to table fieldname--> <td><?php echo $myrow['Category']; ?></td> <!--change to table fieldname--> <td><?php echo $myrow['Name']; ?></td> <!--change to table fieldname--> </tr> <?php } while ($myrow = mysql_fetch_assoc($query)); ?></table></body></html><?phpmysql_free_result($query);?>EDIT: you might want to check in phpmyadmin folder (located at C:\wamp\apps\phpmyadmin) for a file called config.inc.phpand then make sure user and password match what you set up.$cfg['Servers'][$i]['user'] = 'root'; // MySQL user$cfg['Servers'][$i]['password'] = 'yourpassword'; // MySQL password

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...