PHP i have following file inside www in wamp with database name final which has
ID: 3832259 • Letter: P
Question
PHP
i have following file inside www in wamp with database name final which has table called albums in phpmyadmin sql which has id field and name field. but somehow when user enter the name of the album it wont save in the database, any help would be appreciated
create.php
Album
Create Album Here:
if(isset($_POST['name'])){
$name =$_POST['name'];
if(empty($name)){
echo "Enter the name please!!
";
}else{
mysqli_connect('localhost', 'root','', 'test') or die ( "sorry");
}
}
?>
Name:
connect.php (to connect to the database)
$dbcon=mysqli_connect("localhost","root","");
mysqli_select_db($dbcon,"test");
title.php
div id ='title'>
<table>
<tr>
<td align ='center'><a href="create.php">Create Album</a></td><br>
<td align ='center'><a href="upload.php">Upload Picture</a></td>
</tr>
</table>
</div>
Explanation / Answer
The mysqli_connect has a lil wrong syntax.
mysqli_connect("localhost","root","","test");
where test should be the name of the database stored in phpmyadmin.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.