if the search form is blank, it should display an error that something should be entered by the user. it should only show those results which contain the keywords the user has entered in the search textbox.
however, if the user enters % or _ or +, it displays all results. how do i display an error when the user enters these wildcard ch...
Hi,
I'm looking to create an audit trail for my PHP web app's database (eg. capture inserts, updates, deletes).
MySQL triggers seem to be just the thing -- but how do I capture the IP address and the web username (as opposed to the mysql username, localhost) of the user who invoked the trigger?
Thanks so much.
-Ken
P.S. I'm working ...
I am trying to read in a series of tab delimited text files into existing MySQL tables. The code I have is quite simple:
$lines = file("import/file_to_import.txt");
foreach ($lines as $line_num => $line) {
if($line_num > 1) {
$arr = explode("\t", $line);
$sql = sprintf("INSERT INTO my_table VALUES('%s', '%s', '%s', ...
Hi,
Is there a way to create a new MySQL database, a new MySQL user and give the new user privileges on the new database all using PHP?
EDIT - should be pointed out this is run from 1 server to another, so Server A trying to install a DB/user on Server B
i've got this:
$con = mysql_connect("REMOTE.IP.ADDRESS","root","pass");
mysql_qu...
hi, I have read that after select we use column-names but I have found a statement that was like this:
SELECT 'A' FROM T WHERE A = NULL;
would you lease help me? thanks (A is a column- name here?)
my DBMS is MySQL
EDITED : the exact question is this that:
Will the above statement produce a row (select all that
apply)? Notice that ANS...
Hi,
I can not get the difference betwwn these statements? would you please help me,I have read some sample of select statements but I did not get these ones.
SELECT 'B' FROM T WHERE A = (SELECT NULL);
SELECT 'C' FROM T WHERE A = ANY (SELECT NULL);
SELECT 'D' FROM T WHERE A = A;
I use MySQL
EDITED: also it has a conditional part t...
I have a class variable called attributes which lists the instance variables I want to update in a database:
attributes = ['id', 'first_name', 'last_name', 'name', 'name_url',
'email', 'password', 'password_salt', 'picture_id']
Each of the class attributes are updated upon instantiation.
I would like to loop through eac...
For example this query:
SELECT `variants`.*
FROM `variants` INNER JOIN `variant_attributes`
ON variant_attributes.variant_id = variants.id
WHERE (variant_attributes.id IN ('2','5'))
And variant has_many variant_attributes
What I actually want to do is to find which variant has BOTH variant attributes with ID = 2 and 5. Is t...
In MySQL I've used LOAD DATA LOCAL INFILE which works fine. At the end I get a message like:
Records: 460377 Deleted: 0 Skipped: 145280 Warnings: 0
How can I view the line number of the records that were skipped? SHOW warnings doesn't work:
mysql> show warnings;
Empty set (0.00 sec)
...
Hi
Is there any way for setting all the rows of a column to a null value? thanks
...
I have the following tables:
TableA (id, tableB_id, tableC_id)
TableB (id, expirationDate)
TableC (id, expirationDate)
I want to retrieve all the results from TableA ordered by tableB.expirationDate and tableC.expirationDate. How can I do this?
...
I have asked this question before in this forum and they told me that it will return an empty result set. I want to know that if I set the column with null values, will it also return an empty result set? (Note: ANSI_NULLS is OFF)
SELECT 'A' FROM T WHERE A = NULL;
Also this is an example that I find confusing:
DECLARE @val CHAR(4)
SE...
Hi,
Please help me to create an array from a field of my DB. That field has records separated by comma. Below is the illustration:
ID | article_title_fld | article_tags_fld |
----------------------------------------------------------------------
1 | Learn PHP | PHP, coding, scripting ...
This IS NOT a Homework question! While building my current student database project I realized that I may want to identify comprehensive information about a database design in the future. More-so if I am fortunate enough to get a job in this field and were handed a database project how could I break down certain elements for identifica...
Hi, im currently trying to create a php script that when a new user register, a script (eg:wordpress,blog etc..) will install for them.
I'm currently got the code below for just single setup, but how can i setup a form for multi user? which only allowing them to input the username (subdomain) and password.
<?php
class scriptname_Config...
Hi,
I have just started to learn about the pros of foreign keys in database design (mySQL / innoDB) and I wonder if there's any way to temporarily bypass the foreign key when doing a specific delete query, to just delete in the parent table, and not from the linked child tables.
Thanks
...
Hi
this is my code which will not work correctly ! what is wrong with its data type :( thanks
CREATE TABLE T1 (A INTEGER NOT NULL);
CREATE TABLE T3 (A SMALLINT NOT NULL);
INSERT T1 VALUES (32768.5);
SELECT * FROM T1;
INSERT T3 SELECT * FROM T1;
SELECT * FROM T3;
...
I'm trying to combine data from two tables in MySQL with PHP.
I want to select all the data (id, title, post_by, content and created_at) from the "posts" table.
Then I would like to select the comment_id COUNT from the "comments" table IF the comment_id equals the posts id.
Finally, I would like to echo/print something on this order...
I have a variable in java which return type is Object(java.lang.Object). I want to store this variable value in MySQL database without casting in any other primitive data type. Is there any data type available in MySQL related to Object? If anybody knows, please reply at your earliest time.
Thanks,
...
I have to use hardcoded values for certain fields because at this moment we don't have access to the real data.
When we do get access, I don't want to go through a lot of work uncommenting.
Is it possible to keep this statement the way it is, except use '25' as the alias for ratecode?
IF(special.ratecode IS NULL, br.ratecode, speci...