Hey whats up guys? I was using thenewboston tutorials on youtube and I am stuck. I was trying to connect to my database that i made.

<?php
//opens connection to mysql server
$dbc=mysql_connect('localhost','kybo13','****');
if(!$dbc)
{
die('Not connected: ' . mysql_error()); 
}

//select database
$db_selected=mysql_select_db("kybo13_game",$dbc);
if(!$db_selsected)
{
die("Cant connect: " . mysql_error());
}

//test
$query="UPDATE game SET email='hopethisworks' WHERE username='kybo13'";
$result=mysql_query($query);
?>

Thanks for your help guys.

You have to be more explicit. "It still doesn't work" doesn't help much. I ran a modified version of your code as follows and it worked correctly:

<?php
//opens connection to mysql server
$dbc=mysql_connect('localhost','root','');
if(!$dbc)
	{
	die('Not connected: ' . mysql_error());
	}

//select database
$db_selected = mysql_select_db("test",$dbc);
if(!$db_selected)
	{
		die("Cant connect: " . mysql_error());
	}

//test
$query="UPDATE test_table SET field1='hopethisworks' WHERE id='00001'";
$result=mysql_query($query);
?>

You may have a problem with your DB or the names / parms you are using for it.

Chris

This question has already been answered. Start a new discussion instead.