I have a database that has two tables, one of which contains a foreign key back to the first. Similar to this:
Table1
id
description
some
other
information
Table2
table1ID
Some
other
information
For each table1 there can be any number of entries in table2. I need to create a form that allows user...
I am trying to do this in mysql:
UPDATE table SET value = value - 1 WHERE blah blah
If value is 0 and this is run value is set to 4294967295. This is because it is an unsigned integer so it is looping round back to the maximum value.
How would I go about making it stay on zero instead? Can I do this purely in the sql?
...
If mysql record with condition exists-update it,else create new record
...
I am using the following statement to load data from a file into a table:
LOAD DATA LOCAL INFILE '/home/100000462733296__Stats"
INTO TABLE datapoints
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n'
(uid1, uid2, status);
Now, if I want to enter a custom value into uid1, say 328383 without actually asking it to read it from a file...
This strikes me as an odd problem.
I have two classes representing tables in my database. The first simply has an int ID field and a varchar NAME field; it's *.hbm.xml mapping file contains the following (everything works as expected with this model):
<class name="CBaseDataProvider.Models.PC, CBaseDataProvider" table="pc">
<id ...
Im stuck, been trying to figure this out for 2 hours now. I have figured out the foreach loop, but cant figure out how to insert the data now.
here is my php, what am I doing wrong?
$query = "INSERT INTO images (thumb_path, image_path, main_image, project_id) VALUES ";
foreach($_POST as $key => $value) {
$query .= "$thumb_pat...
I am using Doctrine ORM for php and Zend MVC. I have a mysql database. When I insert into the database it is escaping quotes. In other-words when I enter
<input name="customer_name" value="Test'ed user"> ...
into my form, and assign to a doctrine object and save.
When I look at the database through the mysql command line I get
Tes...
I am working in PHP/MySQL.
I have a table in my database called hourly in that table their is a column named webaddress these are serialized. There are multiple rows of each column of webaddresses each is serialized.
I need to pull each row, unserailize them then put them into an array.
I tried using this bit of code but it only gr...
In my JSP/HTML files i use the following servlet to get blob-images from the MySQL-database.
<img src="/image?id=1" />
Image servlet
This is mapped to a imageservlet, who:
- gets a stateless session-bean injected
- uses the session-bean to lookup a product, based on the id passed in to the servlet
- streams this image out as the resp...
Hello, I have the SQL query:
$query = "SELECT yearoffiling, COUNT( id )
FROM files
GROUP BY yearoffiling
LIMIT 0 , 30";
How do I put the values from COUNT(id) inside a string?
Thank you.
...
I have 3 tables called:
Applications (id, name)
Resources (id, name)
ApplicationsResources (id, app_id, resource_id)
I want to show on a GUI a table of all resource names. In one cell in each row I would like to list out all of the applications (comma separated) of that resource.
So the question is, what is the best way to do this ...
Does anyone know about this?
...
I'm using SQLAlchemy as the ORM within an application i've been building for some time.
So far, it's been quite a painless ORM to implement and use, however, a recent feature I'm working on requires a persistent & distributed queue (list & worker) style implementation, which I've built in MySQL and Python.
It's all worked quite well un...
mysql_affected_rows is to get number of affected rows in previous MySQL operation, but I want to get affected rows in previous MySQL operation.
For example:
update mytable set status=2 where column3="a_variable";
Before this operation, status of some rows is already 2, and I want to get affected rows in previous MySQL operation, you c...
Yeah, so I'm filling out a requirements document for a new client project and they're asking for growth trends and performance expectations calculated from existing data within our database.
The best source of data for something like this would be our logs table as we pretty much log every single transaction that occurs within our appli...
i need to populate a table column which takes one of 30 different string values. Is it advisable to use enum here for speed up processing . Can anyone suggest better solution which is reasonably optimum for storage and processing(comparison)?
...
I have this code:
$page = $_GET['page'];
$res_per_page = $_GET['res_per_page'];
$start_point = (($page * $res_per_page) - $res_per_page);
$query.= " LIMIT $start_point, $res_per_page";
$qry_result = mysql_query($query) or die(mysql_error());
$total_pages = ceil($nr_ads / $res_per_page);
The variable '$nr_ads' ...
Im building a site where a user can add people to their "list". This list belongs to the user, but im wondering whats the best way to store/retrieve/loop through this list in a function, to show the people who are on the list, that they are there and who created it.
So once the list of usernames is created, i would assume store it in a ...
can someone give me help, please.
here's my basic html
<form action="addSomething.php" method="POST">
<table>
<tr>
<th>Add Data</th>
<th>Description</th>
<th>Quantity</th>
</tr>
<tr>
<td><input type="checkbox" name="data[]" value="sample1" /> </td>
<td class="desc">Newbie</td>
<td>2</td>
</tr>
<tr>
<td><input type...
Hi,
I would appreciate if people can point me towards some good websites where I can learn PHP and MySQL for a complete newbie in these areas.
I have the HTML, CSS and Javascript background but would like to venture out to PHP and MySQL.
Any help would be appreciated.
Thanks.
...