mysql

Codeigniter: Combining activeRecord with manual queries?

Hi everybody, I've though a bit about the activerecord vs. manual queries in Codeigniter. ActiveRecord is awesome when it's all about standard queries and holds development time really low. However, when there's a need to add some complexity to the queries, the ActiveRecord gets quite complicated to work with. Sub queries or complex j...

codeigniter active record and mysql

I am running a query with Active Record in a modal of my codeigniter application, the query looks like this, public function selectAllJobs() { $this->db->select('*') ->from('job_listing') ->join('job_listing_has_employer_details', 'job_listing_has_employer_details.employer_details_id = job_listing.id', 'le...

Save IP in database

When a user logs in I want to save their IP in the database. How would I do that? What type is best to use for the MySQL field? How would the PHP code to get IP look like? I'm thinking of using it as an extra security feature for the login/session stuff. I'm thinking of checking the IP the user logged in with from the DB with the IP the...

Complex query in mysql

I have two tables reports and holidays. reports: (username varchar(30),activity varchar(30),hours int(3),report_date date) holidays: (holiday_name varchar(30), holiday_date date) select * from reports gives +----------+-----------+---------+------------+ | username | activity | hours | date | +----------+-----------+----...

Simple HTML form with POST to SQL function encoding problem?

Hi again, I have a simple html form that submits information with POST function. But when information contains a Cyrillic characters, in table in MySql there becomes азазаза symbols instead of text. The table is on utf-8_general_ci, the site is on UTF-8 encoding. I visualize the result from this table with $query = " SELECT "....

MySQL: Combining multiple where conditions

I'm working on a menu system that takes a url and then queries the db to build the menu. My menu table is: +---------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+----------------+ | id | int(11) | NO ...

Slug ID's with the same name?

I want to create slug URL's from a users title in my system. If a user types "The best way's to get slim; period!", then I want the slug to be "the-best-ways-to-get-slim-period". Also, if someone has already created a page with that title I want the slug to be "the-best-ways-to-get-slim-period-1". My question is how can I check the da...

Banning by IP with php/mysql

I want to be able to ban users by IP. My idea is to keep a list of IP's as rows in an BannedIPs table (the IP column would be an index). To check users' IP's against the table, I will keep a session variable called $_SESSION['IP'] for each session. If on any request, $_SESSION['IP'] doesn't match $_SERVER['REMOTE_ADDR'], I will update $...

How can I connect to a mysql db from a different server ?

I have, let's say, a root website with mysql db on a remote server. I want to connect to that particular database (to make queries), from many other little websites (with lower priviledges). Can this be done? Language: jsp, java, php ...

convert tsql to mysql

Is there an easy way to convert Transact-SQL to MySQL? I am attempting to convert a DB archive of stock ticker symbols and company names. ...

Converting latin mysql data to utf8

I want to use utf 8 right now , but all my data is latin1 , what is the efficient way to convert data . Also I know how to change database's structure(charset) to utf8 , What I want to do is changing charset of existing data . update Here are my old setting , Html output : utf8 Html input : utf8 Php - mysql connection : latin1 mysql ...

Question about Radio button/PHP/MySQL

Hi, I'm an engineering student and I'm developing a simple software based on HTML, PHP and mysql. I learned this topics on w3schools. I know only the basics. I tried to search about this in this website but I found questions about PHP, MySQL and HTML radio buttons which were much more complex than I need and that I could understand. Sorr...

Filtering MySQL query result according to a interval of timestamp

Let's say I have a very large MySQL table with a timestamp field. So I want to filter out some of the results not to have too many rows because I am going to print them. Let's say the timestamps are increasing as the number of rows increase and they are like every one minute on average. (Does not necessarily to be exactly once every min...

How to get the one paramater from list of items in php

I have one field in database table with following lines show_email_icon= show_hits= feed_summary= page_title= show_page_title=1 pageclass_sfx= menu_image=hd_events.png secure=0 All the stuff is stored as text in one field of mysql table Now i want to get the menu_image. How can i get that ...

Fulltext for innoDB? or a good solution for php app

I have a table I want to run a fulltext search on, but it is currently innoDB and is using a lot of foreign keys for other kinds of queries. Should I make like a 1:1 "meta-data" table that is myisam for fulltext? Also I am reading some things that say that fulltext corrupts MySQL tables pretty randomly? I dunno, the articles are a cou...

MySQL Throws NullReferenceException in Finalize... How are you coping with this?

I am using MySQL with the .Net connector on 64 bit Windows. For some reason Mysql is throwing a NullReferenceException in Finalize. This is the problem here and it seems that its due to a bug described here. This bug was reported in 6.22, but I am getting the issue with 6.23 too so apparently it is not fixed. I am using MySQL both with ...

opening pdf file using php that take data from mysql

hello, anyone can plz help me? i wanted to create pdf file using php and have done it. now i want to create pdf file that get data from mysql table.. i've searched for the sample code for long time but didnt find even a single code related to my query.. thanx in advance ...

How to Dump only specific data table from a database in MySQL?

How to Dump only specific table from a database like if my Database has 10 table's and i want to dump only 3 tables of my choice...is it possible with "mysqldump" command... ...

Should I change $_REQUEST to $_POST

Hey guys quick question, I have a checkbox system where a list of items can be checked and deleted on the click of a button. I currently use request and it does the job but I was wondering if $_REQUEST was some sort of security risk or improper. If anyone has any advice I would appreciate it. Should I change to $_POST? If so, what is the...

Moving from dedicated to shared cpanel - any scripts to do all / some of the install tasks ?

Hi, I have a few hundred phpld sites to move - each has its own cpanel, ( & the target may have shared cpanel) & I can do a full cpanel backup on the original server, but I don't have whm on the current host - the backups are fairly easy to organize but the installs so far means picking through files & setting up db's & mail etc by ha...