Hey Guys,
i have a project table which has a image_id field and a newsimage_id field.
Both are linked to the image table. But InnoDB doesn't allow me to set a foreign key for
both fields to the same column (id).
Is there a way I can do this or is it not possible?
I'm using MySQL through MAMP.
Thanks in advance!!
...
How do you query a MySQL table columns highest entry and store it in a variable. Here is what I have but it is not working.
$query = "SELECT MAX(date) FROM Records WHERE ips='$currentip'";
$result = mysql_query($query) or die(mysql_error());
echo $result;
Update:
<?php
$db = mysql_connect("localhost", "123", "123");
mysql_select_db(...
Is it possible to do something like this:
INSERT INTO table(col1, col2) VALUES(something_from_another_table, value);
With something_from_another_table being a SQL command? Like, is there something I can do that's equivelant to:
INSERT INTO table(col1, col2) VALUES((SELECT value FROM table2 WHERE id = 3), value);
...
Afternoon chaps,
Trying to index a 1.7million row table with the Zend port of Lucene. On small tests of a few thousand rows its worked perfectly, but as soon as I try and up the rows to a few tens of thousands, it times out. Obviously, I could increase the time php allows the script to run, but seeing as 360 seconds gets me ~10,000 row...
Can anyone please tell me how to write a small div container in HTML that refreshes its contents from the data in mysql every 5 min.
This is similar to twitter updates in some webpages which show updates as and when tweeted.
Thanks.
...
I'm using a DB table with various different entities. This means that I can't have an arbitrary number of fields in it to save all kinds of different entities. I want instead save just the most important fields (dates, reference IDs - kind of foreign key to various other tables, most important text fields etc.) and an additional text fie...
I'm designing an internal web application that uses MySQL as its backend database. The integrity of the data is crucial, so I am using the innoDB engine for its foreign key constraint features.
I want to do a full-text search of one type of records, and that is not supported natively with innoDB tables. I'm not willing to move to MyISA...
Hello, can't understand mysql error:
UPDATE static_pages SET order = " Some
new data 222222
"Database error: You have an error in
your SQL syntax; check the manual that
corresponds to your MySQL server
version for the right syntax to use
near 'order = "
$query = 'UPDATE someTable SET '.$key.' = "'.$value.'"';
Here ...
Hunting internationalization bugs here.
Does mysql has a variable which can be set per session, meaning the each connection will know the timezone of it's client and will act upon that.
If such variable does exists I would expect sql statements such as the following will return diffect values, based on connection session locale.
selec...
Hey guys, Im migrating from T-SQL to MySql syntax and don't know how to get over this syntax error given by Workbench 5.1.18:
-- --------------------------------------------------------------------------------
-- Routine DDL
-- --------------------------------------------------------------------------------
DELIMITER //
CREATE PROCEDUR...
Hi, I was wondering if someone could tell me if there is any potential security breeches that could occur by connecting to a sql database that does not reside at 'localhost' i.e. via ip address?
Regards,
Phil
...
Is it bad practice to create a mirrored table (MyISAM) of the records in an InnoDB table for the purposes of doing full-text searches? I figure this way I'm just searching a copy of the data and if anything happens to that data it's not as big of a deal because it can always be re-created. But, it just feels awkward.
(MyISAM is the onl...
Hi,
I was wondering if this is possible.
The serialize-string will be inserted in a mySQL-database, so it would be fine if all checkboxes would be inserted and not only the ones that is ticked(on).
it's possible to make on column in the database for each of the checkboxes, and use this if/else-statement:
if(isset($_GET['checkbox'])) {...
Hey guys,
So I have been given the host, username, and login information for a MySQL Database. I need a client that I can use to log in to the Database remotely and create/update tables and edit all the data.
I found the MySQL Administrator client provided by them, but it seems you can do everything BUT edit the actual data with it.
I...
I'm looking for an easy and quick way to print out the results of a MySQL SELECT query in PHP as preformatted text. What I would like is to be able to pass a query object to a function and get a printout of the recordset like the command line MySQL client does when running SELECT statements.
Here is an example of how I want it to look ...
Note: It is worth noting that the
mail() function is not suitable for
larger volumes of email in a loop.
This function opens and closes an SMTP
socket for each email, which is not
very efficient.
Source: PHP manual
What are larger volumes? A 100 or a 1000??
Can I safely make it loop 200 times without much problems? (I ...
(php) how to get date and time into one string ($moment) and if it works, can mysql do this:
SELECT * FROM table ORDER BY moment ASC
?
...
I was wondering how would you limit an uploaded image size to 5mb using PHP & MySQL.
...
Say I have a table with a unique positive integer field. I currently have rows with id's of [1, 2, 3, 4, 5, 8, 12, 35]. Is there a insert query that I could write that would assign the id field to the lowest unique positive integer (in this case 6)? It would have to do this atomically so there isn't the possibility of concurrent inserts ...
Hello,
I have two tables with similar columns - let's say table A with column LABEL_A
and table B with column LABEL_B. The data types of LABEL_A and LABEL_B are same.
How can I select LABELs from both tables in a single query? (So the the result of the query contains single column LABEL containing data from LABEL columns of both tables...