PHP & MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Everyone,

I know this isn't strictly a PHP question, and I apologize in advance for that. I'm trying to setup a website for some of my customers that would allow them to update a database on their schedule, making it easier for us to have the most up to date info, and taking some of the work off of us.

Right now, the question I have is, how would I be able to select certain records to be deleted (Or moved to another table called "deleted")? Is it as simple as looping through the database, having them check a checkbox, and then hit a "remove" button?

As I go, I will be adding a login screen to it, and hopefully protecting against SQL injection attacks... But right now, I'm still just learning and trying.

The SQL syntax is easy enough for me to figure out, but the php is throwing me off right now...

I'm running PHP 5.2.0
MySQL 5.0.24A

Any points to the right documents are greatly appreciated as well as sample code :)

Currently here is the code I'm working with on the page to display it:

$link = mysql_connect($server, $username, $password)
    or die('Could not connect: ' . mysql_error());
echo 'Connected successfully <BR>';
mysql_select_db('legion') or die('Could not select database' . mysql_error());
echo 'DB selected <BR>';



$result = mysql_query("SELECT * FROM current") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
$FName = $row["FName"];
$LName = $row["LName"];
$Add1 = $row["Add1"];
$Add2 = $row["Add2"];
$City = $row["City"];
$State = $row["State"];
$Zip = $row["Zip"];
$Date = $row["Date"];


echo "$FName, $LName,  $Add1, $Add2, $City, $State, $Zip, $Date<BR>";
};

I'm sure there is an easier way to do that as well... But this way worked :)

Jason

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux