Language: OO PHP 5+
DB: MySQL
I am trying to insert data from a form using radio buttons by getting their value and then inserting into a MySQL database. I can insert anything on the form that uses a textfield to collect data, but when I try to insert the value of a radio button the insert just leaves the corresponding db field blank. I...
Hello guys
so i am just getting to terms with using gwt and the rpc services that i can implement.
So i began with the gwt greeting service started project.(all gwt users know this starter app) all i wanted to do was to press the send button on the web page. it would retrieve a simple string from my database and display it on the webpa...
If I have an array of say, some ID's of users. How could i do something like this:
$array = array(1,40,20,55,29,48);
$sql = "SELECT * FROM `myTable` WHERE `myField`='$array'";
Is there a simple way to do this, I thought about looping through array items and then building up one big "WHERE -- OR -- OR -- OR" statement but i thought tha...
Hello,
Maybe I am just falling asleep (or not!), but how can you do this:
I have a table (many to many), let's say for example with fields key1 and key2, in which I want to select all the key1 that don't have a relation with certain key2. As an example, if I have the following:
k1_A --- k2_A
k1_A --- k2_B
k1_B --- k2_C
k1_C --- k2_D
...
I'm using php and need to do a bunch of select statements on the same table and column and get the rows that match those values.
I have all the values I'm searching on in an array and right now I'm just looping and doing a select statement on each one separately. How could I put this all into one select statement and ditch the loop?
Ri...
I need to have MySQL query like this one:
UPDATE table_name
SET
1 = 1
WHERE
ID = 257
But I got the syntax 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 '1 = 1
WHERE ID = 257' at line 3
Need to perform an UPDATE query without u...
I'm maintaining a database where the date and the time of events are seperated, both are saved as datetime though.
So How do I pull the date from the "date" Column, and the time from the "time" column and insert it into the "datetime"-column
...
I'm having troubles with a syntax error when trying to create a function in MySQL to convert a decimal grade into a letter grade.
What could be the issue?
ERROR 1064 (42000): 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 'conv(gpa DOUBLE)
RETUR...
Hello,
I have the following query where I combine two fields from two tables:
<cfquery name="SearchResult" datasource="MyDSN">
SELECT CONCAT(titles.TitleName, ', ', platforms.PlatformAbbreviation) AS Result
FROM
games
Inner Join platforms ON games.PlatformID = platforms.PlatformID
...
Hi folks,
I work with an OO database abstraction layer that I wrote. I have parameters you can set for cleaning up child records when the parent is deleted.
I was wondering if there are other, better ways to do this? Can you do this in mySQL via a stored procedure or other method?
Thanks for any advice.
JG
...
Assuming an InnoDB table, will the following command ...
CHECK TABLE table_name;
... cause MySQL to ...
a.) Check only the data content of the table
b.) Check only the index content of the table
c.) Check both the data content and the index content of the table
...
$offset = SELECT FLOOR(RAND() * COUNT(*)) FROM t_table
SELECT * FROM t_table WHERE LIMIT $offset,1
This works great in myisam but i would like to change this table to innodb (all other db tables are innodb) to take advantages of foreign-keys and avoid table level locking.
The primaryId field of this table is a VARCHAR(10)
I can't "fo...
I'm using SQLyog to sync a production database to a dev db. On 4 tables, I'm getting:
Error No. 1205 Lock wait timeout exceeded; try restarting transaction
Researching the web seems to indicate that a transaction has begun, locked tables, but has not committed. One post said to SHOW PROCESSLIST; but the only processes appear to be my o...
I decided that I would like to track the searches that users are making on my site, so I created a MySQL table called 'Searches' with a few simple fields, and a model (class) to facilitate the insertion and management of the saved searches.
The model function that saves the search is:
public function create() {
$q = $this->db->quer...
I have multiple functions, each running their own SQL query that needs to be inside a transaction... I'm using a static $link to save having to pass around links between functions... for example:
function db() {
$user = "username";
$pass = "password";
$db = "database";
$server = "localhost";
static $link;
if(is_null($link)){
$l...
Somehow I managed to make the date work,
<td width="67"><font size="3"><b>*Date</b></td>
<td width="3">:</td>
<td width="168"><input name="adate" type="text" id="adate" maxlength="20" value="<?php echo date("Y/m/d") . "<br />"; ?>">
how do I echo the time in this form:
<td width="67"><font size="3"><b>*Time</b></td>
<td width=...
Hello, I am trying to figure out how I can update my sql query dynamically.
On the main page, I have a pagination script that counts how many pages there will be:
<?php
function generate_pagination($sql) {
include_once('config.php');
$per_page = 3;
//Calculating no of pages
$result = mysql_query($sql);
$count = mysql_num_row...
So I'm running a query against my database and looping through the results and getting something like-
F.�B.�Webster�Day�
in most of the results. Those should be spaces but it must've been something weird during the import/conversion (damn you M$).
Is there a quick query I can run against the DB to remove all of those and replace the...
Right, so I've got a query that looks like this:
$bestof_query = "SELECT * FROM physicians p JOIN (awards a, categories c, awardLevels l) ON (a.id = p.id AND c.id = a.category AND l.id = a.level) ORDER BY a.category, a.level ASC ";
$query = mysql_query($bestof_query);
while($result = mysql_fetch_array($query)) {
extract($result);
ech...
+--------------------------+--------------------------------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------------------------------+
| character_set_client | utf8 ...