Web Design and Development Forums

PHP n MySQL connection

This is a discussion on "PHP n MySQL connection" within the PHP Forum section. This forum, and the thread "PHP n MySQL connection are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > PHP Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Apr 15th, 2007, 08:30   #1 (permalink)
New Member
 
Join Date: Mar 2007
Location: UK
Age: 26
Posts: 7
Question PHP n MySQL connection

using MySQL n PHP together how can I manage database connection?
uddin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 18th, 2007, 06:41   #2 (permalink)
New Member
 
Join Date: Jul 2006
Location: Wichita, KS
Posts: 7
Re: PHP n MySQL connection

Hi uddin,

PHP with MYSQL is a good combination when compared to others.



Code: Select all

 <?php
ob_start();
}
<html>
<body>
<form name = frm action = <?php echo $_SERVER['PHP_SELF']; ?> method = "post"> 
Employee number: <input type = text name = empno> <br>
Employee Name : <input type = text name = empname> <br>
<input type = submit value = "save">
</form>
</body> 
</html>
<?php
$con = @mysql_connect("localhost", "username","password") or die(mysql_error());
$db = @mysql_select_db("emp",$con) or die(mysql_error());
if(isset($_POST['empno'] or isset($_POST['empname'])) 
{
$qry = "insert into empdet (empno, empname) values (".$_POST['empno'].", '".$_POST['empname']."')";
$res = @mysql_query($qry) or die(mysql_error());
If($res>0)
{
header("location:success.php");
}
}
@mysql_close($con);
ob_end_flush();
?>
Use the code above or modify as needed.

Thanks!!!

_________________________________________

www.realmetrics.com - Metrics you can count on
RealMetrics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
connection

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic DSN-Less Connection to DB Corey Bryant ASP Forum 7 Oct 26th, 2007 06:08
MySQL Connection String Info Monie ASP Forum 9 Oct 24th, 2007 01:48
another database connection question! asp and mysql fogofogo ASP Forum 4 Dec 2nd, 2005 08:48
Connection String DSN-less gwx03 ASP Forum 11 Nov 26th, 2003 12:07
dns less connection String djaccess ASP Forum 7 Oct 5th, 2003 14:34



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 04:20.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59