Create A Table In MySQL From A .php File
Is it possible to create a mySQL table from a .php file? If so how?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
MySQL Table Create
Here is the code I'm trying to create the database with (I'm using phpMyAdmin so I just select the file I want to use and press submit and it creates the tables). CREATE TABLE bips ( banned_ip varchar(15) NOT NULL); CREATE TABLE messages ( entry_id double(16,4) DEFAULT Ɔ.0000' NOT NULL auto_increment, name varchar(25) NOT NULL, email varchar(35) NOT NULL, icq int(11) NOT NULL, http varchar(50) NOT NULL, message mediumtext NOT NULL, when int(12) NOT NULL, ip varchar(15) NOT NULL, UNIQUE entry_id (entry_id), PRIMARY KEY (entry_id)); ------------------------ phpMyAdmin gives me an error with that, (none of those tables exists btw)... the error is MySQL said: You have an error in your SQL syntax near 'when int(12) NOT NULL, ip varchar(15) NOT NULL, UNIQUE entry_id (entry_i' at line 8 .
Create Mysql Table
I'm trying to create a mysql table in php. i have no problems doing a select, insert or anything else. i just don't know what the proper code is to create a table if it even exists.
Create A Table Regarding A Text File
I have this .txt file : Roger|tow25$rank259 Isabelle|tow36$rank24 Pascal|tow12$rank29 Sergeï|tow45$rank5 Michel|tow1245$rank45478 Frédéric|tow1$rank125425 And this programm php3 <?php $fichier = "classeur.txt"; if($fp = fopen($fichier,"r")){ $ligne=1; echo "<table border=1 bordercolor="#00CCFF" width=500> "; echo "<tr align=center><td colspan=3>TITRE</td>"; while (!feof($fp)) { list( $name, $tampon ) = explode( "|tow", $fp ); list( $tow, $obj ) = explode ( "$rank", $tampon ); echo " <tr>"; echo "<td align=center><b>Nom".$name."</b></td><td>Tow".$tow."</td><td>Obj".$obj."</td[color=blue] >";[/color] echo "</tr> "; $ligne++; echo "</table> "; echo "$cell"; fclose($fp); }else{ echo "Error : open impossible ".$fichier; exit(); } ?> I would like to past each value of the lines in the tex file, in 3 variables $nom; $tow; $obj and create a table with 3 column ( column 1 the name, in 2 the tow, and in 3 the obj)
Editor To Create Table From MySQL
Does anyone know of a Windows editor I can use to design a table from a MySQL database? I have a end-user catalog I need to create. Nothing fancy - just display a few fields. I could hand code it, but do not have the time to relearn all the sql. No shopping-cart or anthing, just display fields.
PHP Script To Create MySQL DB From A Dump FIle
I just need to write a script that will read a dump file and just create the tables, ect. as specified from it. If anyone has a link or some simple code for this that would be great. Didn't think about this till i had done it, but i have the mysql create commands over multiple lines, so I can't just use: while (list($lineNum, $line) = each($dumpFile)) { mysql_query($line);}
Mysql Table Vs Log File
I have been doing some searching for a tutorial on creating a simple tracking script to attach to each of my pages. The tutorials that I found are using a log.txt file instead of a mysql database. can anyone explain why not use a mysql database
Downloading File Stored In Mysql Table Through Ssl
I have a table where I store some binary data. To retrieve this information as a downloadable file, I use the following code: header('Content-Type: $mimeType'); header("Content-length: $size"); // for filename, i store the filename in the table, so this does not actually // point to a physical file name on the file system header("Content-Disposition: attachment; filename=$fileName"); header("Content-Description: PHP Generated Data"); echo $data; return true; If I go through a normal port (http), the file downloads no problem. When I try this through ssl (https), I get the following error: 'Internet Explorer cannot download / from 192.168.0.9.' Through port 80, the filename is set correctly. Through ssl, the filename doesn't seem to be getting set. Is there a problem with using 'Content-Disposition: attachment' through ssl?
Using Php To Move Rows From Text File Into Mysql Table
Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql table. Then read the second line in text file and repeat.
Importing A Flat Pipe Delimited File Into A MySQL Data Table
I have done this in perl but eeew I don't want to use perl anymore. I want to be able to take a flat file that looks like this: mbriones@...|Marian|Briones bobsmith@...|Bob|Smith janedoe@...|Jane|Doe (etc) The table has more than 3 fields, so I'd want to process the flat file and then do an INSERT into mailinglist SET field=$value for each line. Does someone have a nice way for me to do this? The flat file will be uploaded to the server via a form (copy) and then be processed.
Create DB Table
how to create a table in a SQL database using PHP3. I can login via telnet and create a table but that is sorta worthless considering that I'd like to be able to do it via a browser instead. Would someone please post some quick code to point me in the right direction?
SQL Create Table From Pdf
I would like to use a routine which has as input a pdf form file and returns the SQL statement to create the table for a SQL database. Did someone know such a tool?
CREATE Table With PHP Script
I'm trying to write a PHP script that will create tables, so I'm working of a test script at the moment and I've been trying to use some code from a phpBB script to do this as while mysql has a nice mysql_create_db function they have no create_table function, not that I can find anyway. I can't find a similar problem from searching here either :-( The code I'm using is below... <?php include ("../cgi-bin/connect.inc"); $tables = array ("test" => "CREATE TABLE test ( testing varchar(20), )"); $result = mysql_query($tables); if ($result) {echo "YEY";} else { echo("<P>Error: " . mysql_error() . "</P>"); exit(); } ?> and it returns this... Error: You have an error in your SQL syntax near 'Array' at line 1 Something simpler such as <?php include ("../cgi-bin/connect.inc"); CREATE TABLE test ( country varchar(40) NOT NULL, UNIQUE country (country) ); ?> just gives an error on the 3rd line If anyone can point me in the right direction as to how to create tables with PHP scripts, which I know must be possible as phpBB manages fine.
CREATE TABLE Problem
I have a problem creating mySQL tables with PHP. I am making an app where a user can create a project. Pressing "submit" on proj_form.php goes to proj_add.php where a couple of things happen. The project's meta information is put into a project table, mysql_insert_id() gets the $proj_ID, and a table named that $proj_ID is created to hold all of that project's tasks. Here is my code to create the table for a project's tasks: // 2) Create a table for the tasks of the new project $sql = "CREATE TABLE $proj_ID ( task_ID int unsigned NOT NULL auto_increment, task varchar(40), person varchar(10), notes varchar(255), PRIMARY KEY (`task_ID`))"; Here is the error message that creates: You have an error in your SQL syntax near ' ( task_ID int unsigned NOT NULL auto_increment, task' at line 1 It has to do with trying to create a table named $proj_ID. How do I get that to work?
Create & Populate Table?
I am trying to do two things with one form: 1. Create a table in a MySQL database 2. Populate it at the same time So far I have been able to create it, but the population isn't going so well. Here is the basic code I am using. PHP Code:
Create Table From Variable
I need to know, how I can to do to create a table in PHP, taking de name for this table from a form variable.
Create A One Column Table
Using the following code, how do I create a one column table, with "Firstname, Lastname & Sex" as the heading. Also, how do I display the row data (i.e Firstname etc) using the following format?: Code:
Create Html Table With Php Result?
I'm looking to display 5 records in one rows, from the database. What i mean is, basically, let's take the "emails" as an example. I have a table with 100s of email addresses. Now i want to display these email addresses on a html table, but i want to display only 5 email adresses per table row, then the next 5 in the next table row and so on.
Urgent: Create Table If It Doesn't Exist?
I'm using a script what inserts data into a table (called "_$this" - e.g. "_2") like the following: Code: mysql_query("insert into _$this->uid (time,referer) values ('".time()."','$this->referer2'"); I need to check if the table "_$this" exists before inserting data and if it doesn't exist i'd like to create this table before inserting it like: Code: mysql_query("CREATE TABLE _$this (definitions)"); Means in simple steps: 1. Check if table exists - if yes -> step 3, if no -> step 2 2. Create table -> step 3 3. Insert data Any code snippet for a php-newbie like me?
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:
Create A Dynamic Table Javascript?
I have picture section where users can upload pictures to my website and I have created a basic way viewing these pictures but this is not astheticaly pleasing. So i was wondering if i could populate a html table with these pictures. The way this system works is that it uses a while loop that brings the date, url and also who uploaded the picture into the page. I was wondering if this information could be put into a table but i cannot see a way. Code:
Dynamically Create Table Rows As Needed
I have a form with a table. Each table row has a ID= "some number". I have 4 rows and might need to create more. how can i do this in php? To go along with this, When I hit the submit buton, I then need all the table row data saved to a db i have. I can insert 1 line with out a issue. I also made sure the table row name="" fields are unique. ex. Code:
Create A Link In A Table From Echo 'ed Sql Data
im using the following code to output everything in a database table under headings in an html table untill theres no more data left. The headings are things like name address etc. could i make it so when all the data is shown each name or ID becomes a link and when clicked takes the user to a more detailed page on the selected client. because of the way the table is generated there is no where to place link tags. is there a more appropriate way that is more editable? it would be nice to have checkboxes at the edge of each customer also to enable a complete status or deleting a client from the table. Code:
Create A Data Entry HTML Form For Given Table
I am working on a simple web site updating utility for a web site. Rather than hard code the data entry forms, I would like to automactically generate them based upon the table a user selects to update or insert into. What is the best way to approach this? for "insert" should I use the MySQL DESCRIBE table command and build a form element for each field according to its data type? for "update" should I use the DESCRIBE command to build the form as above and SELECT statement to populate each element with data, or should I just use a SELECT statement to retrieve the data and use php to determine the field type and choose an appropriate form element?
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:
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.
Create A Sequence In MySQL, With Mysql Variable?
This might be fairly easy to do and I think I've seen the code before, but I haven't seen many good examples of this. Of course Pear::DB probably uses this code in some of its API, probably in dealing with auto-increment indexes and prepared statements. Maybe I'm off base here, but I'm looking for something like this: (psuedo-code) Of course the seq table only needs 1 row holding id, which is updated. select id from tbl; // get result resouce and do fetch, store value in $myid set @myvar = $myid + 1; // can php send to MySQL with a query? ( never seen this ) update myseq set id=@myvar // send this statement through in a update/query // for use in PHP code $newSeqVal = $myid +1
Create A Sequence In MySQL, With Mysql Variable?
This might be fairly easy to do and I think I've seen the code before, but I haven't seen many good examples of this. Of course Pear::DB probably uses this code in some of its API, probably in dealing with auto-increment indexes and prepared statements. Maybe I'm off base here, but I'm looking for something like this: (psuedo-code) Of course the seq table only needs 1 row holding id, which is updated. select id from tbl; // get result resouce and do fetch, store value in $myid set @myvar = $myid + 1; // can php send to MySQL with a query? ( never seen this ) update myseq set id=@myvar // send this statement through in a update/query // for use in PHP code $newSeqVal = $myid +1
Can Php Create A New Txt File?
I'm trying to build an e-card page for a client using php, but they don't want to use a mySQL database, so I was wondering if PHP can create new text files when someone enters their information into a form and then the recipient gets an email with that txt file reference in a link and can then go to a page that populates with that particular text. Does it sound like I'm on the right path?
Can't Create New File
I have a small PHP script that will convert text into vcard format and write it to a new .vcf file (plain text). To write, I've used PHP Code:
Cannot Create File When Uploading
Hi. I use this script to upload file (taken by Zend.com website) This works locally, but when i upload to server i get an error. script... //$campofile is the file field filled before in a form... $archive_dir = "../folder1"; $filename = basename($campofile_name); $filesize = basename($campofile_size); $filetype = basename($campofile_type); if($campofile!='') { if(!copy($campofile,"$archive_dir/$filename")) echo "Error: $filename could not be uploaded."."<br>"; } After executing that script i get this error:
Create A Csv File On-the-fly For Downloading
I have a large database-created table on a page, that needs to have a "download as csv file" link (actually, as xcel, but I'll bet that's much harder to create). What's the simplest way to do that? Do I actually delete-and-recreate a csv file on the server every time?
Cannot Upload And Create File
I've written this script to upload files to my server, and if the file being uploaded is an image file, a thumbnail is automatically created along with it. But right now, after you select the file, and hit upload, you are brought to a blank screen. I check the directories, and the files are not uploaded. Everything LOOKS right, I just don't know what's wrong. PHP Code:
How Do I Create An Url That Downloads An Mp3 File?
i want to write a script that lets me create a url that downloads an mp3 file like this: http://domain.com/songs.php?m=killerfx and have that goto this file http://domain.com/music/abc.mp3 this is what I have so far, could someone help me with the missing part? <?php $m = $_GET['m']; $file = 'music/'.$m.'.mp3';?>
Create Downloadable Xml File
I need to make a downloadable xml google sitemap based off of mysql data. What fuctions would I use. I assume I would be using fopen to write it, but how do I make it downloadable. I don't want there to be a copy of it on the server (permissions wouldn't allow it anyway), I just want people to hit a button, generate the file, and download it.
Create Mysql Database?
How do I make PHP create a database for mysql please? I can see how to make tables and I have read all the documents I can find but I don't understand how to make the database itself. All the tutorials I can find seem to bypass the issue by ignoring it?
Script To Create Html File
I'm looking for a php script that will look in my images folder and for each image in there, create an html file named <imagename>.html and store it in a folder called "pages". I currently use the code inserted below that scans my image folder, creates an xml file that contains a list of the images and the my Flash image gallery reads the xml file to create the gallery. but I would rather do it by the method I'm requesting above and get away from flash. Any ideas? Even if there's a way to modify the code below to do what I want, that would be great. Code:
|