[SOLVED]Deleting Database Information
Moderator: General Moderators
[SOLVED]Deleting Database Information
Ok this is what I have.
Problem 1:
I have a simple database inpuit form with name, number, address, and so on. I have everything working fine to display all of the database information, and input information into the database. But I want to add a link to eatch of the lines in the display table to delete that specific line. If you look at the following you will see that for the first row I amd going to add a column at the end that says edit or delete, and when they click on delete it will remove that entry from the database, but I need this to populate for eatch of the entries in the display.
Problem 2:
I also will need to make those headers such as the words name, phone, date all be links that when you press on them it will sort those listings by that column. For example if I click on Name , it will sort all of the entries by name in alphabeticle order, and display them.
http://www.freegamespot.net/dancefactory/display.php ( the entries being displayed)
http://www.freegamespot.net/dancefactory/insert.php ( the form used to add information to the database)
Thank you in advance , any help would be appreciated.
Problem 1:
I have a simple database inpuit form with name, number, address, and so on. I have everything working fine to display all of the database information, and input information into the database. But I want to add a link to eatch of the lines in the display table to delete that specific line. If you look at the following you will see that for the first row I amd going to add a column at the end that says edit or delete, and when they click on delete it will remove that entry from the database, but I need this to populate for eatch of the entries in the display.
Problem 2:
I also will need to make those headers such as the words name, phone, date all be links that when you press on them it will sort those listings by that column. For example if I click on Name , it will sort all of the entries by name in alphabeticle order, and display them.
http://www.freegamespot.net/dancefactory/display.php ( the entries being displayed)
http://www.freegamespot.net/dancefactory/insert.php ( the form used to add information to the database)
Thank you in advance , any help would be appreciated.
Last edited by netpants on Tue Dec 19, 2006 2:07 pm, edited 1 time in total.
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
This should do the trick for deleting...
to add the delete button, you should simply beable to add another table cell with a delete button in it, and it should add a delete button for every line, but if not...
the only way I can think of at the moment for your second problem is to have them assume the ORDER BY somehow, eg.
Code: Select all
mysql_query("DELETE FROM table_name WHERE column_name = some_value");Code: Select all
$showtable = MYSQL_QUERY("SELECT * FROM table_name");
while ($row = mysql_fetch_assoc($showtable))
{
$whatever = $row['whatever'];
$whatever = $row['whatever'];
$whatever = $row['whatever'];
$whatever = $row['whatever'];
$id = $row['id'];
?>
<form type="POST" action="whatever">
<input type="hidden" name="id" value="<? echo $id; ?>">
<td>"<? echo $whatever; ?>"</td>
<td>"<? echo $whatever; ?>"</td>
<td>"<? echo $whatever; ?>"</td>
<td>"<? echo $whatever; ?>"</td>
<td><input type="submit" value="DELETE"> </td>
<?
}Code: Select all
<a onClick="<? $orderby = 'name' ?>">NAME</a>
[php]
$showtable = MYSQL_QUERY("SELECT * FROM table_name ORDER BY '$orderby'");
[/php]feyd | Please use
Is that correct? Before I do anything I want to be sure.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Ok thank you. I just added the id table into my database, in the input form how would i add +1 to the id field for every new post. Here is what I have.Code: Select all
<?
$username="username";
$password="password";
$database="database";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$id=$_POST['id'];
$date=$_POST['loggedDate'];
$first=$_POST['firstName'];
$last=$_POST['lastName'];
$birth=$_POST['birth'];
$phone=$_POST['phone'];
$streetnumber=$_POST['streetNumber'];
$streetname=$_POST['streetName'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$prize=$_POST['prize'];
++$id;
$query = "INSERT INTO Winners VALUES ('$id','$date','$first','$last','$birth','$phone','$streetnumber','$streetname','$city','$state','$zip','$prize')";
mysql_query($query);
mysql_close();
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Ok I was able to add the delete button to every row, but when pressed it doesnt do anything. Here is my code.
?
Code: Select all
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Winners";
$result=mysql_query($query);
mysql_query("DELETE FROM table_name WHERE column_name = some_value");
$num=mysql_numrows($result);
mysql_close();
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><a href="<? $orderby = 'id' ?>">ID</a></font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Date</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><a href="<? $orderby = 'name' ?>">Name</a></font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Birthday</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Phone</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Street Number</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Street Name</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">City</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">State</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Zip</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Prize</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Edit</font></th>
</tr>
<?
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$date=mysql_result($result,$i,"loggedDate");
$first=mysql_result($result,$i,"firstName");
$last=mysql_result($result,$i,"lastName");
$birth=mysql_result($result,$i,"birth");
$phone=mysql_result($result,$i,"phone");
$streetnumber=mysql_result($result,$i,"streetNumber");
$streetname=mysql_result($result,$i,"streetName");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$prize=mysql_result($result,$i,"prize");
?>
<tr>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$id"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$date"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$first $last"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$birth"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$phone"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$streetnumber"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$streetname"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$city"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$state"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$zip"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$prize"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><input type="submit" value="DELETE"></font></td>
</tr>
<?
++$i;
}
echo "</table>";
?>
</td>
</tr>
</table>
<p>
</body>
</html>
</html>- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
ok, add a name to the delete button
ok, delete your DELETE query, you needed to add in the correct values, but replace it with this AND fix the values if need be.
you dont need to add a code to increment the ID, go into your database as select auto increment for your ID.
Code: Select all
name = "delete"Code: Select all
$id = $_POST['id'];
if (isset($_POST['delete'])){
mysql_query("DELETE FROM Winners WHERE id = '$id'");
else {
...do nothing...
}I think I am getting closer, but I am getting this error now.
Code: Select all
Parse error: syntax error, unexpected $end in /home/freegames/domains/freegamespot.net/public_html/dancefactory/display.php on line 125- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
I just got rid of it because of the error not allowing me to do anything. I think it had to do with where I was putting the
It was not working with the code I had in there already. I tried a few different places but nothing seemed to work and I was getting the same error different lines.
Code: Select all
$id = $_POST['id'];
if (isset($_POST['delete'])){
mysql_query("DELETE FROM Winners WHERE id = '$id'");
else {
...do nothing...
}- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
so is it working now?
it would certainly work a lot better if you edited the code I am giving you as "...do nothing..." would probably cause problems. Check over it all and make sure what is to happen, is what you want, as well as checking all variable names and db field names.
If you put that code near the top of your script it should work, but i noticed also in your earlier code you did not indicate a form...
Put this around all your tables and delet button
it would certainly work a lot better if you edited the code I am giving you as "...do nothing..." would probably cause problems. Check over it all and make sure what is to happen, is what you want, as well as checking all variable names and db field names.
If you put that code near the top of your script it should work, but i noticed also in your earlier code you did not indicate a form...
Put this around all your tables and delet button
Code: Select all
<form type="POST" action="">
</form>Ok this is what I did and I get this.
Parse error: syntax error, unexpected T_ELSE in /home/freegames/domains/freegamespot.net/public_html/dancefactory/display.php on line 44
Parse error: syntax error, unexpected T_ELSE in /home/freegames/domains/freegamespot.net/public_html/dancefactory/display.php on line 44
Code: Select all
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Add Winner</title>
</head>
<<body bgcolor="#000000">
<p align="left">
<img border="0" src="1392094530_m.jpg" width="170" height="119">
<font color="#FFFFFF">
<form action="insert.php" method="post">
Date: <input type="text" name="loggedDate"> <br>
First Name: <input type="text" name="firstName"> <br>
Last Name: <input type="text" name="lastName"><br>
Birthdate: <input type="text" name="birth"><br>
Phone Number: <input type="text" name="phone"><br>
Street Number: <input type="text" name="streetNumber">
Street Name: <input type="text" name="streetName">
City: <input type="text" name="city"><br>
State: <input type="text" name="state" size="2">
Zip Code: <input type="text" name="zip">
Prize: <input type="text" name="prize"><br>
E-Mail: <input type="text" name="email"><br>
<input type="Submit" value="Add Winner">
</form></font>
</p>
<table border="0" width="986">
<tr>
<td width="200"><font color="#FFFFFF">Add Winner<p>
<font color="#FFFFFF"><a href="display.php">Display Winner</a></font></td>
<td width="863" rowspan="3" valign="top">
<table border="0" width="100%">
<tr>
*****************RIGHT HERE******************<?
$id = $_POST['id'];
if (isset($_POST['delete'])){
mysql_query("DELETE FROM Winners WHERE id = '$id'");
else {
echo nothing was deleted
}
?>
*********************TO HERE********************
<td> <?
$username="freegames_dance";
$password="marlboro";
$database="freegames_dance";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Winners";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><a href="<? $orderby = 'id' ?>">ID</a></font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Date</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><a href="<? $orderby = 'name' ?>">Name</a></font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Birthday</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Phone</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Street Number</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Street Name</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">City</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">State</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Zip</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Prize</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">E-Mail</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Edit</font></th>
</tr>
<?
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$date=mysql_result($result,$i,"loggedDate");
$first=mysql_result($result,$i,"firstName");
$last=mysql_result($result,$i,"lastName");
$birth=mysql_result($result,$i,"birth");
$phone=mysql_result($result,$i,"phone");
$streetnumber=mysql_result($result,$i,"streetNumber");
$streetname=mysql_result($result,$i,"streetName");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$prize=mysql_result($result,$i,"prize");
$email=mysql_result($result,$i,"email");
?>
****************HERE***********<form type="POST" action="">
<tr>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$id"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$date"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$first $last"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$birth"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$phone"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$streetnumber"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$streetname"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$city"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$state"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$zip"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$prize"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$email"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><input type="submit" value="DELETE" name="delete"></font></td>
</tr> **********************HERE****************</form>
<?
++$i;
}
echo "</table>";
?>
</td>
</tr>
</table>
<p>
</body>
</html>
</html>- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
i fixed up a few errors, try this and see what happens....
Code: Select all
<?
$id = $_POST['id'];
if (isset($_POST['delete'])){
mysql_query("DELETE FROM Winners WHERE id = '$id'");
else {
echo "Nothin was deleted";
}
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Add Winner</title>
</head>
<body bgcolor="#000000">
<p align="left">
<img border="0" src="1392094530_m.jpg" width="170" height="119">
<font color="#FFFFFF">
<form action="insert.php" method="post">
Date: <input type="text" name="loggedDate"> <br>
First Name: <input type="text" name="firstName"> <br>
Last Name: <input type="text" name="lastName"><br>
Birthdate: <input type="text" name="birth"><br>
Phone Number: <input type="text" name="phone"><br>
Street Number: <input type="text" name="streetNumber">
Street Name: <input type="text" name="streetName">
City: <input type="text" name="city"><br>
State: <input type="text" name="state" size="2">
Zip Code: <input type="text" name="zip">
Prize: <input type="text" name="prize"><br>
E-Mail: <input type="text" name="email"><br>
<input type="Submit" value="Add Winner">
</form></font>
</p>
<table border="0" width="986">
<tr>
<td width="200"><font color="#FFFFFF">Add Winner<p>
<font color="#FFFFFF"><a href="display.php">Display Winner</a></font></td>
<td width="863" rowspan="3" valign="top">
<table border="0" width="100%">
<tr>
<td>
<?
$username="freegames_dance";
$password="marlboro";
$database="freegames_dance";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Winners";
$result=mysql_query($query);
$num=mysql_numrows($result);
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><a href="<? $orderby = 'id' ?>">ID</a></font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Date</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><a href="<? $orderby = 'name' ?>">Name</a></font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Birthday</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Phone</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Street Number</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Street Name</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">City</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">State</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Zip</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Prize</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">E-Mail</font></th>
<th><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2">Edit</font></th>
</tr>
<?
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$date=mysql_result($result,$i,"loggedDate");
$first=mysql_result($result,$i,"firstName");
$last=mysql_result($result,$i,"lastName");
$birth=mysql_result($result,$i,"birth");
$phone=mysql_result($result,$i,"phone");
$streetnumber=mysql_result($result,$i,"streetNumber");
$streetname=mysql_result($result,$i,"streetName");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$prize=mysql_result($result,$i,"prize");
$email=mysql_result($result,$i,"email");
?>
<form type="POST" action="">
<tr>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$id"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$date"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$first $last"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$birth"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$phone"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$streetnumber"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$streetname"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$city"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$state"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$zip"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$prize"; ?></font></td>
<td bgcolor="#202020"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><? echo "$email"; ?></font></td>
<td bgcolor="#333333"><font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><input type="submit" value="DELETE" name="delete"></font></td></tr> </form>
<?
++$i;
}
?>
</table>
</td>
</tr>
</table>
<p>
</body>
mysql_close();
</html>- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
Getting closer, but it wont delete. Its doing more than it did before and without errors.
http://www.freegamespot.net/dancefactory/display.php
http://www.freegamespot.net/dancefactory/display.php