Trying to load this form to a db but it soesn't wanna work..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gabrielkolbe
Forum Newbie
Posts: 2
Joined: Wed Jul 27, 2005 11:20 am

Trying to load this form to a db but it soesn't wanna work..

Post by gabrielkolbe »

Code: Select all

<?php
else {
if(isset($_POST["Submit"])) {

$sale = $_POST["sale"];
$number = $_POST["number"];
$street = $_POST["street"];
$suburb = $_POST["suburb"];
$city = $_POST["city"];
$province = $_POST["province"];
$post = $_POST["post"];
$distance = $_POST["distance"];
$date = time();

$query = "INSERT INTO right_prop_1(prop_ID_1, sale, number, street, suburb, city, province, post, distance, date_auto)
VALUES (NULL, '$sale', '$number', '$street', '$suburb', '$city', '$province', '$post', '$distance', '$date')";
mysql_query($query, $conn) or die(mysql_error());
} 

?>
JCART | Please use

Code: Select all

tags when posting php code. Review [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

What is being returned?
gabrielkolbe
Forum Newbie
Posts: 2
Joined: Wed Jul 27, 2005 11:20 am

Post by gabrielkolbe »

Nothing! in the database this is the only values it return.The ID and Date basically

VALUES (65, '', 0, '', '', '', '', '', 0, 1122474860);
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

try a print_r($_POST) to see if you're getting the right values in the first place.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

You wanker you didn't mysql_connect() and mysql_select_db()!!

You must connect to the MySQL server and select a DB first, before you're trying to make changes to it.
Post Reply