Hello i want to refresh my php every 3 sec this is what i have:
<?php
session_start();
include "../config.php";
$time = time();
$sql1 = "UPDATE login SET lastlogin = '" .$time. "' WHERE id = '" .$_SESSION['userid']. "'";
$res1 = mysql_query($sql1) or die(mysql_error());
$onlinetime = "10"; // 10 seconds
$sql3 = "SELECT * FROM log...
how can i write to a mysql table with ruby ? run SQL. for example, if the ruby script finishes, write to mysql table saying its done and how can i generate an absolutely unique ID ? kinda like youtube's id.
...
For class, I would like a to use PHP MVC framework very similar to ASP.NET MVC with NHibernate. I am very comfortable with ASP.NET MVC. I need to use PHP and MySQL. I would not like to be concerned with the SQL to save me time. I would like to just design my PHP model classes and controllers without all of that data-access logic behind i...
I now want to create foreign keys for all of my mew DBs. So far i have been using sqlite and MyIasm DBs so i havent used a DB that supported it. I am thinking i should install and use a MySql server with InnoDb (connected via C#).
My question is what can i use to actually see the FKs relations? I would like to see it by using a sqlite d...
I'm having trouble getting any information to display from this query. Anyone know where I'm going wrong?
Thank you!
$query = "SELECT * ".
"FROM comments, users ".
"WHERE comments.user_id = users.user_id ".
"ORDER BY comments.date DESC ".
"LIMIT 10";
$result = mysql_query($query) or die(mysql_error());
while ($row...
My fellow developers and I have our own development schemas on a shared MySQL development database. My assignment requires me to create triggers in my schema, yet I've been unsuccessful so far.
CREATE TRIGGER myTrigger AFTER DELETE on myTable
FOR EACH ROW BEGIN
-- DO STUFF
END;
MySQL says:
ERROR 1419 (HY000): You do not have the ...
Greetings! Been staring at this all day and can't seem to figure out why my update statement fails to update the field 'image_filename':
$fileName = $_FILES['image_filename'];
if($fileName["name"] <> ""){
$imageFile = $fileName['name'];
$destination = "../../../../assets/resources/images/".$fileName['name'];
move_uploaded_fil...
I've got a homemade ORM system that currently only supports auto-incrementing primary keys. This has worked well, but the time has come to support composite primary keys. I'm aware of the holy war between surrogate vs. composite primary keys, and I personally think there's a place for each. Anyway... :)
With an auto-incrementing primary...
Can I combine these 2 SQL statements? Currently running 2 queries. Trying to tighten up a bit.
First one:
SELECT * FROM (`cars`)
JOIN `brands` ON `brands`.`br_id` = `cars`.`brand_id`
WHERE `cars`.`id` = '185707'
Second one:
SELECT ROUND(AVG(rating)) as avg_rating
FROM car_ratings WHERE car_id = 185707
...
Are there any open source or commercial tools available that allow for text fragment indexing of database contents and can be queried from Java?
Background of the question is a large MySQL database table with several hundred thousand records, containing several VARCHAR columns. In these columns people would like to search for fragments ...
After some expected growth on our service all of the sudden some updates are taking extremely long time, these used to be pretty fast until the table reached about 2MM records, now they take about 40-60 seconds each.
update table1 set field1=field1+1 where id=2229230;
Query OK, 0 rows affected (42.31 sec)
Rows matched: 1 Changed: 0 Wa...
Hi friends,
I researched over the internet, but could not find anything...
I have a mysql db, and records at a table, and I need to get random record from this table at every page load. how can I do that? Is there any func for that?
Appreciate! thanks
SORTED:
link: http://www.derekallard.com/blog/post/ordering-database-results-by-r...
I am creating an online blog website and for each blog post, I'd like to have the user be able to create/edit/delete their own category so that they may categorize their post.
What is generally considered a good database design for user generated categories?
This is my proposed table design. (Is there a name for this type of db?)
USE...
I know I am missing something simple, I think in getting the combobox to access the array.
package my.freelancebillingapp;
import java.sql.;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ArrayList;
import javax.swing.;
public class billingInfoUI extends javax.swing.JFrame {
public billingInfoUI() {
...
I am new to all of this so bare with me. I am trying to set up my first PHP site and I really want to do it the right way. I am working on the form located: http://www.bwgblog.com/signup.
I have set up the following form:
<p><form action="/signup/register.php" method="post">
<label for="first_name">First Name</label>
...
I am working to use django's ContentType framework to create some generic relations for a my models; after looking at how the django developers do it at django.contrib.comments.models I thought I would imitate their approach/conventions:
from django.contrib.comments.models, line 21):
content_type = models.ForeignKey(ContentType,
...
jComboBox1.setModel(customers);
public class CustomerData {
private static final String JDBC_CONNECTION_URL = "jdbc:mysql://localhost/test";
private static final String DATABASE_USER = "root";
private static final String DATABASE_PASSWORD = "root";
// query to select customer data
private static final String SQL_FETCH_CUSTOMERS = "...
I am looking for a script to check my database to see if a username is already in use. I am new to PHP so talk to me like I am 10 (even though a ten year old can probably program better than me). I just want to check the database and return a true or false based on a variable that is entered in my form below. Also, I want to use an AJAX ...
Hi, I have a mysql database that holds content as a blob, for whatever reason those developers chose to use a blob is out of my control. Is it possible to convert the data to text and the data type to text?
...
I've set up a Rails app using MySQL, with the database 'DatabaseA'. My Rails app is a port of a PHP app that I've written earlier, so there's some data in the PHP app's database (DatabaseB) that I'd like to port over. It's not as simple as an export/import. I've made some schema changes to the database which would require me to manipulat...