Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Small SQL & Php Webpage Field Database Task


In a webpage, imagine a little section where the user fills in his/her contact details to register. Among this section is a field called "Country". The task is to make this field automatically generate the persons current country of residence. I am told, that the IP ranges and the country to which they belong is in a CSV .xls file. I am also told that the best way to do this is to:

1) Insert the CSV into database table (MySQL).
2) Use php to get that country name onto the website field.




View Complete Forum Thread with Replies

Related Forum Messages:
Database Task
room_type
rooms_no
persons
checkin
checkout

3210000-00-000000-00-00
6342008-11-140000-00-00
6342008-11-140000-00-00
4452008-11-142008-11-18

Now I have this table and I want to make SQL STATEMENT to make the following task

To see if the user can make a reservation in a hotel during the checkin and checkout date, by checking the numbers of rooms available in each room type during the checkin and checkout period of time. For example if the user enter number of persons that exceed the person that exists already in the database And also to check if this period of time is available to make reservation according the the persons number

Note : rooms-type in this example are (3,6,6,4)
room_no in this example are (2,3,3,4)
person (1,4,4,5) -> number of persons

View Replies !
Database Search Webpage
My Mysql database is completed with test data. Now, I am ready to have this info appear as a searchable database on its on web page. How is this done?

View Replies !
Selecting Limited Items From A Database And Displaying On A Webpage
So I've got this PHP/MySQL program that someone wrote for me and it's working great. However, I'm trying to figure out the SQL (and subsequent PHP) to select only champion and reserve champion from the database and to display it on the page.

The achievements are all listed in the php_achieve table in my database with RelPlaceID, etc, etc. Can anyone help? Or let me know what other information I need to include for you?

Basically, I want my website to display the most recent five champion and reserve champion results (if there are five, otherwise, to list them all) for a specific horse (each horse already has an id). Help? I'm so dumb at this stuff. :-X

View Replies !
Insert And Retrieve BLOB Data Into MySQL Database, And Retrieving To Webpage
Fairly OK with the MySQL side (created database, and queried ok, getting the responses I want, etc!)

