Trying to create a table and insert records from a webform and I keep getting this message:
"Successful ly created the registration table.
Unable to execute the query.
Error code 1050: Table 'registration' already exists"
Then after the table is created I re-run the query/webform and I don't receive the error message, but it doesn't update my table?
When I go to mySQL it shows the table 'registration' but has no updated records.
I'm 99.9% positive my code is correct, but I've also been working on this for the past 4hrs, so I could be a little out of it - <?php
-
$DiverID = $_GET['diverID'];
-
if (empty($DiverID))
-
exit("<p>You must enter a diver ID! Click your browser's Back button to return to
-
-
the previous page.</p>");
-
-
$DBConnect = mysqli_connect("localhost", "root", "password")
-
Or die("Unable to connect to the database server.</p>"
-
."<p>Error code " . mysqli_connect_errno()
-
. ": " . mysqli_connect_error()) . "</p>";
-
$DBName = "scuba_school";
-
@mysqli_select_db($DBConnect, $DBName)
-
Or die("<p>Unable to select the database.</p>"
-
. "<p>Error code " . mysqli_errno($DBConnect)
-
. ": " . mysqli_error($DBConnect)) . "</p>";
-
-
-
$TableName = "registration";
-
$SQLstring = "SELECT * FROM $TableName";
-
$QueryResult = @mysqli_query($DBConnect, $SQLstring);
-
if (!$QueryResult) {
-
$SQLstring = "CREATE TABLE registration (diverID SMALLINT, class VARCHAR(40), days VARCHAR(40), time VARCHAR(40))";
-
$QueryResult = @mysqli_query($DBConnect, $SQLstring)
-
Or die("<p>Unable to create the registration table.</p>"
-
. "<p>Error code " . mysqli_errno($DBConnect)
-
. ": " .mysqli_error($DBConnect)) . "</p>";
-
echo "<p>Successfully created the registration table.</p>";
-
}
-
-
$Class = $_GET['class'];
-
$Days = $_GET['days'];
-
$Time = $_GET['time'];
-
$SQlstring = "INSERT INTO $TableName VALUES('$DiverID', '$Class', '$Days', '$Time')";
-
$QueryResult = @mysqli_query($DBConnect, $SQLstring)
-
Or die("<p>Unable to execute the query.</p>"
-
. "<p>Error code " . mysqli_errno($DBConnect)
-
. ": " .mysqli_error($DBConnect)) . "</p>";
-
-
mysqli_close($DBConnect);
1 10196
Ok, well sometimes i guess a little sleep is needed to solve a problem. My variables were not the same in two sections of my script. User error, please ignore.. : )
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Neo |
last post by:
Hi, I have dumped a database into the file named dbase.sql
when I am trying to recreate the database its giving the following
error.
can any one help me in this regard?
# vim dbase.sql
# mysql -u "root" project < dbase.sql
ERROR 1050 at line 19: Table 'columns_priv' already exists
Vasundhar/
|
by: Alicia |
last post by:
Does anyone know why I am getting a "Syntax error in Create Table
statement". I am using Microsoft Access SQL View to enter it. Any
other problems I may run into?
CREATE TABLE weeks
(
weekstart datetime not null primary key,
weekend datetime not null
)
|
by: Irfan |
last post by:
hi, All
I have a table in Access and I am using a storedProcedure (Make-Table query)
to overwrite this table.
It gives an error that 'Table Already Exists', which is true. But i want it
to continue overwriting the existing table and not stop and give me an
error.
In VB6 i would have used On error resume Next, but i havent got grips yet
with VB.net exception handling.
|
by: ineedahelp |
last post by:
Can anyone help me figure out why I continue to get a runtime error '3010' "TABLE qryMultiSelect ALREADY EXISTS'? Here is my code. thank you in advance for any help!!!
Private Sub cmbSelectionDone_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
|
by: deejow |
last post by:
Hi,
I want Access to return an error message that says an identical entry already exists. I do not want to set the field to 'no duplicates' because it is a name field and it is possible to have different entries with the same name.
It is for a Claimant Master table in Access 2007. Each claimant could appear in the Jobs table many times but should only have one record relating to them in the Claimant Master table. When I enter a claimant...
| |
by: OfficeDummy |
last post by:
Hello all!
I searched the Internet and this forum for a similar problem, but I found no help... Also, I'm a complete newbie to the fascinating world of programming, VBA and Access, so my question can very well be very stupid.
The tasks are:
1)Import an Excel table into Access
2)Add a new column and fill it with variables of date/time type.
Steps 1 and 2 need to be done only once, and I've almost managed to accomplish them. Now...
|
by: Brucels |
last post by:
I am receiving this error message when I attempt to open an Access 2000 .mdb file. I also receive it when I try to import from that file into a new .mdb file. I opened the file with no problem two days ago and closed it normally (as far as I know). The error started appearing yesterday when I first tried to open it. Unfortunately, the file was backed up overnight, so the previous version is not available.
I have read all of the references to...
|
by: sasimca007 |
last post by:
Hello friends,
What my doubt is, a page is already designed in that page a table exists, and i am doing a script like a radio button exixts and when click that radio button some function is called and in that function i want to create a extra row in that table which already exists on page. That is my problem.
How to insert a row dynamically in a table which already exists in the page?
|
by: Jason Hamilton |
last post by:
Hey all,
I have one of those strange issues where I swear I haven't run this code in two weeks and it was working perfectly when I ran it last but now I get an exception that I have not only never seen before, but can't figure out how to fix either.
I have built a WCF server application to handle passing data that is processed in native code to an ASP page (which is something that WCF is very good at), but when I try to open the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |