473,799 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[SOLVED] Error code 1050: Table 'registration' already exists

37 New Member
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
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $DiverID = $_GET['diverID'];
  3. if (empty($DiverID))
  4.     exit("<p>You must enter a diver ID!  Click your browser's Back button to return to     
  5.  
  6. the previous page.</p>");
  7.  
  8. $DBConnect = mysqli_connect("localhost", "root", "password")
  9.     Or die("Unable to connect to the database server.</p>"
  10.     ."<p>Error code " . mysqli_connect_errno()
  11.     . ": " . mysqli_connect_error()) . "</p>";
  12. $DBName = "scuba_school";
  13. @mysqli_select_db($DBConnect, $DBName)
  14.     Or die("<p>Unable to select the database.</p>"
  15.     . "<p>Error code " . mysqli_errno($DBConnect)
  16.     . ": " . mysqli_error($DBConnect)) . "</p>";
  17.  
  18.  
  19. $TableName = "registration";
  20. $SQLstring = "SELECT * FROM $TableName";
  21. $QueryResult = @mysqli_query($DBConnect, $SQLstring);
  22. if (!$QueryResult) {
  23.     $SQLstring = "CREATE TABLE registration (diverID SMALLINT, class VARCHAR(40), days VARCHAR(40), time VARCHAR(40))";
  24.     $QueryResult = @mysqli_query($DBConnect, $SQLstring)
  25.         Or die("<p>Unable to create the registration table.</p>"
  26.         . "<p>Error code " . mysqli_errno($DBConnect)
  27.         . ": " .mysqli_error($DBConnect)) . "</p>";
  28.     echo "<p>Successfully created the registration table.</p>";
  29.            }
  30.  
  31. $Class = $_GET['class'];
  32. $Days = $_GET['days'];
  33. $Time = $_GET['time'];
  34. $SQlstring = "INSERT INTO $TableName VALUES('$DiverID', '$Class', '$Days', '$Time')";
  35. $QueryResult = @mysqli_query($DBConnect, $SQLstring)
  36.     Or die("<p>Unable to execute the query.</p>"
  37.     . "<p>Error code " . mysqli_errno($DBConnect)
  38.     . ": " .mysqli_error($DBConnect)) . "</p>";
  39.  
  40. mysqli_close($DBConnect);
Oct 7 '06 #1
1 10196
delusion7
37 New Member
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.. : )
Oct 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6194
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/
2
13931
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 )
3
2914
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.
10
21515
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
6
19188
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...
15
16192
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...
1
4606
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...
7
5421
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?
0
2674
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...
0
9550
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,...
0
10495
Oralloy
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...
0
10269
jinu1996
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...
0
9085
agi2029
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...
0
6811
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();...
0
5469
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...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.