I'm in the process of designing the database schema for an application that in the future could involve spreading some tables over several databases due to the number of entries a single user might make. I'm currently designing table relationships keeping common best practices in mind, but I'm not thinking about server architecture, tabl...
I have this code converting a mysql query to json:
$sth = mysql_query('SELECT * FROM `staff` ORDER BY `id` DESC LIMIT 20') or die(mysql_error());
$rows = array();
while($r = mysql_fetch_array($sth)) {
$rows[] = $r;
}
print json_encode($rows);
Works great, but i have in my database, a url field, here is a sample json row:
{"0":"4"...
And here i am again! ;)
Im developing (well, im still in planning phase) a web-app where i would give to other developer the possibility to write theyr own plugins/modules (in the way of CMS does, drupal, joomla, etc).
My problem is that i have to force the developers to use the methods i wrote for interact with databases, for many rea...
i am installing a mysql database for the very first time on my web hosting.
and am stuck. what value to put in $host in connection config of mysql DB?
the rest i know. till now i have been using localhost. now i am going live. from where to get the host information?
...
I've been using InnoDB for a project, and relying on auto_increment. This is not a problem for most of the tables, but for tables with deletion, this might be an issue:
AUTO_INCREMENT Handling in InnoDB
particularly this part:
AUTO_INCREMENT column named ai_col: After a server startup, for the first insert into a table t, InnoDB exe...
On facebook many of you probably know of there API which uses there own FQL (facebook version of a mysql query)
I am curious, how could I support my own user submitted queries in the same manner on my site?
Do you basicly pass in the custom query into a function, in the function you just use regex to match SELECT from ect?
Hope m...
What are the differences/advantages of each? Disadvantages?
I'm not looking for coding preferences or subjective answers.
What are practical diferences? (Storage, implementation, how the code looks, environment requirements...)
...
so i have a page where a user can submit his own links
i dont want to make a script that do everything automatic, i just want to make a page where, when the .php find a possible duplicated link, i get a warning like "ID 22 could possible have the same link as ID 738"
i only need like the query to do that...if its possible with that..i ...
I am using a mySQL database on a site to calculate the distance of multiple points based on zipcodes, latitudes and longitudes.
E.g. Point A at zip code 123456 has latitude 100 and longitude 200
Using a static formula, the distance between Point A and multiple other points are calculated and returned real time. The reference Point A may ...
I am writing a server which provide a service by query MySQL database.
Everything goes fine, except when run one or two days the connection will go away.
The error code is (2600, MySQL has gone away)
I try to wrap the cursor object by:
def cursor(self):
try:
return self.connection.cursor()
except:
self.conne...
I'm building a system that has a user table and a project table. I'm trying to determine the most efficient way to connect users to a project.
I'm was thinking about a table that records the relationship, but I wasn't sure if a serialized list in one field would work just as well.
...
i am trying to connect mysql via php through following code
$dbhost = 'localhost';
$dbuser = 'root';
$pass = 'pass';
$con = mysql_connect($dbhost,$dbuser,$pass);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
mysql_query("UPDATE cbdb SET fax = '36160'
WHERE cemail = 'test_cemail@g...
I've got two databases on the same server. The Google gave me some hints but there wasn't anything "official" that I could find. Could someone point me to the documentation that explains how to do this? An explanation using PHP would be useful as well. Thanks!
...
I have a database with static tables which require to be updated from CSV weekly.
Tables are Mysql MyISAM and by static i mean they are used for read only (except when updated from CVS, obviously).
There're about 50 tables and in total about 200mb of data to be reloaded weekly.
I can think about 3 ways:
Truncate table
Load data from ...
i am using the dreamweaver cs4 "insert into" function to manage multiple forms on a single page. but i am having difficulty editing the code so that it:
inserts data from the form into the table
retrieves the id of the newly added row
echoes a confirmation message on the same page and a link containing the id (as a reference)
here i...
Is there a way to specify the parent query field from within a subquery in mySQL?
For Example:
I have written a basic Bulletin Board type program in PHP.
In the database each post contains: id(PK) and parent_id(the id of the parent post). If the post is itself a parent, then its parent_id is set to 0.
I am trying to write a mySQL que...
I've shown up at a new job and discovered database which is in dire need of some help. There are many many things wrong with it, including
No foreign keys...anywhere. They're faked by using ints and managing the relationship in code.
Practically every field can be NULL, which isn't really true
Naming conventions for tables and column...
I want to store the timestamp which a row was inserted into a MySQL table with the row, to be later compared to other times. What's the best field type for this and what's the best way to insert the row with the timestamp in PHP?
...
Hello all,
During the installation I need to create new MySQL user, new database and populate it from dump file. My question is how can I do it from command line (cmd, Windows)? I mean, I'm calling for cmd from some script, which can start mysql command line client with root privileges but I cannot pass parameters to mysql form outside....
I'm inserting some HTML into a MySQL database table. But when I get it back, many characters are mangled. Two specific cases I noted are:
the single quotes are getting converted to �,
code that earlier read class='content-section developer-support' has got converted to developer-support\="" class="\'content-section"
I understand tha...