Database P0c79 - Table Personaldetails Error
I can't create a table in my database. I get the following message: Database p0c79 - table personaldetails Error SQL-query:
CREATE TABLE personaldetails (id TINYINT not null AUTO_INCREMENT, firstname VARCHAR (15) not null , surname VARCHAR (15) not null , password VARCHAR (10) not null , teacherstatus ENUM not null , PRIMARY KEY (id))
MySQL said: You have an error in your SQL syntax near 'not null , PRIMARY KEY (id))' at line 1.
I can't see what is wrong with this - it looks perfect to me, and there is no room for error as all I am doing is ticking boxes in phpMyadmin.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Error Checking For Unique Value In Database Table?
I am inserting data into user table which contains 5 fields, sounds simple enough normally but 2 of the fields are designated as UNIQUE. If someone does enter a value which already exists, how do I capture this specific error? Would it make more sense to actually run a SELECT query first and if that returned a result, then I use that for error checking and don't run insert until select returns nothing?
Error In Generating Table From Database Select Statment
I am trying to dynamically create a table with the results from a select statement. Below is the code that is not working. Any help would be oh so greatly appreciated. This is for a final at school which is due in an hour. This is the only thing I can't seem to make work. Code:
Table In Use Error
I have two tables in my DB that are marked "in use" and cannot be accessed. I have tried myself to get them cleared up, to no avail. If there's anyone here who can help, I will gladly pay via PayPal.
Content Of Database Table Twice?
Why does this code repeat the content of the database table? It connects O.K. but display table contents twice (I only need it once) Code:
Table Name In Ms Access Database
I'd like to know how can i get and store the table names of an ms access database. I use odbc_result_all but i don't know how to exctract and store information about the table name.
How To Search More Than One Table In A Database
Say I have a user input a search string and they click search. What would my mySQL string look like if i wanted it to search TABLE:'set_01' and TABLE:'set_02' at the same time for the same information?
Delete A Row From A Database Table
I'm trying to delete a row from a database table. I've made a connection yet it's not working. Is there something wrong with the following code? mysql_query("DELETE * from `contactinfo` WHERE Submission_Number = 1 ");
Changing A Database Table
Is it possible to change a table in a database without just dropping it and recreating it. As example, I have a photo column which stores an URL, but it seems to only be accepting about 25 characters. Is there a way I can update the table without starting it over? Also, when I made the photo column I think I put, photo varchar(25), is there any reason I don't want to make it like varchar(1000), although I know that varchar only accepts 255, so what do I change varchar to?
Selecting Whole Database VS One Table
In querying a regular DB you use the following code: $query = "SELECT * FROM table_name"; Well I want to be able to do something like this: $query = "SELECT * FROM database_name"; Here is my reasoning: I have built and intranet for the company I work for. I have imported all of the data requested from an Excel Spreadsheet into the corresponding SQL tables. Now for the page I am wanting to pull off my weird select db_name code works like this: I want to be able to go there and display the Table names within that DB and when a user clicks on one of the links it will reload the page displaying the results for the corresponding Table. Make sense?
Import CSV File Into Database Table
Are there any programs like phpmyadmin, that allow you to import CSV files without first converting them into mysql statements? mysql front? I've created the table and fields, and it should be easy enough to import the data into its respective columns.
Script Not Inserting To Database Table
I submit the form to insert the data into the table, when I submit the form for this script to process, The "if" statement is true because the "echo" statement in the else says so, but the else is what the script is doing. Can't figure out why. PHP Code:
HTML Table Fetched From A Database
I want to generate a HTML table based on names fetched from a database. The tricky part is that I want to generate the table so that the names is written on both the top row and the left collumn. Should look something like this ---------------------------------------------- | ||NAME 1 | NAME 2| NAME3| |NAME 1| | | | ---------------------------------------------- |NAME2| | | | ---------------------------------------------- |NAME3| | | | ---------------------------------------------- Hope that anybody has a idea how to solve this.
Putting Database Results In A 5x1 Table
I have a db of tens of thousands of entries. It's not too hard to pull all the entries and build a table that displays them one at a time, but in my case, that will be a huge waste of space. What I want to do is put one record in each of the columns. I thinks it's possible to do because I have seen very elaborate thumbnail gallery scripts to do this. I just want to be able to put two or three strings of text from each record into each row, and a checkbox. Here's sample of what I mean: <table width="76%" border="1" cellspacing="1" cellpadding="1"> <tr> <td>$record1Line1<br>$record1$Line2<br> <input type="checkbox" name="$record1checkbox" value="checkbox"></td> <td>$record2Line1<br>$record2$Line2<br> <input type="checkbox" name="$record2checkbox" value="checkbox"></td> <td>$record3Line1<br>$record3$Line2<br> <input type="checkbox" name="$record3checkbox" value="checkbox"></td> <td>$record4Line1<br>$record4$Line2<br> <input type="checkbox" name="$record3checkbox" value="checkbox"></td> <td>$record5Line1<br>$record5$Line2<br> <input type="checkbox" name="$record5checkbox" value="checkbox"></td> </tr> </table> I want to pull about 200 records at a time from the db and display as described above. How can I tell php to take five records from my result set and display above, then loop through the result set until I'm done?
Table With Weekly Schedule From A Database?
I'm designing a site for a community radio station and the schedule needs to be generated from the list of programs that are in the database the shows table has the following colums show_id, show_name, day, start_time, end_time (i didn't list the non-relevant ones for this portion of the site) because a table has to be built left to right instead of top to bottom (cell for monday 8am then tuesday 8am instead of all the monday then tuesday etc) and not all the programs are the same length (i think i can use row span="x" depending on the length of the show) I'm quite lost. should i have other colums? how do i query the database to pull the data out in the proper order and build the table?
Deleting A Table From A MySQL Database
I've looked at the manual and a few other php resources, but yet I couldn't find a simple and easy way to delete a table using php. I noticed there is a destroy() function within the MySQL class, but I'm not sure how it's used.
Extracting Database And Building A Table
I have a mySql database with tblDiary DateEmployeeClient 1/1/04SmithBloggs 2/1/04JonesUnited 2/1/04SmithCentral .....etc tblEmployee NumberName 1Smith 2Jones ....etc Thing is I need to get it to display HTML in a date table like this: MondayTuesdayWednesday...etc 1/1/042/1/043/1/04 SmithBloggsCentral_____ Jones______United_____ ....etc and if the user clicks on say Bloggs it takes them to the booking so it can be amended or if they click on _____ it sets up a new entry in tblDiary. I will be using tblDiary.Data and tblDiary.Employee as a compound primary key.
Output Database Entries In A Table
I'm trying to display the entries in a table of two columns, one entry per table cell - in other words, two entries per row, number of rows based on number of entries in the database. But it still doesn't seem to work. It displays one entry per row... I don't know where the problem is. Here's my code:
Obtaining Info From Database Table
How do you obtain fields from a table and assign each field to a variable to be used as needed. An example: Say i had: table name : user Field 1 : User name Field 2: Password then i wanted: $username = field 1 $password = field 2.
MySQL Table 1016 Error
I've been getting the following error: #1016 - Can't open file: 'table_name.MYI'. (errno: 145) for a few days now, the biggest problem is that its freezing the entire site and no searches can be performed as the table in question is the search log table. Anybody any ideas on how to fix it?
Mysql Error (dash In Table Name)?
How can I correct this error apart from eliminating the dash in United-Kingdom? Couldn't execute query 'SELECT * FROM United-Kingdom ORDER BY level DESC': 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 '-Kingdom ORDER BY level DESC' at line 1
Row Size Error On Create Of Table
I have a table that already exists in MySQL, and I want to add it to another database - but this time defined with the UTF-8 charset. This is part of some preparation to move from the default lation1 to utf8. I have exported my existing table to a .sql file and changed the latin1 reference to utf8. But when I run the SQL script to create the table in my other database it generates a row size error. Code:
PHP Function To Display A Database / Table Structure?
My webhosts cpanel is down for maintenence, including phpMyAdmin, and I need to view my database structure... Is there any function in PHP to display the database structure (like the "Export" function in PHPMyAdmin)?
Display Items From A Mysql Database In A Table
I am trying to display items from a mysql database in a table but I need it to start a new table row each time multiples of 3 rows of the database table have been displayed like the following example: item 1 item 2 item3 item 4 item 5 item 6 Does anybody know how I can make this work using php.
Putting An Array In A Mysql Database Table Field
I want to insert an array into my database but i've got a problem with it. Before i insert the array into the dbase i check if everything is in the array with print_r($array). Everything that should be in the array is in there so i insert it into the dbase. When i check my dbase with phpmyadmin the field that should contain my array has the word array in it so i assume the array is in the dbase. But when i retrieve the data from my dbase and check my array with print_r i get the following error: Warning: Argument to array_values() should be an array in.
Valid MySQL Database/table/column Name Regexp
regular expression in PHP which could be used to check that a proposed (My)SQL database/table/column name is valid, i.e. shouldn't result in an SQL error when created? The user of my (hopefully to be opensourced) program has the ability to create database/table/column names on the fly. I'm aware of obvious characters such as ., [space], things like >, etc., which won't work, but haven't been able to source a definitive list, including having googled the MySQL site. Obviously certain characters need to be filtered out, as noted above, but I want to be as unrestrictive as possible; hence just [a-z]* isn't good enough because things like _ are acceptable. Ideally, I'd prefer a regexp that applies to _all_ vendors' databases, not just MySQL as I'm about to migrate the program to being database-independent, probably using PEAR DB, but even a MySQL-specific regexp would do the job. In the longer term, I plan some sort of entity conversion script so that theoretically any character could be used, using some sort of escaping mechanism probably.
Deleting Duplicate Entries From MySQL Database Table
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone | ------------------------------------------------------- | mr x | 8th lane | 124364 | | mr x | 6th lane | 435783 | | mrs x | 6th lane | 435783 | | mr x | 8th lane | 124364 | ------------------------------------------------------- Quote:
Display Database Output In Mutli Column Html Table
I am building an HTML form using data from a mysql query. The data to be displayed on the form is 1 column from the db - but multiple rows. Because there are many rows (well, only about 100+) in the table I want to be able to put 2 or 3 (space permitting) rows from the result on each row of the HTML table with a checkbox beside each entry from the db table. The idea is that the user will scroll down the list and check up to 4 or 5 boxes before submitting the form and I didn't want them to have to scroll ALLLL the way to the bottom (100+ rows). I understand how to get data from a db table and put it into an html table, but I cannot figur out how to put more than 1 row from the result on to the same row of the html table. I hope I haven't confused anyone reading this -- If I am way off base with what I am trying to do please give me alternatives. I am trying to avoid paginating the data for a couple reasons a) clicking a next and/or prev button is more hassle than just scolling down a list and b) the data in the column being displayed is only about 35 - 40 characters and it seems to be if i only placed one result row on each html table row, there would be a lot of wasted space.
No Database Error After Upgrading To PHP 5
The only problem i see, is that on sites where i connect to the live database (i.e. host is mywebsite.com), and try to work locally on it, it gives me a 'No Database Selected' error, but if the database is local, then it works.
ERROR 1049 Unknown Database
I have uploaded a script to a server and it all works fine most of the time but occassionally I get the following error. ERROR 1049 Unknown database.If I press the refreseh it all works o.k. Is this a server error and is there any way to combat it.
PHP Error On Password Check (SQL Database)
I'm trying to get password recognition calling data froma table called users('user_name' and 'user_password' using the below (bottom of page) code. However, I get the following warning from my browser "Parse error: parse error, unexpected '' in /data/members/paid/g/l/ glastonburytv.eu/htdocs/www/check_password.php3 on line 19 This is the line I have replaced my password with "MY PASSWORD" Now I'm using the same connectivity activater (see line below) in other pages mysql_connect("localhost", "glastonburytv_eu", "MYPASSWORD") Does anyone please have any ideas why I'm getting the error message on the ";" (line 19) (Full Code Below) <html> <head> <title>Password Checking Script</title> </head> <body> <?php function print_form() { ?> <form action="check_password.php3" method="POST"> <h3>Please Login</h3> User Name: <input type="text" name="user_name"> <br>Password: <input type="password" name="password"> <input type="submit" name="submit" value="Login!"> </form> <? } if(isset($submit)): if(!$$db = mysql_connect("localhost", "glastonburytv_eu", "MYPASSWORD")); print("<h1>Can't Connect to the DB!</h1> "); else: mysql_select_db("glastonburytv_eu_1"); endif; $sql = "select * from users where user_name = '$user_name'"; $result = mysql_query($sql); $row_count = mysql_num_rows($result); if($row_count == 0): ?> <h3>Wrong User Name! Try Again</h3> <? print_form(); else: $row = mysql_fetch_array($result); if($password != $row["user_password"]): ?> <h3>Incorrect Password! Try Again</h3> <? print_form(); else: ?> <h3>Password Accepted!</h3> <? endif; endif; else: print_form(); endif; ?> </body> </html>
PHP Strange Error With MY_SQL Database
I have a MySQL database and I'm able to access it correctly. I am also able to execute select, update and insert queries, however I am getting warnings saying: "supplied argument is not a valid MySQL result resource" and the result set returned is empty (for queries other than select). Strangely, my die function includes the query but the query is not printed. I've however printed the queries before executing and they are fine too. Can anyone discover the problem? The code is as below: (please also note that as the code below has @'s the warnings are not displayed) if(($_POST['ADD'] == "1") || ($_POST['ADD'] == "0")) { session_start(); $cart_id = GetCartId(); // my own function, works fine $merchants = explode("_", $_GET['merchants']); $merchant_id = $merchants[(int)$_POST['merchantid']]; $connection = db_connect(); // my own function, works fine if($connection) { $where_clause = " WHERE `Session`= '" . $cart_id . "' AND `Product ID` = " . $_POST['productid']; $cart_query = "SELECT * from `Shopping`" . $where_clause; $cart_result = @mysql_query($cart_query, $connection) or die(mysql_error() . ": $cart_query"); $cart_row = @mysql_fetch_array($cart_result); $result = null; if($_POST['ADD']=="1") { if($cart_row) { $update_query = "UPDATE `Shopping` SET `Merchant ID` = " . $merchant_id . " , `quantity`= " . $_POST['quantity'] . $where_clause; echo $update_query; $update_result = @mysql_query($update_query, $connection) or die(mysql_error() . ": $update_query"); /* Error comes here */ if(($result = @mysql_fetch_array($update_result))) {} } else { $add_query = "INSERT INTO `Shopping` ( `Session`, `Product ID`, `Merchant ID`, `quantity` ) VALUES ( '" . $cart_id . "', " ..$_POST['productid'] . ", " . $merchant_id . ", " . $_POST['quantity'] .. ")"; $add_result = @mysql_query($add_query, $connection) or die (mysql_error() . ": $add_query"); /* Error comes here */ if(($result = @mysql_fetch_array($add_result))) {} } } else { //delete $delete_query = "DELETE FROM `Shopping` " . $where_clause; $delete_result = @mysql_query($delete_query, $connection) or die (mysql_error() . ": $delete_query"); if(($result=@mysql_fetch_array($delete_result))) {} }
Microsoft JET Database Engine Error '80040e10'
I am new to ASP, I am trying to create a page using ASP that will read from a database and write to my page, but I get this error every time: Microsoft JET Database Engine error ?e10' No value given for one or more required parameters.
Error 1044 Access Denied To Database
I am currently working through a book on Dreamweaver and using PHP. I am having a little trouble with setting up the database though. I have php 4.2.3 and MySQL 4.0.20a. I am running locally with Apache 1.3.27 on Windows XP Pro. I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:mysql ewland_tours.sql at the mysql> prompt, to generate the newland_tours database in my copy of MySQL. When I do this however it gives me an error message saying: Error 1044 Access denied for user: '@localhost' to database 'newland_tours' and numerous other ones saying: Error 1046 No Database Selected If you can help me I'd be very grateful. I think that something must be wrong or amiss with the settings or the paths to the files in my.ini file? Or perhaps it is just a bug with php or MySql?
Php - Update Mysql Database - Syntax Error
When i try and update the database table i get this 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 'desc='My name is ***** and I'm a 17-yr. old junior. I play electric ba' at line 1 what i am doing is having the user fill in a large text area and saving it to a database. So i think the problem could possibly be that they are using ' and " in textarea to mess it up? Code:
Mysql_connect Error Apache Web Server To Windows Hosted Database
I've got MySQL 5.0.21 running on Windows Server 2003, and php running on Apache on a Linux box (Fedora Core 4). Previously when the pages were running on an IIS server the connection was succesful, now I get: Can't connect to MySQL server on 'SERVER' (13) I'm connecting using: $db = mysql_connect("SERVER", "USER", "PASSWORD") or die("Could not connect to database: ".mysql_error()); mysql_select_db("DATABASE", $db) or die("Could not select database: ".mysql_error()); However from the linux box I can connect no problems using: mysql --host=SERVER -u USER -p
Deleting From Database, "SQL Sytax Error"
I searched the forums and I couldn't come up with anything, so I'm sorry if this has been solved before. But my problem is that when I want to delete a comment from the database, it just says, "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 '' at line 1". At line one I have a Session_start...and I doubt that would interfere with deleting. Here's my query: $com = $_GET['del']; if ($com != NULL && is_numeric($com)) { if ($ip == $okip) { mysql_query("DELETE FROM `comments` WHERE `id` = '".$com."' LIMIT 1 "); echo "Comment has been deleted.<META HTTP-EQUIV="REFRESH" CONTENT="2; URL=show.php"> "; } else { echo "You do not have permission to delete comments."; } }
Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?
Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for. Can anyone help me get the Agreed? table's background color to the colors above? Code:
Outputting A Table Or Form Using SHOW FIELDS FROM Table
In the code the MySQL database was queried using "SHOW FIELDS FROM table" which and the returned results of column names was then use to build an output for a form and a table with php using a series of if statements along the lines of if the returned field name matches something echo a text input field. I have never seen this done this way before, so I want to get the opinion of the devshed user. Does it seem like an unsual long process to build up a form. Is there a security advantage doing it this way? Has anyone ever done it this way before?
Finding Matches In A Table And Then Moving That Match To Another Table?
Ok, I have a database that has a table called critiera in this table is to fields on is ID and the other is critiera. Now I want to filter out all the one that don't apple to the list and move the one that match to a different database. I know how to open a connection, close, select but I don't know how I would inside of a database use another one as the way to create the list of critieras....
|