User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,577 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,629 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1063 | Replies: 2
Reply
Join Date: Oct 2007
Posts: 3
Reputation: jamez333 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jamez333 jamez333 is offline Offline
Newbie Poster

Help Problem with inserting data into mysql with PHP

  #1  
Oct 29th, 2007
I am using this html form page...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	
 <title>Item Entry - Opulentworx - Private</title>

</head>

<body>

<form action="/itemENTRY.php" method="post" id="itemENTERdb">
<input type="text" id="itemNUM"/>Item #<br>
<input type="text" id="quant"/>Quantity<br>
<input type="text" id="date"/>Date<br>
<input type="text" id="cost"/>Cost<br>
<input type="text" id="ground"/>UPS Ground<br>
<input type="text" id="3day"/>3 Day UPS<br>
<input type="text" id="2day"/>2 Day UPS<br>
<input type="text" id="nextDAY"/>Next Day UPS<br>
<input type="text" id="salesTAX"/>Sales Tax<br>
<input type="text" id="dFEE"/>Design Fee<br>
<input type="text" id="pFEE"/>Print Fee<br>
<input type="text" id="markUP"/>Mark-UP<br>
<input type="text" id="subTOT"/>Sub-Total<br>
<input type="text" id="flTAX"/>FL Tax<br>
<input type="submit" value="Save Date"/>
<input type="reset" value="Reset Date"/>
</form>



</body>
</html>

and this php file to insert into my database...


<?
$link = mysql_connect("mysql","user","xxxxxxx");
mysql_select_db("products");
{
$sql="INSERT INTO info (itemNUM, quant, date, cost, ground, 3day, 2day, nextDAY, salesTAX, dFEE, pFEE, markUP, subTOT, flTAX) 
VALUES ('$_POST["itemNUM"]', '$_POST["quant"]', '$_POST["date"]', '$_POST["cost"]', '$_POST["ground"]', '$_POST["3day"]', '$_POST["2day"]', '$_POST["nextDAY"]', '$_POST["salesTAX"]', '$_POST["dFEE"]', '$_POST["pFEE"]', '$_POST["markUP"]', '$_POST["subTOT"]', '$_POST["flTAX"]')";
}

mysql_close($link);

?>

Nothing happens. Can someone please help me. I am new to PHP and I desperately need to get my database functional for my business.

Thanx,

jamez@opulentworx.com
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 4
Reputation: Rankenian is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Rankenian Rankenian is offline Offline
Newbie Poster

Re: Problem with inserting data into mysql with PHP

  #2  
Oct 29th, 2007
You've defined the SQL statement as $sql, but now you need to actually do something with it. You need to call the function mysql_query with $sql as an argument.

Eg

mysql_query($sql);

Optionally you can use

$result = mysql_query($sql);

In this case you don't really need to hold the output of the function as a variable but it's a good habit to get into.
Reply With Quote  
Join Date: Oct 2007
Posts: 3
Reputation: jamez333 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jamez333 jamez333 is offline Offline
Newbie Poster

Re: Problem with inserting data into mysql with PHP

  #3  
Oct 29th, 2007
Thank you very much! I like this site already.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 6:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC