mysql

how to get something to display only once in a while loop

I've got a mysql query running and it checks to see if an iterator is equal to 1, then display this div title... if ($this->dliterator == 1) {echo "<div class='clientsection' id='downloads'>Downloads</div><br/>";}; The problem is, is that the dl iterator may not necessarily start at 1. (it is directly related to a downloadid from the d...

Need help with transferring data between MySQL db's using PHP

In one of the sites I manage, the client has decided to take on ACH/Bank Account administration where it was previously outsourced. As a result, the information submitted in our online form which used to simply store in a single database for processing now must sit in 'limbo' until the funds used for payment have been verified. My origin...

How can I limit the number of registrants to an event?

I've set up a basic html/php submission form where people can register for our event, but need a way to replace the submission form webpage with one that reads something like "We have reached our registration limit" when we reach a certain number of submitted forms. Our database is MySQL (if that makes a difference) I've looked around on...

EXPLAIN and COUNT returning two different values

i am doing: explain select * from calibration; it says 52133456345632 rows when i do: select count(*) from calibration; i am getting 52134563456961 can someone explain whats going on here? ...

Prevent duplicate rows with all non-unique columns (only with MySQL)?

How do I prevent a duplicate row from being created in a table with two columns, neither of which are unique? And can this be done using MySQL only, or does it require checks with my PHP script? Here is the CREATE query for the table in question (two other tables exist, users and roles): CREATE TABLE users_roles ( user_id INT(100) NOT ...

should i be creating an index for this?

i am adding data from vba excel using adodb into a mysql database everything works great but is slow. the entire process takes about 5 seconds. i believe the reason it is slow is because i am filtering it: Dim rowid_batchinfo As String rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "'...

how often should i be indexing?

i asked the question of whether an index would help me: http://stackoverflow.com/questions/2961834/should-i-be-creating-an-index-for-this i understand that since i am adding code every time in this procedure, i would need to re-index. in this case is it even worth it to index every time? ...

analyze table, optimize table, how often?

in mysql i have 3 tables. one is 500,000, another 300,000, and finally around 5,000 they each get maybe 50-500 additional rows daily should i run analyze and optimize table on them? if so then how often? ...

Storing Sessions in a DB in PHP - keep getting mysql error

Hi guys, I want to store all my sessions in a DB and have read up on this and implemented the following class: <?php /** * This class handles users sessions and stores the session in the DB rather than in a file. This way stops any * shared host security problems that could potentially happen. */ class sessionHandler { /** ...

Data Modeling of Entity with Attributes

I'm storing some very basic information "data sources" coming into my application. These data sources can be in the form of a document (e.g. PDF, etc.), audio (e.g. MP3, etc.) or video (e.g. AVI, etc.). Say, for example, I am only interested in the filename of the data source. Thus, I have the following table: DataSource Id (PK) Filenam...

How do you hook a C++ compiled dll function to a sql database?

I want to do something like: lastName SIMILARTO(lastName, 'Schwarseneger', 2) where lastName is the field in the database, 'Schwarseneger' is the value that lastName field is being compared to and 2 is the maximum number of characters (edit distance) that can differ between the lastName field, and the entered value. I can implement the...

is it possible to write a method which creates a method?

hey guys, this might seem like a no brainer but hopefully after i explain my problem you might understand why i am asking this. is it possible to have a method which creates a method and its arguements? the problem: in my current project i have to many times call different sql statements which arent all that different. for example i...

Textarea to refresh using jQuery/MySQL

OK so let's say I have a textarea on the top of my browser and a text input box on the bottom. I want to connect a MySQL database and also whatever I type in the input box to appear in the text area. Sorta like a text RPG... I know PHP, MySQL, good AJAX, and little jQuery. I just want to know how this is achieved. Thank you. ...

Getting single value from a single row with Mysql/PHP

Often I just need to get a single value from MySQL that I know exists there. I use the following construct: $result = end(mysql_fetch_array(mysql_query('SELECT FOUND_ROWS()', $db))); Is there a proper single function in PHP that would do this? ...

MySQL join not returning rows

I'm attempting to create an anti-bruteforcer for the login page on a website. Unfortunately, my query is not working as expected. I would like to test how many times an IP address has attempted to login, and also return the ID of the user for my next step in the login process. However, I'm having a problem with the query... for one thi...

PHP mysql select results

<?php $sql = " SELECT e.*, l.counts AS l_counts, l.date AS l_date, lo.counts AS lo_counts, lo.date AS lo_date FROM employee e LEFT JOIN logs l ON l.employee_id = e.employee_id LEFT JOIN logout lo ON lo.employee_id = e.employee_id WHERE e.employee_id =" .(int)$_GET['salary']; $query = mysql_query($sql); $rows = mysql...

replicate a single table

Is it possible to replicate a single table? ...

how to make secure sign up form

i want my sign up form to be secure from hacker..i want all secret information can't easily open by wrong people.. i wan't some data become encrypted.. how to make it?? ...

Is a primary key automatically indexed?

Is it true that in MySQL the primary key is automatically indexed? ...

show data from database in table format inside form

I have an input form connected to a database. After [the form is submitted], I want to make a form to show all the data which has been input to the database. I want to show this data in table sortable by name or date. Please help me. ...