Running Mysql Code Within A Php File?
I have been given a some mysql code that I have to run within a website - I am familiar with mysql in terms of insert info and querying a database but I at a loss as to how to make this work.
the mysql code works in mysqladmin, but how do I call it into my php code?
BTW the mysql code creates a new record in the database .......
Also, I need to tweak the code so it runs in a loop for different variables - in php I would run a FOREACH query, how do I do it in mysql?
View Complete Forum Thread with Replies
Related Forum Messages:
Running MySQL Using A Dos Batch File
I am used to use MySQL on Unix, now I have to do some development for MySQL running on Windows machine. The following script works well in Unix but I am unable to run it on Windows. "MY_FLAG" is the one which is causing issue. Due to certain restriction in my framework, I can use the normal batch by supplying the .sql file while opening the mysql connection ( infact i need to run multiple source files) Code:
View Replies !
Running Mysql Commands In A Batch File
I am trying to automate a mysql command to upload data everymorning on a windows server. I have created a .bat file and entered the commands to login to mysql but when it gets to the mysql prompt it fails to complete the rest of the commands. cd c: cdmysqlin mysql TRUNCATE TABLE blah LOAD DATA INFILE 'blah.txt' INTO blah QUIT exit Is this possible?
View Replies !
Running Existing .sql File In Mysql Command Prompt?
I've seen "examples" of this in my book on MySQL, but it just shows the file on the prompt. It says that I can run an existing sql file - for creating a table - right from the prompt. However, it doesn't really explain how to do this in detail. I've tried : -h host - u user -D database -p < myfile.sql but it gives an error. How do I point it to the right file on my system?
View Replies !
Running An Existing SQL File
I hope this question is not too 'newbie' to answer.. I'm reading a book (PHP and MySQL web development by Luke Welling and Laura Thomson), and am getting an error on an example script. I'm trying to create tables using an existing SQL file through MySQL. According to the book, it should be done like this: > mysql -h hostname -u username -D database -p < file.sql (I've changed the hostname, username, etc.) However, I get the same error over and over again: ERROR 1064 (42000): ... at line 1. The book didn't even mention where to put the file, I've tried all sorts of things, but can't get it to work..
View Replies !
Running Script File
I want to write mysql code like create table ... and insert into ... in text file and run the codes in mysql. I have installed mysql in my machine windows xp. and the help says the mysql> source (filename) will work to run the code file. but it does no work. says could not open the file. I am not sure where should i put my code file and the extension of the file required.
View Replies !
Running Sql File From Shell Script
When i run the command "mysql -h host - u user - p password -D database <file.sql" (the file.sql contains an Update Scrpit) from command prompt /usr/test> mysql -h host - u user - p password -D database <file.sql i am able to run the file and i am getting expected results. When i copy the same string in a shell script (suppose in update.sh) and try running it from the command prompt /usr/test> . update.sh i get an error as "No file or directory found" i tried giving in the full path of file.sql and tried running hte shell script but it gave me the same results "No file or directory found".
View Replies !
Sql Code To Import File Locally
I want to import a file to create tables in a database on my machine from command prompt, I have done this beofre but a long time ago, I have put the file in the bin folder of the MySql directory, i thought the code was something like ..file.sql Can anyone tell me what it should be.
View Replies !
Error Code #1064 Trying To Import SQL File
Im trying to import an SQL query file but get this error: #1064 - 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 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=1' at line 28 Here is the code and the last line is line 28: ----------------------------------------- CREATE TABLE `carts` ( `id` int( 8 ) NOT NULL AUTO_INCREMENT , `visitor_id` varchar( 26 ) NOT NULL default '', `photo_id` varchar( 7 ) NOT NULL default '', `added` varchar( 14 ) NOT NULL default '', `ptype` char( 1 ) NOT NULL default '', `prid` int( 10 ) NOT NULL default '0', `quantity` int( 10 ) NOT NULL default '1', UNIQUE KEY `id` ( `id` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =1 .
View Replies !
Regular Text File How To Sql 2000 Table Code
i have a text file as follow, line with ¡°|¡±and {LF}, 8|-000000186075919.|+000000000387820.|2008-03-31|20010423| 9|-000000000003919.|-000000000123620.|2008-03-31|20010123| 8|-000000018623419.|+000000000381230.|2008-05-30|20010423| i want to sign char(1)£¬year decimal(18,3) , month decimal(18,3), trandate smalldatetime£¬update smalldatetime£¬after to sql table is as follow, sign year month trandate update 8 -186075919.000 387820.000 3/31/2008 4/23/2001 9 -3919.000 -123620.000 3/31/2008 1/1/2001 8 -18623419.000 387820.000 5/30/2008 4/23/2001
View Replies !
Running MySQL
I have installed mysql-3.23.54-win and it all seems to have gone OK .... now i want to run it and setup a database. I dont have an icon on the desktop and there is nothing in Start - Programs ..... start it from DOS prompt via C:> C:mysqlinmysql.exe and i get error 2003 cant connect to MySQL server on localhost <10061>
View Replies !
Running MySQL 5.0
I've just downloaded and installed 5.0 on my Pc/ win 98se. When I run the program MySQL Command Line Client, it appears to run for a second then disappears. I see the program flash open for a second and then it is gone.Complete newb needs some help.
View Replies !
MySQL 4.1 Running
I've been running mysql 4.1 for sometime and using phpMyAdmin (v2.6.2) to administer the databases. Using php scripts I can also update/insert etc the databases (maintained on my laptop Mac OS X Tiger). Suddenly, I can't get phpMyAdmin to load in the browser. I've also tried other MySQL GUI tools like CocoaMySQL and Navicat....they won't run either. I downloaded and installed phpMyAdmin 2.6.3-pl1 as well but no improvement. Why would mysql run but the admin apps not work?
View Replies !
Running MySQL From A CD-ROM?
I have used PHP and MySQL for a few years now. Just today I can across an application that had a MySQL database running locally off a CD ROM. I did not know this was posible. When the application runs it starts up the MySQL database without the user even knowing they are running it. It is pretty amazing. So I want to do the same thing. Is there any documentation on how to run MySQL locally. I would like to know how to build the database and create tables under these curcumstances.
View Replies !
Could Not Get MySQL Running
I went to MS-DOS to start the MySQL application by typing mysqld into the bin directory of where I installed MySQL but once I did typed the command and pressed enter this is all I got : A moment passed before I am shown the path of bin with no indication of MySQL server started. And also I have installed this as a window service.
View Replies !
Help Please Running Mysql On Os X
I am very new to mysql. I am using the sitepoint book 'Build your own Database Driven Website using PHP and MYSQL. I have installed mysql mysql-5.0.41-osx10.3-powerpc. Under preferences/mysql it indicates that the mysql server is running. When I try to access mysql through the terminal window I get a message - command not found. Or no permissions. I can go to the bin directory and list the contents - they seem to be there. I can't get past page 21/22 Post-installation setup tasks. I am also new to using the terminal window. I suspect I have missed something really basic - any suggestions on how I can get up and running would be much appreciated!
View Replies !
MySQL Code
I am scripting In ASP and with a DSN connection to mysql. I need a script which can query the database to see if two fields (username or email address) which are both submitted by a user exist anywhere in the database.I have tried various scripts so far, but none seem to work. PATH> User submits (joebloggs, joebloggs@hissite.com) > Check DB to see if either of these exist anywhere in the file. Connection String : 'Init the DB Connection on error resume next dim adoConnstep dim adoRSstep dim strQuerystep set adoConnstep = Server.CreateObject("ADODB.Connection") adoConnstep.Open "DSN=mydsn"
View Replies !
Running MySQL In RAMDisk
Have a very large database and due to performance requirements it seems that running MySQL in RAMDisk might be a good solution. Access to the database is through PHP.
View Replies !
Running MySQL Win32
I'm an absolute beginner and would really like to read something in the manual to solve this problem, but the manual just take care of Unix and Linux users. Because we develop on NT we wanted to install MySQL with Apache and PHP3 on a NT workstation for faster testing beside our Linux station. But I have problem to start the program (mysql.exe). It just gives back an error: Error 2003: can't connect to MySQL server on localhost 10061 Network is running, I can ping localhost. I don't know what to do to get it running.
View Replies !
Running Backup For Mysql
Can anyone suggest a reliable and inexpensive backup service for mysql? I have about 50 tables, of which I've been doing database backups daily on the server, then downloading the backup every couple days or so. The backup files are starting to get relatively large, and I'd like to find a service to backup to off site.
View Replies !
Running Mysql From Shell
I need to run this sort of querys from shell: delete from 3dinformatica where preco = " " ; CREATE TABLE tudotest AS SELECT DISTINCT * FROM 3dinformatica; DELETE FROM 3dinformatica; INSERT INTO 3dinformatica (cr_datetime,produto,vendedor,preco,link) SELECT DISTINCT cr_datetime,produto,vendedor,preco,link FROM tudotest; DROP TABLE tudotest; i wanted to put the mysql cmd in a file like mysql.sh and run it from crontab. i have about 100 querys like that i need to run at the same time.
View Replies !
MySQL Config Not Running
i'm trying to set up MySQL with IIS 7.0 on Windows Vista Home Premium. After you install MySQL, there's a check box to launch the config app. if i leave it checked, the app does not load. if i try to run the app by double-clicking its icon it gives me an error saying, "The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail." I cannot find the application event log, though.
View Replies !
MySQL Running Very Slow
I have the following INSERT SQL, which runs very slow (For 2 full days it had not done anything) on a 2 processor Compaq machine running Suse Linux. Code:
View Replies !
Running Mysql On Old Computers
I´m running mysql on a Pentium 166 Mhz with 16 Mb of RAM. Pretty old, right? I want to know if there is a way to improve performance. I don´t know, something about reducing the number of queries that it will respond or cutting out some features.
View Replies !
Slow Running MySQL?
I'm hoping someone may have an idea what could be causing the slow loading pages of my web-site. I'm not positive, but I'm relatively sure that it's related to a problem with MySQL database. I purchased a program called Sam3 for broadcasting our radio signal over the internet. The software requires the use of MySql in order to set up web pages for our web site. The problem is, that while everything works GREAT (requests can be made from the site, songs can be searched, the history of what we've played shows up) the pages load PAINFULLY slow. Other users of this software have had no such problems so I'm at a loss. I know from testing that the PHP script for the web pages is fine, I have plenty of bandwith both upload and download available on my DSL line, and while the computer running MySQL is behind a router I have tried plugging the DSL line DIRECTLY into the host computer and it makes no difference. For all appearances it seems the problem is that it takes MySQL forever to gather and provide the information needed for these pages. Does anyone have any idea what I should be looking at to solve this problem? I do not know the MySQL program at all, so I get somewhat lost when people start throwing out technical terms, but this has been really frustrating because no one else seems to have the problem and everyone so far has just told me to check the things I've already checked.
View Replies !
On What Port Is MySQL Running?
I'm running MySQL on my Mac, and I'm trying to figure out on what port MySQL is running. What can I type into Unix terminal to figure this out? Or can I find out some other way?
View Replies !
How To Use A Copy Of A MYSQL 4.1 Database In MYSQL 5 Running On Ubuntu Linux
We had a "permanent world" game server running on an older PC, under Ubuntu 5.10, using a MYSQL 4.1 database to store persistent data for the players, then the hard disk quit. We did back up our data on a regular basis, but didn't use MYSQL to do the backups, we simply copied the MYSQL/data/ folder to disk. So now we have a new hard disk, with Ubuntu 7.10 and MYSQL 5 installed. We have everything working, in that we have created the appropriate database and, using a simple test module of our game which will create some of the tables if they don't exist in the database, we can store and retrieve data from the database tables. The problem we have is how in the world do we get the data from the backup copy of the MYSQL 4.1 created database into the new MYSQL 5 database correctly? With 4.1 we could copy the contents of the database folder right into the database folder in the /var/lib/MYSQL/ folder, but this procedure didn't work with MYSQL 5. The files seemed to copy, as in the copy operation gave no errors, but we get an error that says the database is unavailable and to make sure the MYSQL server is running - it is, so we're stumped, and our game server is offline.
View Replies !
Beginning To Code MySQL
I'm teaching myself php/mysql for a specific purpose and I'm wondering if there's anything special I should look out for in my studies. Basically what I'm trying to accomplish is developing a page that will display a pre-populated list of video games and allow users to sort them by things such as title, release date, genre, ESRB rating, developer, etc; and in addition to those fields there will be another field with a short explanation of the game.As for updating the DB, I'm not sure yet if I'll just do it through phpmyadmin, or if I'd want to develop a front end for that on the site - in a password protected area or some such.
View Replies !
Separating Mysql From Code
I have an exorbitant amount of data that I would like to put into a MySQL database and eventually put into a LAMP-based CMS (by a professional developer) and eventually uploaded onto a website for all people to access. Is it possible to load information into MySQL before any coding is performed by a developer, before any parts of the CMS are scripted? Can MySQL operate on its own as a database independent from any coding or do I need a developer to set it up before data can be loaded onto MySQL? If this is possible, is there any sort of language I would need to be fluent in or can it be done using a graphic interface?
View Replies !
Forum Code Using MySQL/PHP
I am currently working on coding a forum for my website. I am fairly new to this coding stuff so i apologise if if this is something really easy. The way i have coded the forum so far is that one page will display a list of all the topics within that forum. It also displays the unique ID of that topic. The topic headings are set up as a link which when clicked i want it to search the database for all the replies that link to that topic. I have linked the replies to the topics using simply the topic ID. The problem i am having is i cant work out how to pass the ID variable along in my link, or how to code the link so it will find the replies for that particular topic. Maybe i have gone about it all totally wrong and need to start from scratch.
View Replies !
Is It Safe To Just Code For MySQL 4.1?
Is it safe to concentrate on just MySQL 4.1 in software that you offer for download / sell? Or should I still support MySQL 3.xx versions? If 4.1 went into production status in october 2004 then most hosters should have updatet their servers by now, but I cannot be sure about that. I never really looked at the new features 4.1 introduced up until now like Subqueries which are really useful and I would like to write just one DB driver.
View Replies !
I Cannot Get Php And Mysql To Talk, Help Please! My Code Is Below
Im on windows xp using mysql server 5.0, apache http server 2.0.59 and php 5.2.1.1 When I load the page it appears completely blank with just a white background. My code is below can anyone help please? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Our List of Jokes</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', 'root'); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } // Select the jokes database if (!@mysql_select_db('ijdb')) { exit('<p>Unable to locate the joke ' . 'database at this time.</p>'); } ?> <p>Here are all the jokes in our database/p> <blockquote> <?php // Request the text of all the jokes $result = @mysql_query('SELECT joketext FROM joke'); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } // Display the text of each joke in a paragraph while ($row = mysql_fetch_array($result)) { echo '<p>' . $row['joketext'] . '</p>' } ?> </blockquote> </body> </html>
View Replies !
Converting To Code MySQL
DROP TABLE VENDOR DROP TABLE PRODUCT CREATE TABLE VENDOR( VENDOR_CODE CHAR(2) NOT NULL CHECK(VENDOR_CODE IN('AR', 'MS', 'WW')), VENDOR_NAME VARCHAR(20) NOT NULL, VENDOR_ADDRESS VARCHAR(15) NOT NULL, VENDOR_CITY VARCHAR(15) NOT NULL, VENDOR_STATE CHAR(2) NOT NULL CHECK(VENDOR_STATE IN('WI', 'SD', 'WV')), VENDOR_ZIP_CODE CHAR(10) NOT NULL CHECK(VENDOR_ZIP_CODE LIKE'[0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'), VENDOR_PHONE_NUMBER CHAR(12) NOT NULL CHECK(VENDOR_PHONE_NUMBER LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'), PRIMARY KEY(VENDOR_CODE) ) CREATE TABLE PRODUCT( PRODUCT_NO CHAR(4) NOT NULL PRIMARY KEY, PRODUCT_NAME VARCHAR(30) NOT NULL, PRODUCT_ON_HAND INTEGER DEFAULT 0, PRODUCT_COST MONEY DEFAULT 0, SELLING_PRICE MONEY DEFAULT 0, PRODUCT_VENDOR_CODE CHAR(2) NOT NULL CHECK(PRODUCT_VENDOR_CODE IN('AR', 'MS', 'WW')) REFERENCES VENDOR(VENDOR_CODE) ) INSERT INTO PRODUCT VALUES('CHO4','CHESS SET',11,26.75,28.90,'WW'); INSERT INTO PRODUCT VALUES('DI24','DINOSAURS',14,3.75,4.95,'MS'); INSERT INTO PRODUCT VALUES('GL18','GLOBE',2,27.50,29.95,'MS'); INSERT INTO PRODUCT VA...........
View Replies !
Error Running MySQL Administrator On RH8
I have downloaded the latest version of mysql administrator 1.0.18. I followed the installation instructions, but when i am unable to run the program. I get an error saying: ./mysql-administrator-bin: relocation error: ./mysql-administrator-bin: undefined symbol: gdk_display_get_type Do you have any clue about what is happening?
View Replies !
How To Verify If MySQL Is Running On My Windows XP?
I uninstalled that and reinstalled that. Then it doesn't work anymore... I check the process of the "Windows Task Manager", but I couldn't find the fimilar mysql-nt.exe... Do you have any idea how should I fix this problem? Should I reinstall the whole XP system?
View Replies !
MySQL Administrator GUI Running Slowly... WHY?
We have created an instance or schema that contains over 14000 tables. It is a lot of tables. When we attempt to browse the tables in the GUI it literally takes 5 minutes or more for it to come back. Granted when using the Microsoft SQL Server Management Studio it is slow but doesn't take that long. After about a minute or so it gives the list and is kind of slow to scroll. Can this be fixed by optimizing the database? Is this just too many tables for mySQL to handle?
View Replies !
Detecting If MySQL Server Is Running
I write an application which saves/loads data to/from database. I created a table and I'm reading an informations from it. The problem is when server is stopped and my application tries to connect to database it terminates. I think it shouldn't happen. I want my application not to terminate while it can't to connect but give me some kind of error and continue its run. How can I do that? And at the end I would like to say that I'm writing my program in c++ using .net. My piece of code: ....
View Replies !
|