I have an Codeigniter app (latest version of CI) that is writing a transaction to a mysql database. I'm fairly sure that I've got a foreign key constraint error occurring, but I can find no way to make CI tell me the specific error. mysql_error() comes back empty.
Can anyone tell me how to get Codeigniter to tell me the myslq error mess...
I have two tables which I need to select all rows from where the userid is $userid then sort them. I tried to use join but I couldn't even really get started on how to get it right. Can anybody point me in the right direction as to how to make these into 1 query?
$result1 = mysql_query("SELECT * FROM paypal_sub_info
WHERE ...
I have a table that contains a column called 'id' that is an INT that auto increments and is set to be the primary key.
I need to get the value of the generated ID after the query is run. I have the following:
String sql = "INSERT...";
Statement statement = sqlConnection.createStatement();
int result = statement.executeUpdate(sql, ...
Hi,
I am looking to create a function that gets me a random item from a mySQL table, but let's me keep the returned as the "item of the day". In other words, the item that was "the item of the day" yesterday should not be shown again until all other items have been shown as item of the day.
Any suggestions on how to do this in an eleg...
Hello,
I am uploading email addresses from a CSV file, via fgetcsv(), into a MySQL database. The problem that I am running into is that I cannot escape email addresses containing an apostrophe (or single quote).
So, O'[email protected] will not become O\'[email protected]
I know that this is supposed to happen, however I have been unable to f...
I was going through some code and noticed that UPDATE LOW_PRIORITY and DELAYED INTO used for inserting and updating database. what is is the use of this code?? why we need to use this??
any Ideas??
Do I need to use it in every insertion and updation for various tables in same database??
...
i have a problem with my coding. when i put 'where' in my query, it does not show anything. but when i do not put 'where' it display all the records. all i want is that, it will display the records of the current user that logged in..
please help me with this.
what will be the code for these?
anyone? :(
it will be a big help. thanks....
I want to export a table of mysql database using ssh so how can I take this one.
...
Hi guys,
I have a couple of CSV files I want to load into my database, but the CSV file contains many many more columns than in my database. How do I import only selected columns from the CSV file into my database?
For arguments sake, let's say the CSV contains a header row with the column titles A to Z, and then two million rows with ...
Hi,
I am trying to design a HA solution for an active-active site. Basically, Site A and Site B are both writing to the same table in a database that is position outside of Site A and B. This database is use in an event when either Site A or B fails, it could be use as a backed up. MySQL is being used here.
So i am wondering is there a...
I know how to remove files in order to make them impossible to recover. But, how do I remove rows from a MySQL table in a POSIX environment in a way that leads to the same results? I'm currently rewriting all data with a nullified string with the same length as the original data before I proceed with deleting the row. Does it work? If no...
I have a table named "categories" like this:
id int(11) NO PRI NULL auto_increment
name varchar(50) NO NULL
seo_name varchar(50) NO MUL NULL
parent_id int(11) NO NULL
total_projects int(11) NO NULL
order int(11) NO MUL NULL
i...
I have been trying to figure out how to do this and it seems that its not something that many people are trying to do in cakephp or I am just completely misunderstanding the documentation.. I am using the following query below to get a field value so I get a value where the "findbycreated" is 0... this part works fine
$unregisteredemail...
guys please check my codes in displaying record..
<?php
include("db.php");
$username=$_POST['username'];
$email=$_POST['email'];
$query="SELECT * FROM members where username = '$username'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?> <br /> <p></p>
Welcome back! Your details below: <br /><br /> ...
HI,
I am not frequent SQL coder, I use it only for a simple
tasks. I want to find a solution for a probably simple
problem.
I have two tables :
Master_tbl [fields: ID, Plant, Detail_Group_ID] and Detail_tbl [fields: ID, Group_ID, Plant]
Master_tbl
ID Plant Detail_Group_ID
1 Tree 1
2 Flower 2
Detail_t...
I am looking to learn more about databases (MySQL for starters), particularly about choosing the right approach (e.g. stored procedures vs views and triggers for data aggregation) in a situation.
Maybe this example shows what I mean: Yesterday I asked a general SQL question about aggregation of data and received the answer that "it depe...
I have a hits table with millions of records.
I need to show some charts on the data of the last month.
Does the solution of create a view something like :
CREATE VIEW ReportMonth AS SELECT * FROM Report
WHERE DayDate > DATE_SUB(CONCAT(CURDATE(), ' 00:00:00'), INTERVAL 30
DAY)
is good in terms of performance ,
Is there a better s...
Hi all, I know this might shock some but I just cant figure out what's wrong with this SQL statement.. it kills my head.
SELECT * FROM groups WHERE gname LIKE '%m%';
I am using mysql 5.1.41
...
Greetings to all. Newbie here. Question on preventing duplicated entry in my simple web form.
My table record user input from a web form, and distinguished by date e.g. DATE(). How to prevent user with the same name to enter information twice in a single date, e.g. same username cannot be entered twice in the same date, but can be enter...
Hey you guys n girls!
I have the following MySQL Query:
<div class="box" id="settlement1">
<?
$query = "SELECT name, pub, hospital, trade FROM settlements WHERE settlementID = 1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$settlem...