| | |
urgently need help.....pliz...
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2008
Posts: 8
Reputation:
Solved Threads: 0
hai guys...ive got prob wit my coding..can anybody help me....there is a syntax error in the code...if i delete id,type,price n desc...the code works wel...for ur information the id,type,price n desc wil display automatically wen user click the food picture...the user only keyin the email,roomno,apartment and quantity...but the db mus show id,type,price,desc,email,roomno,apartment n quantity....below is my code....pliz i need urgent help....10x...
PHP Syntax (Toggle Plain Text)
<?php $debug = true; //variable to commit transaction $commit = "commit"; $errors = array(); /* fetch data from form input */ extract ($_POST); /* connect to server */ if(!$db = mysql_connect("localhost", "root", "")) { $errors[] = mysql_error(); } /* select database */ if(!mysql_select_db("webauth", $db)) { $errors[] = mysql_error(); } //begin transaction if(!mysql_query("begin")) { $errors[] = mysql_error(); } /* fields' names in the database */ $result = "INSERT INTO buy (id,type,price,desc,email,apartment,roomno,qty)"; /* variable name as declared as above to be entered to the field */ $result .= "VALUES ('$id','$type','$price','$desc','$email','$apartment','$roomno','$qty')"; if(!mysql_query($result, $db)) { $commit = "rollback"; $errors[] = mysql_error(); } // $commit = "rollback"; //uncomment to automatically rollback the transaction if($commit == "commit") { mysql_query($commit); echo "successful"; echo "<br>"; echo "<a href=order.php>Home</a>"; mysql_close($db); } else { echo "there was an error in your transaction, transction rolled back: "; if($debug == true) { foreach($errors as $value) { echo "<p>" . $value . "</p>"; } } mysql_query($commit); mysql_close($db); } /* variable name as declared as above to be entered to the field */ /* fields' names in the database */ /* execute the query */ ?>
![]() |
Other Threads in the PHP Forum
- Previous Thread: unexspected T_STRING on line 101
- Next Thread: Text Fader
Views: 320 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl customizableitems database date directory display download dynamic echo email error file files folder form format forms forum function functions google headmethod href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail malfunctioning menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





