Hello
I am trying to parse XML using PHP DOM and then insert this data in MySQL tables, i am using the following code for this:
<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load("testrtap11.xml");
mysql_select_db("zeeshan_database1", $con);
$x=$xmlDoc->getElementsByTagName('RECORD');
$z=$xmlDoc->getElementsByTagName('TITLE');
$w=$xmlD...
Under high traffic my mysql 5.0.45 server /Apache2/ CentOS 5 is getting "Error establishing mySQL database connection". I need to find the root cause.
I would very much appreciate any pointer to information about the procedure I should take to find the cause (memory limit, thread limits, CPU load, slow queries etc, large dataset, wrong ...
Hello,
I am executing the following code (names changed to protect the innocent, so the model structure might seem weird):
memberships =
models.Membership.objects.filter(
degree__gt=0.0,
group=request.user.get_profile().group
)
exclude_count =
memberships.filter(
member__officerships__profile=req...
I have a mysqldump backup of my mysql database consisting of all of our tables which is about 440 megs. I want to restore the contents of just one of the tables form the mysqldump. Is this possible? Theoretically, I could just cut out the section that rebuilds the table I want but I don't even know how to effectively edit a text document...
I've got a bunch of tables that I'm joining using a unique item id. The majority of the where clause conditions will be built programatically from a user sumbitted form (search box) and multiple conditions will often be tested against the same table, in this case item tags.
My experience with SQL is minimal, but I understand the basics....
Hi.. I have a table that has a "view_count" column.
I would like to increment said column every time I select the row (even with a generic SELECT, such as SELECT * FROM table WHERE 1.. This would increment by 1 the view_count of all rows).
Is there a way to do it automatically "server-side" (where mysql is the server and my application...
I'm trying to make a WordPress site that has six lists on a page, each list showing posts from a different category. Simple.
But then, if a user selects a tag, taking them to that tag archive page, I want them to still see the six-list template, but all the posts within each category are also filtered by the tag. So lists of posts are f...
Using Wordpress, I need to generate an array of tags(terms) from posts in a particular category.
For instance, if I have two categories, "apple" and "orange", I want an array of terms that are only used in posts in the apple category -- not in the orange category. (though, if a term is used in both, that should be included)
I've tried...
I am running into a permission error when trying to load data from a flat file database dump into a new table. I know that the schema of the file and my table is the same and I tried tweaking the permissions. What else should I try?
mysql> load data infile 'myfile.txt' into table mytable fields terminated by ',' enclosed by '"';
ERROR 1...
Hello there,
I am having trouble with an SQL query that I have inserted into a piece of PHP code to retrieve some data. The query itself works perfectly within SQL, but when I use it within my PHP script it says "Error in Query" then recites the entire SQL statement. If I copy and paste the SQL statement from the error message directl...
I seem to go back and forth on this, sometimes it works for me, often it doesn't and I can't figure out how/why I can get it to work sometimes, and at other times it won't.
I have 5 databases, and need to grab data from each of them during a maintenance routine.
For each of the databases, I have an external file which contains all the ...
What would be the fastest way to add a new column in a large mysql table ?
Alter table add column creates a copy of the full table, and then replaces the old one with the new create table. While this process is running, the original table is readable, but all inserts and updates are stalled.
On large tables, the copy can take a long t...
I am trying to build a dynamic menu in my PHP CMS; the pages/categories are organized using the nested sets model.
Full tree:
root
A
B
B1
B1.1
B1.2
B2
B2.1
B2.1
C
C1
C2
C3
D
I want to convert this result set to an unordererd list, which only displays a part of the tree.
For example:
If I click on B, I want...
I'll admit I'm not 100 % on the inner workings of PDO and MySQL, so I'll give an example to make my question clearer.
I'm making a rather crude browser based strategy game, because I think it's a fun way to learn PHP and databases. I was bug-testing the battle script when I came across a rather unexpected bug. I use Cron Jobs to call a ...
We have a very simple method that uses "findById".
public Cart getCart(long cartId) {
Cart cart = null;
try {
dbSession.beginTransaction();
cart = (Cart)dbSession.findById(Cart.class, cartId);
dbSession.commitTransaction();
if (logger.isDebugEnabled()) {
logger.debug("The getCart call committed successfully");
}
} f...
I want to convert an Object into a String in PHP. Specifically, I'm trying to take a mysql query response, and I'm trying to convert it into something I can write to a file and use later.
Of course, when you try to write an Object to a file, PHP appropriately yells: Catchable fatal error: Object of class DB_result could not be converted...
I've just started reading about php, it needs me to install php, apache and MySql to run any php script. can any one suggest me a simplest method to install php, apache and MySql so that i can sun those php script.
I've tried the zip files from php.net, Are those required to run the script offline for practicing the script? what do i do ...
I have to retrieve only particular records whose sum value of size field is <=150.
I have table like below ...
userid size
1 70
2 100
3 50
4 25
5 120
6 90
The output should be ...
userid size
1 70
3 50
4 25
For example, if we add 70,50,25 we get 145 which is <=150.
How would I...
I am developing a big application using PHP. Is MySQL or SQL Server the best one to use?
...
I have a server-side php-script that fetches results from a MySQL table. I am trying to retrieve these results from within an iPhone OS app. I am using the following method:
NSURL *myURL = [NSURL URLWithString:@"http://www.someurl.com/login.php?id=anid"];
NSArray *sqlResults = [[NSArray alloc] initWithContentsOfURL:myURL];
//Show me wh...