I am trying to connect to my MySQL database on my online server via PHP on my localhost.
$con = mysql_connect("$hostname", "$username", "$password");
if (!$con) {die('Could not connect: ' . mysql_error());}
mysql_select_db($databasename, $con);
When I upload the script to the server it connects to the database fine. However, when I l...
I haven't got any experience with databases, but intends to learn it and use it on a web project I'm planning.
Though, I've got advice from a pal of mine that the use of databases should be quite more extensive than I planned. He believes in keeping almost all of the data in databases, where I find that databases are most convenient reg...
In this table I store changeable values for certain spids.
As days go by, these values can change, and an spid can get a new value.
Now I want to find out until when a certain value is enabled.
This is the data for a single spids
uid spid propertyvalue creationdate
--------------------------------------------------
1 3 ...
I have a Mysql table with a single primary key (called pkey) that auto increments, and I would like to clone one row, keeping all the data the same, except for the primary key which should become the next available value as defined by auto increment.
My first question is, is the following query possible?
UPDATE `table` SET pkey='next_a...
Situation is simple. I'm starting to develop a website that should be localized based on visitor's origin IP address.
It's a PHP-MySQL stack. How do I go about the multilingual text content? I am thinking of having a language table in the database with the primary key as content identifier, another column for page identifier and separat...
So I was creating a table for comments, and I was wondering. What would be a good type for comment details? I put longtext. Well then, why would people need varchar if longtext can handle it? Also, which type would I want for usernames?
What is the purpose of "primary" for index? What is the purpose of index?
Update:
Let's say a commen...
Reading this question a doubt poped into my head:
char and varchar can store up to 255 chars
text can store up to 65k chars
char size in bytes is number of chars
varchar size in bytes is number of chars used + 1
So how much bytes does TEXT actually occupies? ~65kb or number of chars used + 1?
...
I am trying to get the qunt with are int and add them all up and show a total
$qunt = 0;
$result = mysql_query("SELECT *
FROM properties_items
WHERE user_propid='$view'
ORDER BY id DESC") or die (mysql_error());
while ($row = mysql_fetch_array($result)) {
$ite...
In my LAMP app, users sometimes cut and paste input into my web forms from other applications like MS word.
All of my webpages are set, via content type tag, to display in UTF. My PHP script saves the data for the web form into a mysql table that has the character encoding set to UTF-8.
There is an apostrophe character that will displ...
I thought you could set varchar as varchar(min,max), but I must have mistaken. What's the syntax to set a min and max? Or do I have to use PHP to do that?
Update:
Let me add more context. I'm making a field for usernames, so I thought I could set the minimum and maximum for varchar in MySQL. Seems I can only set the length which is 0 t...
Hello everyone!
I would like to ask some help on how to connect VB6 to MYSQL? Please provide references as well.
Many Thanks
...
Hey,i've got a problem, i want to execute this sql update, but it doesn't work. Could anyone help me? Thanks!
The code:
$temp = $_GET['ul'];
foreach ($temp as $key=> $value)
{
$str=array();
$arr=explode(',',$value);
$str =array($key=>$arr);
for($i=0;$i<count($str[$key]);$i++)
{
$tripID='2'; ...
I have the following DB.
CREATE TABLE IF NOT EXISTS `omc_order` (
`order_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`customer_id` int(10) unsigned NOT NULL,
`total` decimal(10,2) NOT NULL,
`order_date` datetime NOT NULL,
`delivery_date` datetime NOT NULL,
`payment_date` datetime NOT NULL,
PRIMARY KEY (`order_id`)
) ENGI...
When I run:
$ python manage.py syncdb
I get the following output:
Creating table auth_permission
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager
utility.execute()
...
Is this both query are similar? or which query is best to use.
SELECT name FROM employees WHERE skill_sets REGEXP '[[:<:]]php[[:>:]]'
SELECT name FROM employees WHERE skill_sets LIKE '%php%'
...
I am storing values in database like this
www/content/lessons/40/Digital Library/document1.doc
I need to extract the file document.doc.
How to retrieve this value from mysql using regular expression.
...
I'm running a simple query with a join, similar to
SELECT t1.a, t2.b FROM t1 LEFT JOIN t2 ON ... LIMIT 5
As t1 has-many rows in t2 ( any number above 2 ) the LIMIT statement does not return the first 5 rows from t1 and corresponding entries from t2, but 5 rows which usually include 2-3 rows from t1.
How can I write this query to get ...
I have the following table:
table name: down
fields: id, key
and value in it is...
1, 1233
where id has INT 11 primary key and key is varchar
and my query is
SELECT * FROM down WHERE key='1233'
but it is not working please let me know what is actually the problem...
and giving me the following error
You have an error in your...
Hello,
I have a system with a globally open mysql connection to the local server. In one of my files I am opening an additional connection to a remote machine.
Wieldly instead of trying to connect to that machine, I get an access denied message from my ISP (it seems to be trying to connect to the database on that machine).
I am trying...
I'm having some major issues with an SQL statement, the following statement causes so much stress to the MySQL engine it pretty much hangs:
select c.title, c.initial, c.surname, c.labelno, c.email, br1.bookingdate
from explorer.booking_record br1
inner join explorer.client c
on c.labelno = br1.labelno
and email not like ''
where br1.boo...