Posts

php - MYSQL INNER JOINS -

Image
i have 2 tables in database. 1 used booking selection of dates , times available , other used returning selection of dates , times available. need link these 2 on 1 page. <?php { mysql_connect("localhost" , "" , "") or die (mysql_error()); mysql_select_db("") or die(mysql_error()); $pid=intval($_session["user_id"]); $query = "select t1.*, t2.return_time, t2.return_date returnout t1 inner join return t2 on t1.book_time=t2.book_time"; //executes query on database $result = mysql_query ($query) or die ("didn't query"); //this selects results rows $num = mysql_num_rows ($result); $dates_and_times = array(); while($row=mysql_fetch_assoc($result)) { $dates_and_times[] = $row['book_date'].' '.$row['book_time']; $dates_and_times[] = $row['return_date'].' '.$row['retun_time']; } } ?> ...

php - Russian encoding not consistent on mail.ru with phpmailer -

im sending automated emails russian users, used utf-8 encoding , when open in gmail shows perfect, in outlook shows incorrect in mail.ru popular email account russian users shows gobblygook. so sent email outlook in accryllic mail.ru , showed same content without problem, changed encoding windows-1251, again shows fine in gmail in mail.ru (who dont have option find switch encoding , dont support utf-8) shows different type of gooblygook. code here: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=koi8-r" /> <title>untitled document</title> </head> //error_reporting(e_all); error_reporting(e_strict); date_default_timezone_set('america/toronto'); require_once('phpmailer_5.2.2/class.phpmaile...

sql server - Convert varchar 2007-12-19-11.57.17.366731 to datetime datatype -

i have data shown below 2007-12-19-11.57.17.366731 and datatype varchar(26) i want change datatype datetime . i tried syntax no use , getting the conversion of varchar data type datetime data type resulted in out-of-range value. here sample trying select convert(datetime, '2007-12-19-11.57.17.366731', 120) thanks well, first of all, you'll need add string magic transform data accepeted format datetime . , need use less miliseconds (for datetime have 3 digits it), in sql server 2008 can use datetime2 this. try following: declare @value varchar(26) set @value = '2007-12-19-11.57.17.366731' select convert(datetime,left(@value,10) + ' ' + replace(substring(@value,12,8),'.',':') + '.' + substring(@value,21,3), 120) valueasdatetime, convert(datetime2,left(@value,10) + ' ' + replace(substring(@value,12,8),...

uitableview - NSFetchedResultsController with custom cells -

i'm using nsfetchedresultscontroller , have no idea how fix current problem. headers in table view cells rather real headers, because don't want headers stick @ top while scrolling. the message pretty clear it: coredata: error: serious application error. exception caught delegate of nsfetchedresultscontroller during call -controllerdidchangecontent:. invalid update: invalid number of rows in section 1. number of rows contained in existing section after update (2) must equal number of rows contained in section before update (0), plus or minus number of rows inserted or deleted section (1 inserted, 0 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out). userinfo (null) but number of rows in section after insertion of 1 row needs 2! how can let table view know this? i'm doing stuff this: indexpath = [nsindexpath indexpathforrow:indexpath.row + 1 insection:section]; newindexpath = [nsindexpath i...

javascript - HighCharts - JQuery - Simple example not working -

this simple example highcharts website not working me ( http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/pie-basic/ ). here code: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://www.highcharts.com/js/highcharts.js"></script> <script type="text/javascript"> $(function () { $('#container').highcharts({ chart: { plotbackgroundcolor: ...

c++ - Macro concatenation using compiler define -

this should simple, i'm struggling figure out. have project_name compiler ( g++ ) -d define, , want concatenate other text form namespace name. current approach this: #define version_namespace project_name ## versioning for current project, expect version_namespace syren_dllversioning . instead compiler error: error: 'project_nameversioning' has not been declared but according g++ call, project_name being defined properly: ccache g++ ... -dproject_name=syren_dll ... why project_name not being replaced before concatenation takes place? a macro name not expanded when appears next ## operator, need more layers of indirection: #define p_version2(foo) foo ## versioning #define p_version(foo) p_version2(foo) #define version_namespace p_version(project_name) so project_name expanded argument of p_version , concatenated in p_version2 . in section 16.3.3 [cpp.concat], paragraph 3, specified for both object-like , function-like mac...

Null when update Date field - MySQL PHP -

i'm trying update date field in db. query this: $q = "update news set data = str_to_date('2011-03-05','%y-%m-%d'), title = '".$title."', content='".$content."',...."; works great, but: $q = "update news set data = str_to_date('".$data."','%y-%m-%d'), title = '".$title."', content='"..."; it not working :( i got date: $data = $_post["data"]; and has value "2013-04-13". trimmed date , show in popup window , value correct; plz :) update strange me, if i'm using: $q = "insert news set data = cast('".$data."' date), title = '".$title."', content='".$content."'..."; it works fine. in insert not in update script table: create table if not exists `news` (`id` int(11) not null auto_increment, `data` date not null, `title` text not null, `content` text n...