Now have 2 photos i want to attach to each record in database table.(don't know if they should/can be part of the table, or just reference a path to location, given that this is a website, and will need to be updated quite a lot as I go)

What I want is that, when a query is sent, the resulting records must pull the images with them , and display on results page.

View Replies !
One Big Database Or A Lot Of Small Ones?
My boss is implementing a system where a lot of different sites will be using the same exact database structure. He has it in his head that things would be simpler with one database shared by hundreds, possibly thousands of sites. I feel like each site deserves it's own database, even if it involves more maintainence.


View Replies !
Backup A Small Database.
I'm looking to backup a small mysql database. The problem is mysqldump does not exist on the server I'm trying to export the database from.

Does a php script exist which I could use to do essentially the same thing as mysqldump?

View Replies !
A Huge Database Or A Lot Of Small Databases
I have a question regarding database performance.

Which of these two designs would be better:

-Having one huge database with 50 tables or so (each table having millions of rows)

or

-Having a lot of databases with the same amount of tables, but each table would have only thousands of rows

*The mysqlserver is running on a P4 3.0 ghz with 1 gb in ram, but I may upgrade my server soon.

*Privileges to create databases is not a problem since I own the server

View Replies !
Small Database, High Load
I have a very heavy mysql database used website. Data is constantly being updated and at peak there is well over 1,000 people online, after it hits the 1,000 mark, the website starts to lag pretty bad.

My database is only small at around 90mb. We have a web server for the files, and a database server for the database. The load on the web server is fine. But the database server is pretty high.

Would replication reduce lag and load? if i was too add a second database server?

View Replies !
Inserting Small Image Directly Into Database
How do you insert an image into a table directly using something like data studio?
I have tried googling it and it seems all the examples are using a language to do it for you. The images are between 2-4k and the table is just an int column followed by a blob column. I just thought the statement would go like

INSERT INTO sometable VALUES (1,'image.jpg');

The web suggests uploading and downloading in PHP (which im using) but im building the data first using data studio then just displaying the table information using PHP.

Before i go into displaying the information on the page i just wanted to make sure the insert query is correct.

View Replies !
How To Reset Yahoo Small Business MySQL Database
I am a new user of "Yahoo Small Business" web hosting service and I changed
a lot of settings in my "MySQL Database" using "phpMyAdmin" utility during my
learning period. Now, I want to reset my Yahoo Small Business MySQL Database
to default settings or to reinstall it (I want it to be the same as it was newly
activated).

Note: I tried to repair my database with Yahoo's "Database Setup" page and the
message "Database scheduled for repair" appeared for a few days but nothing
happened. And, I can not login to my database using "phpMyAdmin" utility.

If you can help me to reset my "Yahoo Small Business - MySQL Database" I will
be very pleased.

View Replies !
Schedule Task
i Was wondering if the following schedulke task would work in a Mysql Windows installed (in a wamp package)

Application: C:Path omysqlinmysql.exe
Parameters: mysqlcheck --repair --analyze --optimize --all-databases --auto-repair

View Replies !
Schedule A Task?
i have a web board uses a table to keep track of sessions. The session lasts until 15 minutes athey leave the page. I want to schedule a task that deletes all users who have been gone from the board for 15 minutes or more.

View Replies !
Automation / Task Scheduler
Here is what I need to do: send out an email to a registered user's email stored in a table. This email should be sent once the registration date and the current date is equal or greater then 30 days. Can I schedule a task (function or procedure) within MySQL to check the registration table every day and send out email, if needed?

View Replies !
Running A Task On Start Up
to do the following upon the start or restart of MySQL:

1. use a particular database (use mydb;)
2. drop a table within that database (drop table mytable;)
3. recreate the dropped table from an existing table (create table mytable like atable;)
4. populated the recreated table with structure and data from a third table (insert into mytable select * from table3;)

are the command/syntax for each step correct? Nextly, how can I execute that sequence automatically when I first start or restart of MySQL?

View Replies !
Fail Save System Task
i have a task which can take up some amount of times,
which is upload a .csv file, and import those content into database.

I would like to know whether a fail save design can be perform there.

Requirement
1. the script will resume (or start all over again) no matter which service down(apache/mysql)
2. Script auto resume witout human interaction after server restart complete
3. Data record content (from .csv) inserted into those several table tally(using transaction)
4. Mail notification (i really have no idea if the mail server down too :( )

Can someone give me some idea how to come out this kinda things?

View Replies !
Update Task Using Store Procedure
i have a problem in storeprocedure.my jobs showing sucessful.but it seems itnever update the table.i dun know whethere my procedure got problem.
This isd the code..

UPDATE px_SEDATAEX
SET px_sedataEX.conf = px_sedataEX.conf + uv_pxsddata_exdef_831ex.qty1
FROM px_sedataEX INNER JOIN uv_pxsddata_exdef_831ex
ON px_sedataEX.lot = uv_pxsddata_exdef_831ex.Lot

Where px_sedataEX.OP > ='100'


UPDATE px_SEDATAEX
SET px_sedataEX.accp = px_sedataEX.accp + uv_pxsddata_exdef_831ex.qty1
FROM px_sedataEX INNER JOIN uv_pxsddata_exdef_831ex
ON px_sedataEX.lot = uv_pxsddata_exdef_831ex.Lot

Where px_sedataEX.OP > '100'
GO.

View Replies !
SQL From Webpage:
Let's say that I can't log on to the MySQL daemon on the server; Is it
then possible to use the dump-file from mysqldump in a PHP-query so it
can be executed/processed on the localhost? I've tried just pasting the
SQL into a simple query, but it doesn't seem to work. And I can't find
much info about it anywhere. It all requires me to log on or create a
connection from outside localhost.

View Replies !
Db To Webpage
I'd like to list all entries in my database in a table on a webpage

I found a tutorial to do this

but I'm having trouble with it

here is my php code
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
<TITLE></TITLE>
</HEAD>
<BODY style="FONT-FAMILY: ">

<?php
$db = mysql_connect("localhost","testdb","testdb");
mysql_select_db ("testdb");

if (!$db) {
die('Could not connect');
}
// Ask the database for the information from the links table
$result = mysql_query("SELECT * FROM testdb");
// Now we print out the results, starting by making a table
echo "<table border = '0' width = '100%' align='center'>";
while ($rows = mysql_fetch_row($result))
// Here we make the script keep making new rows until all the links in our database are shown, this is called a loop
{
echo "<tr><td><a href='$rows[2]'>$rows[1]</a></td></tr>";
}
// Finally we close off the table
echo "</table>";
?>
</body>
</html>

and here is the results I see when executed
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:Domainscrestwoodsdesigns.comwwwroot est.php on line 19.

View Replies !
Update Db Via Webpage ?
I am happy with my mySQL install. I can quite happily created tables and fill them with initial data using phpMyAdmin and mySQL Admin.

What I want to do now is via a web browser be able to add data to various tables and then create reports from the db. We plan to use the DB for keeping track of our clients and adding jobs and accounting info for each client. I need to make the web entering part of it as simple as possible for the users.

I just need to find maybe some open source software that will help me automate the creating of a webpage to to the DB updates.

View Replies !
Displaying Data From Db Onto Webpage
I have jus created my test database with one table and 5 rows of data using phpMyAdmin. Now I want to display this data on a webpage using php. Any ideas on how I can do this?

database name is "test"
table is called "users"

View Replies !
Displaying Statements All Over Webpage
I have just recently installed mySQL 4.1.20 max on a Mac OS X 10.3.9 and when I view my page it has mySQL statements written all over the page. I haven't the slightest clue to what I did wrong since I am new to mySQL. Here is an example of the error...

(mysql): SELECT * FROM mdl_course WHERE id = &#391;' LIMIT 1
(mysql): SELECT section, id, course, summary, sequence, visible FROM mdl_course_sections WHERE course = &#391;' ORDER BY section
(mysql): SELECT * FROM mdl_course_categories WHERE parent = &#390;' ORDER BY sortorder ASC
(mysql): SELECT COUNT(*) FROM mdl_course
(mysql): SELECT c.* ,c.sortorder FROM mdl_course c WHERE c.category = &#391;' AND c.visible > 0 ORDER BY c.sortorder ASC
(mysql): SELECT * FROM mdl_course WHERE id = &#391;' LIMIT 1
(mysql): SELECT * FROM mdl_cache_text WHERE md5key = &#3966;d39efd283de286c9192281666950b3' AND timemodified > ?' LIMIT 1
(mysql): SELECT * FROM mdl_cache_text WHERE id = '-1'
(mysql): INSERT INTO mdl_cache_text ( MD5KEY, FORMATTEDTEXT, TIMEMODIFIED ) VALUES ( &#3966;d39efd283de286c9192281666950b3', '', 1150385107 )
(mysql): SELECT LAST_INSERT_ID()
(mysql): SELECT * FROM mdl_event WHERE timestart + timeduration >= 1149120000 AND timestart <= 1151711999 AND ( (groupid = 0 AND courseid IN (1))) AND visible = 1 ORDER BY timestart
This is written on the page along with the regular contents of the page. It is very confusing to me. Please help if you can. TIA.

View Replies !
Calling Mysql Fields Into A .php Webpage
Situation:
I have created a .php document that displays a youtube video and it works fine.

What I want:
I want this .php document to display a users youtube video, so i need to get the field from the database and make it so the .php document can call it and use the link from it to display the video.

The server is called: 'localhost'
The database is called 'db_vbulletin'
The table is called 'userfield'
The field is called 'field39'

But saying this, the youtube video link will be different between users, so im not sure what kind of factor that would have.

View Replies !
MySql DB Tables And Incorporating The Data Into A Webpage
I dont know much about MySQL or php, but I believe my dilemna resides in the 2.

I am trying to create a web page where a user can input a id number, and be returned with the aliases used by that id number. also, id like there to be a way to upload data through the web page using a MySQL dump file.

the program used to collect the data has a way to export to a MySQL dump file, so getting the data is not a problem. I was told by someone that I would need to create a table in my MySQL database that im using for this project. But the only thing I know how to do is create a new MySQL database using phpMyAdmin.

View Replies !
Handler_read_rnd_next = 13k On SMALL Db
I have two very small DBs.

One for a little number game, which only 6 people hit 1-3 times a day. The other is for a prototype of a game I'm working on, and there are no more than 3 users on this.

Using phpmyadmin, I check the page with runtime info and I see

Handler_read_rnd_next 13 k

If I reload this page a couple times, it goes up to 14k.

Most of the queries I use look like

Code:

SELECT c.color, b.percent
FROM tbl_creatures a, tbl_creatures_colors b, tbl_colors c
WHERE a.creature_id =1
AND a.creature_id = b.creature_id
AND b.color_id = c.color_id

And the EXPLAIN SQL for these comes up with

Code:

id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE a const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE b ref PRIMARY,color_idPRIMARY 4 const 2
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 hq_proto_creatures.b.color_id 1

To me, this all looks fine. I can't tell if all the Handler_read_rnd_next is due to the phpmyadmin status checks or not.

View Replies !
Small Databases
I am wondering if having a database for the client back office, a database for the static website and a database for website stats would be a good idea.

The client database would hold credit card info, user info, reg info, project info, client messages and more.
The website database would carry all the content for the pages of the public website like about us, contact, home page, news and such.
The website stats database would keep track of user agents, new hits, returning hits, keyword searches made on the client websites and all that jazz.
Should I make this all ONE giant database or three smaller database?

View Replies !
One Big Table Or Many Small Ones?
I am designing an interactive website consisting of a few pages and I want to track individual user progress. I was wondering if it would be better to create one big table for all values on all pages (Which may have a lot of columns, easily hundred or more), or created a separate table for each page (so I could have some 10 tables with 10 columns or more). Or does it not matter?

View Replies !
Big Select Vs Small Ones
I have an array of 10 IDs.
I need to query the db for values associated with these 10 IDs.

In a lot of places, I have seen people using a php foreach like this

foreach (ids in array)
{
query = SELECT values FROM tables WHERE id = [id 1 in array]
do query
store values
}

we could build one big select statement like this:

query = SELECT values FROM tables WHERE id = [id 1 in array] OR [id 2 in array] OR [id 3 in array].... until we have ids.

View Replies !
Small Query Optimization
I need this query optimized using indexes. So I was wondering how I could optimize it to work with an index for speed.The query is:

Quote: select ided from products where dates <= 2006-11-11 or cost=0.00 or url not like 'http://%' or imgurl not like 'http%'

I tried making an index on (dates,cost,url,imgurl) but it doesn't seem to use the index when I do the explain part. I find that even when I miss of the like parts of the query it still is not using the index. It seems to not use the index because of the "or" that is used in the query instead of the "and". Could this be the reason and how could I over come this so that it will use the index.

View Replies !
Small Favor Gone Wrong
I have a VPS account and I am trying to move my sister's professional organizations site onto my server more or less as a favor (getting paid a little - but not really worth my time). It is being hosted by a professional hosting company that supplied me with ftp access to download the site for the move.

I am running into a problem because I don't know how to set-up/use mySQL through UNIX. Previously I have used the Plesk interface provided with my VPS account. Plesk (or at least my hosting services configuration of it) won't allow me to create the user I need in order to import the database because the user ID is contained within the user PW. (this is the database coming from the vendor).

The original host has been unhelpful at best so I thought before I go to them and ask for assistance (that I am pretty sure I won't get anyway) that I would post here to find out if there is any easy way through this roadblock or if any the unix commands are simple enough, how I would proceed that way.

View Replies !
Small Binary Data
Can anybody tell me what way is best to save a small binary data (16 Byte) in MySQL?


View Replies !
One Large Table Or Many Small Tables?
I'm trying to decide whether to use one large table or many small tables.
I need to gather information from various devices (about 500). Each device
has its own Id and some data.

Should I use only one table with an indexed column for the ID and another
column for the data, or should I use 500 tables each with only one column
for the data?

View Replies !
MySQL Upload Small Files
I'm uploading small files (>10K) and mysql is deleting it. The one field is a blob field and everytime i test upload a file thru phpMyAdmin within 2 seconds mysql deletes the row. Theres nothing in mysqld.log, there another log i should be checking out?

View Replies !
One Big Query Vs Lots Of Small Queries
I am in the process of migrating a MySQL database from one schema to another and am writing a script to extract the info from one table to be inserted into multiple tables on new new db.
My question is this, is it better for me to make one giant query (about 1 million records returned) on the source table, manipulate the data, then enter in the data by cycling through the results, or would it be better to split up the query on the source table into lots of smaller queries with a short pause in between?

View Replies !
Structure Of Small Social Network
I need to setup a social network type mysql database, but not as intense as friendster, thefacebook, myspace, etc.

i have a structure set up but it think it's weak and extremely limited:


Code:


+---------+-----------+
| user_id | friend_id |
+---------+-----------+
| 5 | 4 |
| 1 | 7 |
+---------+-----------+



i fear it's going to be a lot of redundant IDs in a column, which i think could be a problem when retreiving friends:


Code:


+---------+-----------+
| user_id | friend_id |
+---------+-----------+
| 5 | 4 |
| 1 | 7 |
| 1 | 9 |
| 7 | 9 |
+---------+-----------+



i want to do a "bob is friends with john" and a "jackie knows sally through richard" (aka friend of a friend). that's it and nothing more. how do i structure mySQL database to be able to this?

View Replies !
One Huge Table As Appose To Many Small Ones
i have a very large XML DB (60gb+ and growing on a daily basis) which holds complete life cycles of stock option , i used to hold it all in folders with each folder named like the option paperId so it seemed logical to me to hold it now in diffrent tables for each paper even tough the are all the same exact table , now i'm having some problems with hibernate (one of the biggest reasons i left XML) and so many tables , is it more effiecent to keeeping data like that ?

ofcours i will have to change the PK from datetime to paperId+DateTime if i decide to change to one big table ... how can i calculate diffrence in retrieving data ?

View Replies !
Several Small Calls Vs One Large Call
I am working on a php interface to a mySQL db which will pull lots of rows from the database. Assuming I am selecting a hundred rows by their auto_incremented ID's, is it better to do this with a loop of 100 "SELECT ... WHERE id=" calls, or to do it with one single "SELECT ... WHERE id IN(...)" call, with IN() holding a list of the hundred items.

View Replies !
One Large Table Vs. Many Small Tables
I'm working on a design using PHP & MySQL and I'd like to get some opinions on this.

My design has several tables that will be referenced but I'm wondering if those tables should be broken down even more and referenced more dynamically. The reason that I wonder about this is for long term goals. I hope that eventually there will be two or three thousand records that will be used on a regular basis. These records will need to be separated into groups, but I'm not sure if I should use a field in the database table or create a new table for each group.

If a few hundred records could be in each group, do you think it's better to use one large table with a field for the group ID, or a new table for each group?

View Replies !
Help With A Small Query Optimization Using An Index. THANKS!
I need this query optimized using indexes. So I was wondering how I could optimize it to work with an index for speed.

The query is:

Quote:

select ided from products where dates <= 2006-11-11 or cost=0.00 or url not like 'http://%' or imgurl not like 'http%'

I tried making an index on (dates,cost,url,imgurl) but it doesn't seem to use the index when I do the explain part. I find that even when I miss of the like parts of the query it still is not using the index. It seems to not use the index because of the "or" that is used in the query instead of the "and". Could this be the reason and how could I over come this so that it will use the index.

View Replies !
Large .sql File (break Down To Small Parts)
i have an oscommerce installation that generates a 200mb sql backup file. i want to try and rebuild the installation on my local pc (localhost) to emulate and play with, unfortunately the 200mb file is difficult to handle. phpymadmin seems to crash.

i have console access on the host however.

is there a way i can break down the sql file into smaller increments for easier uploading?

View Replies !
Database Field/ID Efficiency
on a previous project (infact my first major PHP/MySQL project) I had set up a database to handle sessions.Previously the session ID was created with a MD5 hash and then stored as-is into a field called Session_ID. This field was indexed and then used to identify records to update/delete. I'm now questioning how efficient it is to index a varchar field. Is this a very naughty thing to do? Do I need to change my ways?

View Replies !
Finding A Field In A Database
is there a means to query a large database for the existence of a field? something along the lines of "SELECT (all tables) FROM database WHERE field LIKE 'name'" perhaps?

View Replies !
Array In Database Field?
I am making a database of work performed on equipment. I have a field "parts_replaced" that will have a integer for each part replaced. Can i make a array type variable that has multiple part numbers? If not suggestions on another way to do it? thanks... i am

ID = int(11)
serial_number = int(11)
machine_type = text
model_name = text
date_purchased = datetime
work_performed = text
date_work_performed = date
parts_replaced = int(11)

View Replies !
Adding A Field To A Database
I have an existing DB and I want to add a field to it.

View Replies !
Fastest Way To Add 1 To A Database Field
I would like add 1 to a field in a db. I was thinking of fetching the row, adding 1 with PHP, and the UPDATE the row again, but I guees there will be a MySQL-only way to this?

View Replies !
Adding A Field To A Database Table
When adding a field to a table using ALTER TABLE is it possible to check if
the field already exits before the ADD command is run? If so how do I do
this?

View Replies !
Empty 'Date' Field In Database ?
I have field in a table which is of type 'date'

If the particular record has no date listed, how can I test for an empty date ?


If RS("ShipDate") > 0 then

or

If RS("ShipDate") = 0 then (or "", or ##)

View Replies !
Empty 'Date' Field In Database
I have field in a table which is of type 'date'
If the particular record has no date listed, how can I test for an empty date ?
If RS("ShipDate") > 0 then
or

If RS("ShipDate") = 0 then (or "", or ##) .

View Replies !
Searching A String Field In Database
I would like to have someone be able to search a my database. Here is how i would like it to work, but i am having a hard time figuring out how to code it. any help would be great.

So for instance say i have a field labeled "activities" and i will have the user check off boxes to fill this field.

Activities
"baseball AND soccer AND volleyball"

now i want someone to be able to search for "soccer" what would be the best way to search each person in the database for this attribute? Am i looking at this in the wrong way? Is there a better way to do this?

View Replies !
Changing Field Of Large Database
I have a fairly large database of aprox 7 million records. One of the columns is of type TEXT and I was wondering if it would be possible to change this to MEDIUMTEXT or LONGTEXT without complications?

Is this doable or is it discourraged to perform this operation on such a large database? The field is not indexed, it's simply there containing text and now I want to stuff even more text into it.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved