How do I insert two rows into two different tables. I can't seem to get this right?
Here is the code below.
// tag is not there, so insert a new instance
$mysqli = new mysqli("localhost", "root", "", "sitename");
$clean_url = mysqli_real_escape_string($mysqli, $page);
$dbc = mysqli_query($mysqli,"INSERT INTO q_tags (tag_id, users...
For example, a website like stackoverflow.com, is it a good practice to use email address to identify users in many tables?
Is it bad if the primary key is very long, say
varchar(50)
or even
varchar(100)
?
...
Hi guys, I need a quick look at my SQL query. It's already given me a headache. Comparing some advice I have gotten, I could not figure out the proper format for my SQL.
This is my code:
$query = "INSERT INTO `[my_db_name]`.`members` (`id` ,`first` ,`last` ,`add1` ,`add2` ,`phone_home` ,`phone_cell` ,`phone_dad` ,`phone_mom` ,`email1` ...
I have a question I'm trying to have the q_id column take the value of the id column when a tag is submitted I have been trying to do this using PHP but I was thinking should I just add AUTO INCREMENT to the q_id column since but tables are updated when the tag is submited. or is this the wrong way to do it or is there a better way to do...
This is probably a really stupid question, but is there going to be much benefit in indexing a boolean field in a database table?
Given a common situation, like "soft-delete" records which are flagged as inactive, and hence most queries include WHERE deleted = 0, would it help to have that field indexed on its own, or should it be combi...
I can update almost everything in both my mysql tables when somebody enters a tag I just don't know how to add the tags tables id value to the q_tags tables tag_id value which will be the same when the user enters the tag.
I hope I explained this okay.
Can someone please help me.
Here is the MySQL tables below.
CREATE TABLE q_tags (
...
Hi All,
Is it possible to create a trigger on a table that is initiated when ANY dml is performed on the table?
For example -- I need to ensure that no insert/update/delete statements can be run on the weekend. So, instead of writing:
CREATE TRIGGER DENY_DML_1 BEFORE INSERT...
CREATE TRIGGER DENY_DML_2 BEFORE UPDATE...
CREATE TRIGG...
Hello, another 3 table query here. I have a table reservation, customer_service, and billing.
I am trying to select roomtype from reservation and some other fields from billing "ON" r.ID = b.rID and the same for customer_services (shown below).
The first part before the union works fine, but when adding the union I get a weird side ...
Maybe the solution is obvious, but I cant seem to find a good one.
In my upcoming project, there will be one main table, its data will be read frequently. Update / Insert / Delete speed is not an issue.
The items in that main table are associated to 4 or more categories. An item can have 50 - 100 or more relations within one category...
Hi
i am very beginner in visual basic and i have 2010 express. i want to connect to mysql located on my website's server in visual basic. i downloaded mysql connector, but i dont know anything about how to use it in vb.
i appreciate for any help or any direction...
thanks
...
I was wondering how can I select a value from a database that a user just entered it into and then add it to another mysql table all in the same script before the script is finished running.
...
Hi,
I'm running windows 7 and using WAMP for my local development. Now I Installed Cultbooking (sourceforge.net/projects/cultbooking/) in my wamp and can't finish my installation because it says sock "Socket support - Socket not supported". I don't know how I can enable my socket. I'm new to web development.
This is what I did, I downl...
Hello,
I want to input telephone number in a form, including country code, extension
create table if not exists employee( `
country_code_tel int(11),
tel_number int(10),
extension int(10),
mobile bigint(20)
);
If tel_number is larger than 15 bit, which datatype can i use, i'd...
I have a Mysql database of 500+ Real Estate Listings which I am looking to load into an empty Joomla Extension (this may apply to any PHP Script).
I have copied the structure and convention of each table the extension uses - with the idea of either exporting or simply deleting the original tables and replacing them with mine.
Upon test...
Hi,
I was just testing a small script in Prolog to sanity check the MySQL connection. The connection fails randomly, after making around 3000+ connections. Is there any limitation in MySQL Server for number of connections
:-dynamic db_connection/1.
sanity_check_open_db:-
odbc_connect('myDSN', _,
[ user(bob),
...
I am trying to combine a few SQL queries to reduce the number of queries performed and hopefully increase performance at the same time.
I have lots of products, split into categories. Some of the products have articles written for them (most don't though). At the moment I fetch all the products for a category a bit like this...
// * us...
Hi
I have a database table with around 1000 keywords/phrases (one to four words long) - This table changes rarely, so I could extract the data into something more useful (like a regular expression?) - So this is not finding / guessing at keywords based on natural language processing..
I then have a user inputting some text into a form ...
I was wondering how can I order my MySQL data using the DESC and ASC in my following code I tried doing this but some how it did not work can someone help me fix this problem.
Here is the code.
$result = mysql_query("SELECT a_tags.*, tags.*
FROM aa_tags
INNER JOIN tags ON tags.id = a_tags.tag_id
WHERE a_tags.users_a_id=3...
I'm having a rather strange problem with MySQL. Trying to create a procedure to update some fields in the database (the code is below).
The problem is with the line that is currently commented. It seems that if no SELECT statements get executed during the procedure MySQL query browser will return an error code of "-1, error executing SQ...
I'm trying to use SVN with Toad for MySQL to keep two DBs on two development machines in sync. When I modify a table on one machine Toad changes the appropriate scripts and checks them in just fine.
On the other machine, when I try "Update database" or "Updata schema" or even "Get Latest" on the specific table, I get a window which show...