MySQL 'SHOW TABLES' Doesn't Show Temporary Tables?
I have a function call which creates a temporary table in MySQL, and then a second function call which operates on that temporary table.
I was hoping to do something like this in the second function call to ensure that the table was in fact actually created:
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'my temp table name'")))
// do something
else
//error
However, apparently the MySQL SHOW TABLES statement doesn't show temporary tables. Is there another query that I can use to show temporary MySQL tables so I can do this check?
View Complete Forum Thread with Replies
Related Forum Messages:
SHOW TABLES
I am working on some changes for a client, and we'll be altering the users tables as we go along. So from the one admin screen I want to get a list of the DB tables w/ the name '*_users' AND which contain one of the new fields, user_name. This doesn't work, but something like this: Code: SHOW TABLES LIKE '%_users' AND COLUMN user_name Does anyone know of a way to do something like that in one query? I know that I could get all the tables in a query, then loop through them an look for that field, but trying to find a one-step method here.
View Replies !
Run A Query To Show All Best From Various Tables.
I have a DB structure which has numerous falt tables. I am trying to run a query to show all best from various tables. The query on one table works fine, but I am unable to run a query that will show all perfrimances from the others(4 in total) This works, but on just one table. Union Query fails: $query = "SELECT DISTINCT fname, sname, club FROM out2006 WHERE event = '$ap' ORDER BY perf, mid, perf2 DESC";
View Replies !
Temporary Tables
Im trying to implement temporary table on one of my applications. I run this queries in succession directly from mysql. Code:
View Replies !
Temporary Tables And Mysql_connect
I want to use temporary tables on my site that hold data from a query. Every page load I do this: $Link = mysql_connect(....blah); Does that cause all the data in the temporary table to be deleted? After I create the temporary table the first time, everything works fine. But, when I open another page and try to get some of the data stored in the temp table, there is nothing there. So, I know the initial creation and insertion works, but it doesn't remain after I load a new page. If the $Link every page is causing a problem, is there a way I could store the $Link data and only connect when I don't have a connection?
View Replies !
Persistent Connections And Temporary Tables?
I'm having a heck of time understanding the way a few things work, or at least, the proper way to do them. To start off, I have a mysql 5 database that's loaded up with lots of stored procedures I've written for handling a firewall log table. When I started on my project, I didn't worry about things like multiuser ability, or pagination. Now that I've got a lot of the backend work done, I'm trying to improve the front end. My stored procs return their results in the form of a temporary table (engine=memory); as I understand the mysql documentation, a temporary table stored in memory exists only while the database connection is open, and is discarded once the connection closes. So that started me on a quest to maintain my connection to the database persistently across multiple page loads. This is were I start pulling my hair out. First I find that some group of developers in their infinite wisdom have decided to not support persistent connections in the mysqli (mysql improved) functions, to that end, there is no mysqli_pconnect function. I've tried mysql_pconnect, but the (old fashioned) mysql functions don't understand stored procedures, and I get an error back from mysql that the result cannot be represented (or something like that). So I started searching for alternatives. At first, I considered switching to postgres instead of mysql; pg offers sprocs and the php functions for it offer persistent connections. Rather than go the route of reconfiguring everything, I kept searching. I then came across the php odbc functions. They seemed pretty straight forward, and functionally similar to the mysqli functions. So, I installed an odbc connector on my server, and changed my code to use odbc instead of mysqli. Now I have odbc working correctly, the same way mysqli did previously. So now, I want to try to maintain a persistent connection. According to the php docs, I need to call odbc_pconnect first to setup the connection, and then when I want to re-use that connection, I can call it again with the same dsn, username and password. So lets say I visit index.php, which asks for a username and password, and then opens a connection to the database via odbc. I store the username and password in a session variable, which is subsequently checked by an include in all my other pages. The include grabs the u/p from the session array, and fires off another odbc_pconnect, presumably to reopen the db connection. So far so good; its all working. Now I decide to test if my db connection is actually being maintained, or just recreated. I fire off a stored proc using odbc_exec($link_id,"CALL mydb.myproc()") , followed by a query to grab results from the temporary table using odbc_exec again. This works as expected. However, in my code, I also set a session variable to indicate the sp has been run, so when I refresh the page, the sp will not be called, just the query on the temp table. This is where it breaks down. QuoteWarning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.0.22]Table 'ulogdb.summary_results' doesn't exist, SQL state S0002 in SQLExecDirect in /var/www/html/db/new_summary2.php on line 29 The table summary_results should still be there if my db connection had been preserved, however, it seems the db connection was closed somewhere along the way, and mysql destroyed the table. On a side note, odbc_pconnect causes apache to segfault if it passes an incorrect username or password to the odbc connector. Code:
View Replies !
How To Drop TEMPORARY HEAP TABLES After User Has Logged Out?
My web site uses Mysql and PHP3. I'm using HEAP tables for rapid access. A HEAP table is created for each user as they log in, and then dropped when they log out. The problem is that some users will leave the site without logging out, and I need to drop those orphaned tables so they don't choke my RAM. The ideal solution would be if there was some way to ascertain if the person has left the site and then trigger table removal, but I'm not familiar with such a "detector." Another idea I had is to make the HEAP tables Temporary Tables, hoping that they stay alive until the user leaves the site. But I can't find any good documentation on the behavior of Temporary tables. Specifically, I need to know whether a PHP persistent connection [mysql_pconnect()] will maintain the tables alive as the user travels from page to page and script to script, and then will die when the person logs out. Or does anyone have a better idea for handling this problem? I know I could also periodically run a script that would remove tables created for members who are no longer logged in, but I'd like another solution if I can find one. Any suggestions?
View Replies !
Checkboxes - Show A Tick In The Boxes To Show That They Have Already Been Added.
I have been trying to learn checkboxes and arrays, and I've finally figured out how to add the checkboxes to the database. I currently have two forms addlinks.php and modifylinks.php and I have a dolinks.php that submits my data to the database. What I would like to do now is on my modifylinks page show a tick in the boxes to show that they have already been added. At the moment if I dont tick any boxes on modifylinks.php it deletes my previous data, and I have to retick them everytime I do an update. Code:
View Replies !
Show Table Only If There Is Data To Show?
I have a table that shows specific data (via a while loop) however, when you first log in as a new user, you see the table column headers but there is obviously no data, and it looks a bit unsightly. How could i take this code:
View Replies !
Show First 10 Records, Then Show The Rest
Is it possible to show a fixed number of rows in a repeat region, then show all the rest? What I mean is - I've got between 40 and 50 records in a database and it's easy to show them 10 at a time. But what I'd like to do is show the first 10, then show all the rest in one go. Code:
View Replies !
Best Way To Show A Mysql Join
I have the following tables: students id, name,.... lessons id,description,.... studentslessons id,studentid,lessonid,grade I want to list the lessons of student with name="John" for example. The one way to do it is : select id from students where name="John" and grab the id. then select * from studentslessons where studentid=id; the other is select * from students,studentslessons where students.name="john" AND students.id=studentslessons.studentid Which is more efficient when using php4 and mysql 4.1? I'm using a rather old computer Pentium 800MHz.
View Replies !
MySQL Does Not Show On Php Info
I installed Apache, php5 and MySQL 5. The usual <?php phpinfo(); ?gives the php info, but there is no sign of MySQL, so something is wrong. I installed the latest connectors. Can someone help me getting php and MySQL interconnect?
View Replies !
Php And Mysql Show Only From List
i am calling all data from a database and listing it in a table. The main trouble is that some sections will have a large amount of data in them with different categories. for example, i have a db of mobile phone manufacturers and models. as you can imagine there are a lot of them. so far i have the data paged with 30 results a page and it is all listed in alphabetical order by manufacturer so it is relatively easy to find data if you keep clicking through the lists. what i would like to do is have a set of links (which i have done using manufacturer as the title). how do i use those links for the following: if i click on Nokia for instance, how do i get ALL Nokia only phones listed and not show any other data?
View Replies !
Mysql Show Results
I have a simple survey with a drop down that lets users select different depts in our organization. Displaying the results to a different page works fine, but I would like to create another, same looking, drop down on our results page that lets you view only the results for the selected dept. Or, if it would be easier to do it via hyperlinks.
View Replies !
Show Text From Mysql By Paragraph
I am trying to develop a site for news paper. i keep articles in a longtext field in Mysql. But when a retrieve the data from database. i lose all paragraphs. the total article in shown in one paragraph. But i want them be as it is the way i paste them. Pls help to do find out the solutions.
View Replies !
Show Images Using Mysql Data.
i have a script that can do ip2country and i need to show the flags on it but i dont know how to call the data from the database and then add the .png image extention on the end of it anyone know?
View Replies !
How To Show Mysql Error Message
situation: local test server problem: mysql error messages are not being written to the page. am banging my head over this, previously they were showing, however now they are not, if there is a mysql error the page is returned blank by the browser! php error messages are shown in the browser no problem perhaps i've inadvertantly changed a setting but i cannot think what!
View Replies !
MySQL Dont Show Older Than Today
I'm making a database for upcoming shows. so, what I wonder now, is there a way to show only upcoming shows, and just exclude the shows older than todays date? what I've got atm is: Code:
View Replies !
Create Links To Show Some Mysql Request
I'm trying to do something for about 3 days and I really see no way out on this... can be something simple, but I really suck at php... I have this php agenda that uses mysql DB... Then I have a search option that looks for event name, description of the event and date. Code:
View Replies !
Show Multiples Images From My MySQL Table
I have created a database whoose fields are photo_id Auto_INCREMENT Primary key, photo_type varchar(18), photo_size decimal(14,2), photo_date varchar(50), data mediumblob Now I have inserted three jpeg pictures pic1.jpg, pic2.gif, pic3.jpg in the database successfully, but when I am going to see multiple jpeg/gif files from the database in one html page then images couldn't come. Binary data's will show.
View Replies !
Actkey Isn't Updating In Mysql & Password Wont Show On Link!
Actkey wont update in MySQL I am running this on a new host, I have been working on it for days now and doesnt want to work, know matter what VAR I use Also when the email is sent, when visiting the link, doesn;t want to show the password on the page Well anyone have any suggestions? PHP Code:
View Replies !
Mysql And Tables.
I got a php file that imports it's info fram a database. And from that info it creates a table. This is for a game. And if it's more than one game running it creates another table below the first one. Like this: Code:
View Replies !
MySQL, 2 Tables
I have 2 tables, one of them is 'friends' another is 'users' I need to pull * from friends and attach 1 corresponding column from the users table to identify a picture. Tried this $sql = "SELECT msgs.pid, msgs.uid, msgs.run, users.di FROM msgs,users WHERE msgs.pid='$id'"; but thats doing some strange stuff.. any ideas?
View Replies !
Mysql To Tables
Basically I'm looking to a roster section of my site but looking to do it with the back of mysql. On the front end I'm looking to store a picture and a munch of txt. All seperated out into a table Lets say 2 rows with 2 coloms in the first row and one big one on the bottom. On the back end (where the user logs in with there user name and password I'm looking for them to be able to modfy just there section of output on the front end. (this I know how to do... just make a sql query for that user only ... Duh) Code:
View Replies !
Mysql: Get Max Id From Two Tables
mysql query to know the max id in two tables working: $m1 = $db->sql_fetchrow($db->sql_query("SELECT MAX(id) FROM users")); $m2 = $db->sql_fetchrow($db->sql_query("SELECT MAX(id) FROM users_temp")); $max = max($m1[0], $m2[0]); echo $max However...I would like to know if there is a short query to get the $max value
View Replies !
Mysql & Tables.
Is there a limit to how many fields you can have to a table and how many tables to a db, as i am converting my site to a db driven. I would need about 100 tables, and each table needs 12 fields.
View Replies !
UPDATE Mysql TABLES With PHP
Ok, I know I can update my tables using phpmyadmin, but it becomes very difficult when I have a table with hundreds of rows all with different information. Now, what I want to do is be able to change the information that is in the table already. Meaning...if I have customer A, B and C all with different attributes, say one of them calls me and wants to change his shipping address. I know I could go to phpmyadmin, search this customer and edit his info. But it becomes really hard when I have 200 customers who change their info, not only their addresses but Contact info, etc. Now what I am trying to do now is create a PHP script that will help with to accomplish that.
View Replies !
Connect Two Tables (mysql)
I have 2 tables in a database: 'artists' and 'albums'. I want to display the albums on a webpage like this: Artist #1 Album #1 Album #2 Album #3 Artist #2 Album #4 Album #5 The table 'artists' contains the fields 'artist_id' and 'artist_name'. The table 'albums' contains 'album_id', 'artist_id' and 'album_name'. Now I want to 'connect' both tables using the 'artist_id' fields. PHP Code:
View Replies !
Displaying MySQL Tables
I am creating a database that allows anyone to fill out a form and be added to the MySQL database. My problem is, I can't see who has been added. Could anyone please help me with the PHP code for this? I have tried the following: PHP Code:
View Replies !
Joining Tables In MySQL
Is there any speed different between SELECT a.cow_id, a.name FROM cow a INNER JOIN farm b ON a.farm_id = b.farm_id WHERE [conditions] and SELECT a.cow_id, a.name FROM cow a, farm b WHERE a.farm_id = b.farm_id AND [conditions] in MySQL?
View Replies !
Variables And Mysql Tables Ids
im wanting to create more tables inside a table called addressbook, i know how to do 2 located in table id=1 but want to add 2 in table id=2. my current script called create.php looks like this: PHP Code:
View Replies !
MySQL - Delete Across Two Tables. OT
i cant find the MySQL newsgroup, however i am hoping to pick up on some expert advice from php/mysql gurus here. I'm having some trouble performing a delete across two tables. The tables i have are: questionnaires (id, name); questionnaire_questions (questionnaires_id, id, name, qf_type) The questionnaire_questions table contains a list of questions for a specific questionnaire (indicated by the questonnaires_id). I would like to remove a questionnaire, and when doing so all corresponding questionnaire_questions who have matching id's (questionnaires.id = questionnaire_questions.questionnaires_id). I have this statement, however it only works if a questionnaire has questions... however i would like it to delete even if no questions exist for that specific questionnaire. The SQL i am using is: delete questionnaires, questionnaire_questions FROM questionnaires, questionnaire_questions WHERE questionnaires.id = questionnaire_questions.questionnaires_id AND questionnaires.id = THE_QUESTIONAIRE_TO_DELETE_ID
View Replies !
PHP Variables In MySQL Tables
I am working on a PHP application and am having some problems. All users are required to login with uname and psswd. I have some queries that users will be running, but they are different foreach user. (It searches a table for the logged in user's unique id). The query is stored in a MySQL table. When i retrieve the query and try and run it, it searches for "$user_id" instead of something like "8". Does anyone know how to convert a link in a saved query to an actual variable?
View Replies !
Multiple MySQL Tables
I need some help with tables in MySQL. I am making a colums of articles in my site. It has 3 posters that post articles. I make a little serach page to search for words into articles. I have the sintax below working, but I need to know what is the syntax to it select words from several tables. Every table is for a poster and all tables are in the same DB and have the same fields. --------------- $searchword="SELECT * FROM table WHERE comment LIKE '%$searchstring%'"; --------------- I tried --------------- $searchword="SELECT * FROM table, table1, table2 WHERE selected_row LIKE '%$searchstring%'"; --------------- and even make an ARRY for table, table1, table2 but it does not work.
View Replies !
Graphics From Tables In Mysql
I have a database with tables(mysql database) , my question=> how can i make graphics for those tables in php. Is it possible with interaction of excell ? doen anyone have a tut about it ?
View Replies !
Html Tables And Mysql
I just started with php and have been teaching myself and have now run into a roadblock.heres the problem im creating a product review page and so i have my display tables set to 500px in width. then in the td tags i have the code <?php echo $row["review"];?>now when i view it in my browser the data displayed in the tables is not word wrapping so the tables expand to fit the data so i end up with 2000px tables and i mean i have fixed widths but its ignoring that. is there any way at all to fix that? here is my table code below. <table width="500" border="1" cellspacing="0" cellpadding="0"> <tr> <td colspan="2"><?php echo $row["make"]." ".$row["model"];?></td> </tr> <tr> <td width="152"><?php echo $row["poster"]."<br>".$row["Date"];?></td> <td width="348"> <?php echo $cmt ?></td> </tr> </table>
View Replies !
Query 2 Or More Tables MySQL PHP
Is is possible to use more than 1 table in an SQL query and if so how would you stucture it. For example I am doing this site where there a 5 products and users log in to stock up on these products. The products are stored in a table along with a description and a path to a picture of the product. There is a second table that lists each product once for each user and stores that users buy price and mimimum stock qty. I want to make a query that I can display the name, description, picture etc of each product that that user sells, but show it with their buy rate and minimum qty. Code:
View Replies !
'Linking' Two Mysql Tables
This is one of those questions that involves PHP and MySQL so I wasn't sure where to put it. Anyway....What I want to do if possible is effectively 'link' two bits of data from two separate tables together. Code:
View Replies !
Join Two Tables In MySQL
I'm trying to join two tables in mySQL and both tables have a commonly named column. It works just as I want in PHPmyAdmin but when I use it from a php script I get 'undefined' for widget.widget_id. SELECT widget_name, widget_description, widget_category, widget.widget_id FROM user_widgets LEFT JOIN widget ON widget.widget_id WHERE user_id =$user_id AND user_widgets.widget_id = widget.widget_id I'm new to DB's and this is my first ever join query. What am I doing wrong?
View Replies !
|