Home
Web Design & Development
Photo Repair
Services
Our Work
Contact
« Back
Generated PHP & MySQL
Here is your free PHP & MySQL code to copy and paste into your pages.
connect.php
<?php $hostname='***'; //// specify host, i.e. 'localhost' $user='****'; //// specify username $pass='****'; //// specify password $dbase='****'; //// specify database name $connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL"); $db = mysql_select_db($dbase , $connection) or die ("Can't select database."); ?>
add.php
<form id="FormName" action="added.php" method="post" name="FormName"> <table width="448" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="2" align="center"><input name="" type="submit" value="Add"></td> </tr> </table> </form>
added.php
<?php /// In order to use this script freely /// you must leave the following copyright /// information in this file: /// Copyright 2012 www.turningturnip.co.uk /// All rights reserved. include("connect.php"); $results = mysql_query("INSERT INTO (id, ) VALUES ('', )"); if($results) { echo "Successfully Added"; } else { die('Invalid query: '.mysql_error()); } ?>
Back to index
update.php
<?php /// In order to use this script freely /// you must leave the following copyright /// information in this file: /// Copyright 2012 www.turningturnip.co.uk /// All rights reserved. include("connect.php"); $id = $_GET['id']; $c_Z = mysql_query("SELECT * FROM WHERE id = '$id' "); $r_Z = mysql_fetch_array($c_Z); extract($r_Z); ?> <form id="FormName" action="updated.php" method="post" name="FormName"> <table width="448" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="2" align="center"> <input name="" type="submit" value="Update"> <input name="id" type="hidden" value="<?php echo $id ?>"> </td> </tr> </table> </form>
updated.php
<?php /// In order to use this script freely /// you must leave the following copyright /// information in this file: /// Copyright 2012 www.turningturnip.co.uk /// All rights reserved. include("connect.php"); $id = $_POST['id']; $rsUpdate = mysql_query("UPDATE SET WHERE id = '$id' "); if($rsUpdate) { echo "Successfully updated"; } else { die('Invalid query: '.mysql_error()); } ?>
Back to index
index.php
<a href="add.php">Add entry</a><br> <br> <?php /// In order to use this script freely /// you must leave the following copyright /// information in this file: /// Copyright 2012 www.turningturnip.co.uk /// All rights reserved. include("connect.php"); $result = mysql_query("SELECT * FROM "); $num = mysql_num_rows ($result); if ($num > 0 ) { $i=0; while ($i < $num) { $id = stripslashes(mysql_result($result,$i,"id")); $row .= '
'.$.'
Delete
'; ++$i; }} else { $row = '<tr><td colspan="2" align="center">Nothing found</td></tr>'; } mysql_close(); ?> <table border="1" cellpadding="3" cellspacing="0"><? echo $row ?></table>
delete.php
<?php /// In order to use this script freely /// you must leave the following copyright /// information in this file: /// Copyright 2012 www.turningturnip.co.uk /// All rights reserved. include("connect.php"); $id = $_GET['id']; mysql_query("DELETE FROM WHERE id = '$id' "); mysql_close(); echo "Entry deleted"; ?>
Back to index
MySQL database table
CREATE TABLE `` ( `id` int(6) NOT NULL auto_increment, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) )
Services
Services Overview
Web Design & Development
Photo-Repair Service
Water Damage Photo Repair
Contact us
Our Work
Web Design
Adobe Photoshop
Graphic Design
Code Generators
PHP & MySQL
DPI Calculator
Email Form
Meta Tag
Keyword Analyser
Articles & Tutorials
Photoshop Tutorials
Photoshop Blog
Web Design Articles
Website Validation
Content Management
Other Pages
Photoshop Expert
SiteMap
Disclaimer
Privacy Policy