Results 1 to 10 of 10
-
13th Jan 2012, 11:42 AM #1OPBannedWebsite's:
CloudNXT.netMySQL insert using PHP Help
PHP Code:<?php
$con = mysql_connect("localhost","MYSQL USERNAME","MYSQL PASS");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("seedvps_whm", $con);
$sql="INSERT INTO tblcustomaddon location, status, username, password, ip);
VALUES
('$_POST[location]','$_POST[status]','$_POST[username]','$_POST[password]','$_POST[ip]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
Code:<html> <body> <form action="insert.php" method="post"> Location: <input type="text" name="location" /> Status: <input type="text" name="status" /> Username: <input type="text" name="username" /> Password: <input type="text" name="password" /> IP: <input type="text" name="ip" /> <input type="submit" /> </form> </body> </html>
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'location, status, username, password, ip) VALUES ('fr','jaja','BigBoSs','kaka'' at line 1EnCiPh3r Reviewed by EnCiPh3r on . MySQL insert using PHP Help <?php $con = mysql_connect("localhost","MYSQL USERNAME","MYSQL PASS"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("seedvps_whm", $con); $sql="INSERT INTO tblcustomaddon location, status, username, password, ip); Rating: 5
-
13th Jan 2012, 11:44 AM #2Just Another Coder
try this out
PHP Code:<?php
$con = mysql_connect("localhost","MYSQL USERNAME","MYSQL PASS");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("seedvps_whm", $con);
$sql="INSERT INTO tblcustomaddon (location, status, username, password, ip) VALUES ('$_POST[location]','$_POST[status]','$_POST[username]','$_POST[password]','$_POST[ip]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
-
13th Jan 2012, 11:53 AM #3OPBannedWebsite's:
CloudNXT.netWorked like a charm!!!!
-
13th Jan 2012, 11:56 AM #4Just Another Coder
-
13th Jan 2012, 11:59 AM #5OPBannedWebsite's:
CloudNXT.net
-
13th Jan 2012, 12:00 PM #6MemberWebsite's:
sborg.usBy including the configuration.php file and using the same variables?
V3g3ta | Halcyon | Abhi
-
13th Jan 2012, 12:02 PM #7Just Another Coder
yea simple <?php include('config.php'); ?>
EDIT: Oops he already replied on that one.
-
13th Jan 2012, 12:03 PM #8MemberWebsite's:
sborg.usYou can use require too -> To make sure that the file is included. Else the script throws errors (in case you have them enabled).
V3g3ta | Halcyon | Abhi
-
13th Jan 2012, 03:40 PM #9MemberWebsite's:
EvilHackerz.OrgMy Friend You Can Also use BigDump For DB Restoration
-
13th Jan 2012, 11:10 PM #10MemberWebsite's:
imdber.org justpaste.meYou should be using pdo by now.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Where can I insert this code?
By Divvy in forum WordpressReplies: 7Last Post: 21st Oct 2011, 10:29 AM -
insert PSD file
By iobit in forum vBulletinReplies: 10Last Post: 9th Aug 2011, 08:38 AM -
insert 100 urls to database in one go ?
By jack3r in forum Web Application/Script SupportReplies: 2Last Post: 8th Jul 2011, 10:09 PM -
Insert Image Code
By warezboy in forum vBulletinReplies: 12Last Post: 9th Jun 2010, 06:16 PM -
Insert Image CODE
By tom247 in forum Web Application/Script SupportReplies: 3Last Post: 9th Jun 2010, 05:04 AM
themaCreator - create posts from...
Version 3.22 released. Open older version (or...