mysql

timestamp problem

Hello, i have some scripts and in the database tabel i have set the dato to int(25) and timestamp i have a create topic script and then i create a topic it insert the date and time in the timestamp tabel (dato). but somehow my comment script will not insert the time :S and its the same stuff i use :S. here is my script if(isset($_PO...

How to grab MySQL data into a multidimensional array?

How do I form a multidimensional array using MySQL data? I'm using this code right now: while($row = mysql_fetch_assoc($result)){ $music[$row['artist']][$row['title']][$row['id']][$row['category_id']] = $row['key']; } And I think it would be much easier to use a multi-dimensional array to store my data (artist array => title array...

Bad to Grant reload permission in mysql?

Because of a problem i had with mysql i need to use flush. I discovered the user cannot use flush without the reload permission. and to give it to him my syntax was grant reload on *.* to 'webapp_wt'@'localhost'; I couldnt do specific_db.*. And granting this kind of permission doesnt feel right. Is there anything wrong with this? Is ...

Getting japanese text off a site

Hello, I am trying to use PHP to scrape some japanese text off a site and insert it in to a sqlite or MySQL DB. The first problem I am running in to is actually getting the regex to pull the line of text I need from the site: <h3><b>タイトル</b> : I_want_this_text</h3> The text I want (I_want_this_text) is in japanese of course. The...

mysqli_free_result(): Object of class mysqli_result could not be converted to string

As far as I've done my searchings over Google and everything, it looks like this is a pretty common issue, but I cannot seem to fix it. Plus, I think that I have a little different usage of the function as others out there. And, after about 3 hours of no luck, I'm posting here! function free_result(){ ...

MySQL: Get data from other table matching the ids.

I have table named 'company' and 'user'. The user table contains the id of company. Like for example: A. User table user_id | name | company_id |status 1 | john | 1 | active B. Company table company_id | name | status 1 | ABC | active How to get the name of the company by their id in single sql query. such;...

Displaying Calendar in Hourly format inside a Table tag

I have a database holding events in the form of a start_time and an end_time which are timestamps. I am trying to make a calendar that has 24 rows, and 7 columns. A normal calendar would be easier for me to create because my SQL results would be in order of lowest to highest. I am not quite sure how I would run through my SQL table, ...

Whats the most efficient way to store an array of integers in a MySQL column?

I've got two tables A: plant_ID | name. 1 | tree 2 | shrubbery 20 | notashrubbery B: area_ID | name | plants 1 | forrest | *needhelphere* now I want the area to store any number of plants, in a specific order and some plants might show up a number of times: e.g 2,20,1,2,2,20,1 Whats the most effic...

MySQL: SELECT if next row is not as what is expected

So I have a log table. Rows are basically like this: id function n init() n+1 check() n+2 done() ... repeat But there are problems when it's like this: id function n init() n+1 check() n+2 done() n+3 check() <-- should be init! n+4 done() How do I find rows that happen only in init->check->done->check->done contagious order? ...

What is the Index - Normal - FullText - Unique

Same the title : What is the Index - Normal - FullText - Unique ? ...

MySQL update Script to my clients

Hey all We recently made an update to one of our main web based systems. Some of our clients use a desktop based system with a MySQL database to send payments and other info to our main web based system. The issue is that i want to add a new field in one of their tables in their database without asking them to manually add the field,...

mysql double values checking problem

Hi everyone, I wanna make a query that fetches only the rows that has 'cost' value grader than zero.The cost column has double data type.When i write a query like that, select cost from xxx where cost>0; it retrieves the rows only that has value grader than or equal to one.For example it doesnt take like 0.02 or 0.3 values.The query ...

codeigniter how i can load two diffrent mysql table list in single view

I want to develop a edit form for newsletter. I have done this but i can't load category list in same view. if user click on newsletter its open in edit view, in this edit view i want to give him a option for category selection option. categories are stored in different table name cat. i have tried it but its showing only one category....

What is a good wrapper/framework/libraries for dealing with interface PHP applications to an SQL database?

I have a table $query= "CREATE TABLE screenshot ". "(screenshot_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, ". "source_video_id INT UNSIGNED NOT NULL, ". "screenshot_file_name VARCHAR(128), ". "x_res INT, ". "y_res INT, ". "time INT UNSIGNED);"; mysql_query($query); Then I insert things into that table. I often want to do an SQL quer...

Doctrine Column not found: 1054 Unknown column 's.features' in 'field list''

I added a new column "features" to the site table and regenerated the models using Doctrine This code is causing an error $siteTable = Doctrine_Core::getTable("Site"); $site = $siteTable->findOneByName("site"); // this line is throwing an exception Exception : Unknown column "s.features" in field list..... I checked the database ...

Hibernate HQL NULL comparison pattern

Imagine a simple web page allowing you to search Bookings like this: If the Booking Number field is not populated I want to return all rows. If the Booking Number field is populated I only want to return that row. I have been using a pattern in Hibernate (with an underlying MySQL database) to accomplish this that goes something lik...

What are best practices for removing "friends" from a database?

Say you have a table schema such as this: friends(friendship_id, uid1, uid2, are_friends). When one friend un-friends another person, is it best practice to delete that row from the database (and reset auto-incrementing)? Or should you simply change the are_friends status to 'N'? I'd love to know what you think and why. EDIT: My prima...

Why put ` around columns?

In some code i see people put ` around their columns. Why? IS there any difference from not using them? SELECT `players`.`name`, `houses`.`id` FROM `players`, `houses` WHERE `houses`.`owner` = `players`.`id` ...

data reader in vb.net

Please help, how do I make a while loop equivalent of this for loop. So that I could read from one row in the table of mysql database and display it on the combobox in vb.net. I use this code, but its definitely not useful if there are 3 or more items that are added in the row: Dim i As Integer Dim rdr As Odbc.OdbcDataReader ...

Related to tag.

I have a table for articles. Its major fields are id article_name content tags (its values will be comma seperate example test, abc ...) Now when I am on a detail page of any article. I want to show related article in my sidebar. For this if any other article uses the same tag as current article. I want to list those articles as related...