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?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing A Mysql Table Name Threw Php?
i have a membership system. one of the feilds in the 'users' table in mysql is called rank. it has 2 posibilities. 1 or 2. 1 means ur a regular member. 2 means your an admin. so in the admin panel, i want to make a part were you can change the rank on a certain user. i was thinking about maybe a html form kinda, where you enter there username, then php searches for it in mysql. when it finds the desired row, it will display there ranking in a dropdown menu. you can change the ranking in this drop-down, and then click submit. then php would change the ranking in mysql.
Changing A Row In A Mysql Database
I was just wondering, once you have a row in a certain column set....how do you change it with php for example i have a column named "cookie_hash" in my table...when the user logs in i want to update it every time with an md5 hash of their email and login time..I just dont know how to do so I have this part $hash= md5($email.date ("l dS of F Y h:i:s A")); But I just dont know how to do the query.
Changing MySql Database
Is there a way to change a Mysql database so the if the "result" column= win and a link is clicked to change it it automatically changes to lose without the user have to type anything/click anything. (Also vice versa).
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 ");
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.
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.
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?
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.
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:
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.
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....
Mysql Fetch_field Gets Table Alias, Not Real Table Name
After a SQL 'select .... from tablename alias' the mysql_fetch_field function returns a value $result=>table which will contain the alias, not the actual table name. Is there a way to get the actual table name ? I am running mysql 4.1 and php 4.4
Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'. There is one of each item in products and each product has it's own unique 'prodno' There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example: id = 1 prodid = 7001 qty = 300 price = 12.5 id = 2 prodid = 7001 qty = 400 price = 15.5 I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table. Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item.. This is all very confusing to me, and I'm the one writing it. Let's try one last time.. Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.
Update Table While Insert Data To Another Table
it seem like mine coding din work. [php]<? include("checkin.html"); $conn=mysql_connect('localhost','root','') or die ('Could not connect to server'); $today = date("Y.m.d"); mysql_select_db('hms', $conn); $ok = mysql_query("INSERT INTO check_in(ID,room_no,datein)values ('$ID','$room','$today')", $conn); if( $ok ){ $up = mysql_query("UPDATE studtable SET checked = 'checkin' where [ID] = '%ID'); if(mysql_affected_rows( $up ) == 1) { echo'Checked IN!' }else { echo'No such student to check in' }} else { echo'Check In FAILED, please check again'}?>[php]
Changing Php.ini
is there a way to change values in php.ini (like adding support for certain things) if you are not hosting your site yourself, like using a pay host?
How Can I Find A Name From One Table In A Text From Another Table?
I have one table with a description field and other info, and I also have another table with a list of names and picture url:s. When I display the text description on my site I'd like to know if there are a match with a name from the 'names' table in the text. Code:
Returning Table Name As Well As Fields From That Table
I am returning all fields from news and from regional, however I want to determine where the fields have come from when I ouput the data, therefore I need to return the table name with the fields. Is this possible? Code:
Changing Passwords
I'm using proftpd with mysql, it's working great. I creaded a site that a proftpd user can use to change his password, I also wrote another PHP script that monitors passwords and if a password is about to expire (90 days), it sends out an email to the user. Now, what I need help with is when a user enters a new password, I don't want this new password to match his previous 6 passwords.
|