mysql

How do I get all data from a mysql table via php, and print out the contents of every cell ?

Hi. I've got a database table with at least three rows in it. From php, I have successfully connected to my db and extracted all table information with 'SELECT * from mytable' . Now I want to loop through first each row, and then each cell, printing out the contents of each cell. I know this might be a simple task for a more experienc...

How to keep backup of our database in MySql.

I want to keep backup of my database and import it into different System? and how to make .dmp or store file in MySql? ...

how escape quotes when inserting into database in PHP

Hi all, I'm quite new to PHP so sorry if sounds such an easy problem... :) I'm having an error message when inserting content which contains quotes into my db. here's what I tried trying to escape the quotes but didn't work: $con = mysql_connect("localhost","xxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); ...

C# Application process hangs after some time

Hi, I implemented a simple C# application which inserts about 350000 records into the database. This used to work well and the process took approximately 20 minutes. I created a progress bar which lets you know approximately the progress of the records insertion. When the progress bar reaches about 75% it stops progressing. I have to m...

Can a trigger for a table can be applied for tracking in same table?

Can a trigger for a table can be applied for tracking in same table? That is IF I have table Say "employee" Now can i create a triggers such that it tracks the change in the same "employee" table trigger such as create trigger "<triggers_name>" before insert on employee For each row Begin insert into employee field = timestamp; end ...

Passing GET variables from Flash to PHP with Chinese characters

Hi Everyone, I'm calling a php file from Flash and adding variables afterwards like so: http://www.randomwebsite.com/something.php?title=爸爸 It works fine if I copy and paste this directly into the web browser, however if I call it through flash, the address bar would end up like this: something.php?title=?? Is there anything I can do ...

How to increase the default BLOB size using ActiveObjects

My group is working on a Defect Tracking project. We cannot figure out how to increase the default 2MB blob size up to 2GB, or even increase it at all. We have been getting errors when we try to manually set it in our Database. Anyone who can help would be great, we are programming in Java, using eclipse. ...

Automated Appointment Reminder

I need to create a web application using php, I had many users having appointments on different days and time. What I need is to send emails say 1 day, 6 hours and 1 hour before their respective appointments, cron job seems to be the option but how to run script at the specific times(when email has to be sent) for every user? ...

problem with date() function

i save in mysql database the time using NOW() function. how can i change the value returned of NOW() function? i want to add 6 hours. example if now() returns 2010-04-03 20:16:27, i want to save 2010-04-04 02:16:27 ...

MySQL parameter resource error

Here is my error: Warning: mysql_query() expects parameter 2 to be resource, null given... This refers to line 23 of my code which is: $result = mysql_query($sql, $connection) My entire query code looks like this: $query = "SELECT * from users WHERE userid='".intval( $_SESSION['SESS_USERID'] )."'"; $result = m...

Issue with duplicating a MySQL database

I'm trying to "clone" a MySQL database. The problem is with views. When I export a view, the .sql defines the view as database_name.view_name. It doesn't do this for tables, just views. This obviously creates a problem when importing to the second database - the view doesn't get created. ...

AJAX: Display MySQL data with value from multiple select boxes

I'm using the W3 Schools example: http://www.w3schools.com/PHP/php_ajax_database.asp to display a table of database data given the choice from a single select box. How can I modify this to include another select box, say for example I wanted records matching a name and an age? ...

mysql on delete cascade do not work

I'm trying to use ON CASCADE DELETE in mysql db but I can't make it work. Here is my code: CREATE TABLE sometable ( testId CHAR(43), blocked BOOL, PRIMARY KEY(testId) ); CREATE TABLE p ( testId CHAR(43), phrase text, source text, FOREIGN KEY (testId) REFERENCES sometable (testId) on delete cascade ); CREATE TRIGGER sometable_insert ...

How to get the age from a birthdate using PHP & MySQL?

I ask my users for their birthdate and store it in my database in the following way $month $day $year output May 6 1901 but I was wondering how can I get the age from the stored birthdate using PHP & MySQL? Here is the PHP code. if (isset($_POST['submitted'])) { $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mys...

Database Design Question

Hi, I am designing a database for a project. I have a table that has 10 columns, most of them are used whenever the table is accessed, and I need to add 3 more columns; View Count Thumbs Up (count) Thumbs Down (Count) which will be used on %90 of the queries when the table is accessed. So, my question is that whether it is better to ...

sprintf and % signs in text

A problem I recently ran into was that when trying to update a field in my database using this code would not work. I traced it back to having a % sign in the text being updated ($note, then $note_escaped)... Inserting it with sprintf worked fine though. Should I not be using sprintf for updates, or should it be formed differently? I d...

mysql error in php

i'm trying to run this php code which should display a quote from mysql, but can't figure out where is it going wrong. the result variable is null or empty. can someone help me out. thanks! <?php include 'config.php'; // 'text' is the name of your table that contains // the information you want to pull from $rowcount = mysql_query("sel...

Unique text field in MySQL and php

I've created a salt using; md5(rand(0,10000000)); (there is probably a better way?) There doesn't seem to be possible to make a text field unique in MYSQL. So how do I check if the salt has already been used for a previous user? Or should I generate the salt based on the current date/time? as it is impossible for 2 users to register at...

sphinx questions about searching multiple columns

if i am trying to search "a b". a appears in column x, b appears in column y. when i do SPH_MATCH_ALL the row does not show up.. ...

MySQL connection timeout

I'm running program at apache tomcat server, that should be on permanently, but every morning(the client part isn't accessible at night) i receive error message (in apache tomcat console) that MySQL server is off. So is there any way to prevent this? Thanks in advance! ...