How to use wampserver/php
Posted by: Nelson Ojuka (---.utl.co.ug)
Date: July 03, 2012 09:03AM

I have started using wampserver 2.1 after downloading on my pc using windows 7. When i write a simple php code and try to run it, i always get an error (!) Parse error, syntax error, unexpected T_STRING in D:\Wamp\www\variable.php on line 6. Any help please
Nelson

Options: ReplyQuote
Re: How to use wampserver/php
Posted by: stevenmartin99 (Moderator)
Date: July 03, 2012 09:04AM

you have a mistake in your code clearly.


whats the code

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: How to use wampserver/php
Posted by: Nelson Ojuka (---.utl.co.ug)
Date: July 03, 2012 09:17AM

I Just typed what was in a book for the start as below.
<html>
<head>
<title>Variables - Some Practice</title>
</head>
<body>
<?php print("It Worked!"winking smiley; ?>
</body>
</html>

Options: ReplyQuote
Re: How to use wampserver/php
Posted by: stevenmartin99 (Moderator)
Date: July 03, 2012 09:22AM

that makes VERY LITTLE sense. your file is called variable.php but this code doesnt have a variable

i think your looking at the wrong file

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: How to use wampserver/php
Posted by: Nelson Ojuka (---.utl.co.ug)
Date: July 03, 2012 09:42AM

Thanks steven
I have edited the code, saved using another name and it has succefully worked.

Options: ReplyQuote
Re: How to use wampserver/php
Posted by: archit_shukla13@yahoo.com (117.214.168.---)
Date: July 03, 2012 06:31PM

Re: Can't connect to wamp server for querying mysql DB.
Posted by: archit_shukla13@yahoo.com (117.214.168.---)
Date: July 03, 2012 06:29PM

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'username'@'localhost' (using password: YES) in C:\wamp\www\PHP\database_connectivity.php on line 2
could not connect to DB:Access denied for user 'username'@'localhost' (using password: YES)



//gettin abov msg while connecting to wamp server for querying DB,,my new to PHP so plz help me with the same step by step.

original script is written below:

.............................


<?php
$con= mysql_connect("localhost","username","password"winking smiley;
if (!$con)
{
die('could not connect to DB:'.mysql_error());
}

if (mysql_query('CREATE DATABASE register',$con))
{
echo "database created";

}

else

{
echo "error creating DB".mysql_error();
}
mysql_close($con);
?>

Options: ReplyQuote
Re: How to use wampserver/php
Posted by: RiggsFolly (---.as13285.net)
Date: July 04, 2012 04:31PM

Ok,

Not sure if you have change the username and password values to 'username' and 'password' so we dont see your username and password or wether that is what you put into those parameters.

1. As you are trying to create a database the userid should be an ADMIN user, as only admins can create databases.

2. If this is a vanilla install of wamp the userid should be 'root' (lowercase) and the password should be blank i.e. '', a string containing nothing.

3. If you have created another ADMIN user usre the username and password that match that new user.



Note: Once you get this working you should think of creating a new ADMIN user and deleting the 'root' user as this is universally know as the default ADMIN user for a newly installed MYSQL server.

Options: ReplyQuote


Sorry, only registered users may post in this forum.