phpnewbie26
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by phpnewbie26
-
-
The script gets to the //Check Query part and fails. It echos out the "lid query" and doesn't put anything into the database.
I tried to just remove that portion, but it still wouldn't input any data into my table. I am very new at PHP and am basically
getting code off the internet and throwing it into some pages and seeing if it works. This is a very simple script, I just dont
see why it isn't working?
-
Hi, I am having an Issue inputting data into my database with this code.
I tested the connection, which works fine, but when I try to submit the form I get the "die("lid query: " . mysql_error());".
Any Ideas?
<!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title></head><body><form action="thispage.php" method="POST"><input type="text" name="name" placeholder="Check-in Name"><input type="submit" value='submit'></form><?phpif (isset($_POST['submit'])) {$name = $_POST['name'];$host ="localhost";$username = "username";$password = "password";$dbname = "database";$con = mysql_connect($host, $username, $password, $dbname);//Check Connectionif (!$con) {die("Could not connect: " . mysql_error());}//Select your databasemysql_select_db("database",$con);//Check to make sure the database is thereif (!$mysql_select_db) {die ('Can't use the db : ' . mysql_error());}//Run query$insert = mysql_query("insert into Users(name) values ('$name')");}//Check Queryif (!$insert) {die("lid query: " . mysql_error());}echo "Data inserted";mysql_close($con);?></body></html>
How to echo user specific data on landing page after login
in PHP
Posted
Hi, I am working on a website that users can log into from one page and administrate their users from another.
first page is index.php and second is admin.php. on the index page I have a form to login with that calls out
to a stand alone .php script called "checklogin.php" here is the code...