mysql

PHP MySQL Script Error?

I have the following PHP code that I can't seem to get working. I have looked over and over again for the error(s), but can't find it/them. <?php $actkey = rand() . "\n"; $con = mysql_connect("HOST", "USER", "PASS"); if (!$con) { die('Unable to connect: ' . mysql_error()); } mysql_select_db("TABLE", $con); mysql_query("UPDATE m...

MYSQL Select 5 records from one table based on several different values from another

I am by no means fluent in MYSQL. What I am trying to do is I have a table that has a list of Galleries with unique ID numbers. I have another table ImageData that has images that may be as many as 1000 that are related to each GalleryID that is in the first table. I want to do a select that will get 5 random records from each Gallery...

How to store and retrieve lots of data for date-specific retrieval + summary retrieval?

Simplified case: Storage Users click on a link link_clicks +1 for each click Super user sets a multiplier parameter for each click link_reward (+1 * param) for each click User ID is also recorded for each click Retrieval Queries must be done on a specific date range (e.g., "How many click between Oct 10 and Oct 23 for User ID = 4"...

"Update" function not working in IE 7 or 8 but works in Firefox

Internet Explorer seems to be ignoring this .live function call during updating records but it works fine in FF. if $("form#updateform").live("submit", function(){ line is changed to $("form#updateform").live("click", function(){ update function is working perfectly in IE but in Firefox if i click on any object it take...

MySQL Error When Using Apostrophes in Text Box of Autoresponder

I'm having a problem with apostrophes entered into the text box of the message area. I get an error message that the incorrect syntax is used and to check the mysql manual for the correct syntax. Below is the exact error I get. MySQL Error: 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser...

MySQL stored procedure skips id's when auto incrementing

Hi, I'm having some problems with my stored procedure. Hope anyone can help me figure out what the problem is. I use the data from weekly_schedule as a template for how fill my flight-table. I do this by calling CreateFlights(). All data get inserted as expected, so I'm not missing any data, but for some reason every third row is skippe...

CONVERT and CAST in MySQL query

When I'm trying to delete an entry from a MySQL table using phpMyAdmin, I always have CONVERT and CAST in the delete query. Why do they appear and how can I get rid of them? Example: DELETE FROM `table` WHERE `table`.`field_1` = 3 AND CONVERT(`table`.`field_2` USING utf8) = CAST(0x6338643263323430623864326531373436343263613537353165363...

Mysql Views "In Use" Error?

Hi, I created views in mysql database. Now when i query with them i got error table "view name" is in use. in phpmyadmin it is showing in use where it shows record numbers. I tried repair-table option from PhpMyAdmin tool, but it gives error "it is not a table". i'm not able to take backup of my database. what can i do? ...

Large Mysql Join

Assuming I have 2 large tables with well over 10 Million Rows in each table. Table 1 is a Movie table with a userID stating the user saw this movie, and Table 2 is a table of Music with a userID stating the user herd this song. What I want to do is be able to run a query whenever the user wants to know if there is a Song with the same ...

PHP - Best way to log user activity and display them on different pages?

I have got my website loggin user activity into a .txt file. I want to be able to show these results on my Admin area in separate pages. So page one shows 1-50 results and so on. But the problem I have is it's set out like this in the .txt file User: Admin IP Address: xx.xxx.xxx.xx Host Address: xxxxxxxxxxxxxxxx Date And Time: Monday 2...

Handling animated images with PHP

I already wrote a PHP script that allows users to upload images but I want to be able to allow my users to upload animated images. What do I need to add to my current code to allow animated images using PHP? A quick code example would help me out a lot. ...

How to create a Database for listing Buffet system of Restaurants ?

Restaurants have buffets. and Buffets have different spreads. i wanna enable photo and comments on each dish on the Buffet. not sure which is the best way to store them in Database What i have done ? I have a Restaurant Db that stores the general information of the REst. Dishes DB that stores Dishes of the Resturants. each dish is aga...

MySQL slashes and nl2br

Hi. I am trying to store HTML posted from a textarea into a database. I have a textarea inside a form which I have called "message". The PHP code that processes it is: if(isset($_POST['submit'])){ if(isset($_POST['title']) && isset($_POST['message'])){ $title = $_POST['title']; $message = $_POST['message']; ...

Migrating drupal site from a Windows to a Linux machine.

I had to migrate a drupal site from a Windows machine running the xampp package to a machine running Linux (Ubuntu 10.04). I exported the database to a sql file on the source machine and recreated the database using the file on the destination machine. Also, i copied my website folder from the source to the destination. I also made the ...

JavaScript countdown to MySQL datetime format

I have a date that comes from a MySQL database in the datetime format, something like 2010-09-24 11:30:12. And I need a way to show a countdown of hours:mins to that date. I'm not very familiar with dates in JavaScript so any help would be apreciated. Thanks. ...

Get the list of data from one table, and some count of records from another, is it possible to do in one query?

I have two tables - countries, tours. countries has fields (id),(name),(order) tours has fields (id),(id_country)... I need to get the whole list of id and name from table countries ordered by their order, and the count of records in table tours, where tours.id_country = countries.id countries. Ie, i need to get such list id na...

PHP - How to send emails to address on MYSQL?

Hey, How can I send emails to all emails on my database? E.g. here is my format of MYSQL. MYSQL -- Table = users --- column = email. I need to send emails to everyone of the email on column "email". Thanks if anyone can help me out. ...

Ruby: How can i extract just one MYSQL record in Ruby instead all with each_hash do

I know how to get all Mysql Results from a table and output it with each_hash.do in Ruby like this results = con.query "SELECT * FROM table" #results.each_hash do |row| $url = row["Url"] $name = row["linkname"] $id = row["ID"] #end But how can i get only one record extracted from results? ...

mysql_real_escape_string ISSUE

If I type ' into my search bar I get a mysql error as the "sting" has not been escaped- it think. But the reason why I cant escape it is because I dont think it currently is a string. the search box generates search results dynamically with ajax it is as I type and it finds the results that I get the error: You have an err...

display the mysql count function?

$query = "select count(*) from relationships where leader = 'user_id'"; $result = mysql_query($query); how can i display the count? thanks ...