3
Contributors
3
Replies
19
Views
1 Year
Discussion Span
Last Post by diafol
1

Posting links like that here is frowned upon as we have no way to know if it will infect our system with a trojan. Please post the requirements, code, and such here directly.

0
<?php
if
(isset($_REQUEST['update']))
{   
@$db = mysql_connect("localhost","root","");
mysql_select_db("student",$db);
$sql = ""; // heres the problem, i couldn't get any referrence on how i function a loading up button.
$result = mysql_query($sql);
}
else if (isset($_REQUEST['delete']))
{
@$db = mysql_connect("localhost", "root","");
mysql_select_db("student",$db);
$sql = "DELETE from admission WHERE id='$_POST[id]'";
$result = mysql_query($sql);
}
@mysql_connect("localhost", "root","");
mysql_select_db("student") or die(" could not connect to DB");
$sql = "SELECT * from subject,admission";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{       
?>

</>
heres the code sir, i intently make it this way like a funtion button. i already specify the line of my inquiry. thank you sir.

Edited by opawix

0

OK. Few things.
1. Specify a superglobal (POST or GET) rather than depend on REQUEST. As you are making changes to the DB, you should use POST.
2. Stop using mysql_* functions. They are deprecated (and now removed from PHP7). Use PDO or mysqli.
3. You are placing raw input data into a statement without sanitizing. This means you are open to SQL Injection.

See DW Tutorial: Common Issues with MySQL and PHP for how to fix these issues.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.