php,yii,yii-dbRelated issues-Collection of common programming errors
hackartist
php file stream zip ziparchive
I have a processing server with my database and a serving database to serve up files with a low bandwidth cost. On the processing server, php is not able to create files so everything must be done with streams and/or stay in memory before being sent over to another server for download. A few days ago I found out about the stream abstraction with ‘php://memory’ and that I can do something like$fp=fopen(‘php://memory’,’w+’); fwrite($fp,”Hello world”); fseek($fp,0,SEEK_SET);//make a ftp connection
XedinUnknown
php uml class-diagram enterprise-architect argouml
SituationI have a PHP project with lots of classes with lots of relationships in lots of folders following the Zend Naming Convention.I use the NetBeans IDE 7.1. I work under Windows 7.GoalI need to see a graphical representation of the class relationships, possibly in varying depths and varying degrees of complexity. Also, it would be nice if the classes in the diagram are clickable. I do not necessarily need to generate documentation.AttemptsHow I tried to solve the problem…1. Within NetBean
hakre
php soap wsdl simplexml stdclass
My background is Java. I somehow thought diving into PHP would be fun.I have a WSDL file with a few methods defined that I need to call. Each method typically has one request and one response type defined. These types are all one or two levels deep, no attributes – only elements. Nothing fancy. Almost all methods requires some common arguments, like “username” and “password”.I thought I’d test drive all of this and so I created an indirection which handles passing the standard arguments. The pro
Geuis
php osx gd2 freetype2
I’m compiling PHP5.2.9 on Mac OS X 10.5.6. Need some help to figure this out.I have PHP compiling and working with a basic config, and now I’m trying to compile with GD2. The problem I’m running into is that if I add the argument to build with Freetype, I get build errors. This is my minimum config to demo the problem. Also, I know that there are other requirements for libjpeg/libpng, etc. I’m not including those right now to make this simpler.sudo ./configure –prefix=/usr/local/php –with-conf
mOrloff
php datetime week-number
The Issue:We have some products which use a “YYWW” (date(‘yW’)) format to identify date of creation. Sometimes we don’t even get the week .. all we have to work with is the year value.I am currently using DateTime->setISODate() to get dates out of the year and week values. Since the turn of a new year usually falls in the middle of a calendar week, our minimum-date is typically in the prior year when considering week-One. This isn’t much of a problem in and of itself, bet when trying to conv
JBurace
php sql-server iis active-directory
I am attempting to connect to a Microsoft SQL server db using PHP (in IIS). The user/pass provided in the code is an AD account that can access the database via ODBC in Access just fine.$serverName = “servername”; $connectionInfo = array( “Database”=>”dbname”, “UID”=>”myuser”, “PWD”=>”mypass”); $conn = sqlsrv_connect( $serverName, $connectionInfo);if( $conn ) {echo “Connection established.<br />”; }else{echo “Connection could not be established.<br /><pre>”;die( print_
Shiva
php linkedin
I am trying to create linked company posts using the details at: Creating Company SharesAfter authentication the application finally lands on the page with the below PHP code. everything works fine except for the post to company page (function posttopage).<?php // Change these define(‘API_KEY’,’XXXXXXXXXXXXXXX’); define(‘API_SECRET’,’XXXXXXXXXXXXXXX’); define(‘REDIRECT_URI’, ‘http://’ . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘SCRIPT_NAME’]); define(‘SCOPE’,’rw_company_admin r_fullprofile r_emaila
VirtuosiMedia
php internationalization locale
I’ve read Joel’s article on Unicode and I feel that I have at least a basic grasp of internationalization from a character set perspective. In addition to reading this question, I’ve also done some of my own research on internationalization in regards to design considerations, but I can’t help but suspect that there is a lot more out there that I just don’t know or don’t know to ask.Some of the things I’ve learned:Some languages read right-to-left instead of left-to-right. Calendar, dates, times
Kermit
php sql-server
I’m having trouble authenticating for MS SQL Server when setting up a basic connection through PHP with Microsoft’s SQL Server Driver for PHP (http://msdn.microsoft.com/en-us/library/cc296172(SQL.90).aspx) using Windows Authentication.Here is the code I’m using:<?php$serverName = “sql”; $options = array(“Database” => “database_name”); $conn = sqlsrv_connect($serverName, $options);?>When I run it, I get the following error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Login fail
Eugene
php session memcached redundancy
Colleagues! I’m running php 5.3 (5.3.8) with memcache (2.2.6) client library (http://pecl.php.net/package/memcache) to deal with memcached server. My goal is to have failover solution for sessions engine, namely:Only native php sessions support (no custom handlers) Few memcached servers in the poolWhat I expect is that in case if one of memcached servers is down, php will attempt to utilize the second server in the pool [will successfully connect it and become happy], however when first memcache
user1652319
php sql-server yii
Hi I have a problem where I am trying to get a total time that a job has taken (using database fields job_start and job_end time(7)) then adding this to another model’s field,the code i have is if (isset($_POST[‘Jobs’])) {$model->attributes = $_POST[‘Jobs’];$model->setScenario(‘closejob’);$model->status = 2; //set status to closed//date time difference – this is the part I need help with $diff = $model->job_start – $model->job_end;//need to get customer model and add time diff to
Alexander
php sql-server yii
I am using Yii with SQL SERVER When i inserting data it shows a errorCDbCommand failed to execute the SQL statement: SQLSTATE[42000]:[Microsoft][SQL Server Native Client 11.0][SQL Server]Conversionfailed when converting from a character string to uniqueidentifier..The SQL statement executed was: INSERT INTO [dbo].[tbl_acc_appTokens]([TockenKey], [UserProfileId], [ClientId], [Expired], [CreatedDate])VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)In My controler $newApp = new AppTokens();$newApp->UserPro
Asad
php sql-server yii odbc sql-server-native-client
I found lots of answers about this question and it is asked in stackoverflow as well, but that answers do not solve my problem.The method they are telling in the forums and Q/A websites to connect PHP with MS SQL Server, I am using the same but I am getting the following error in YII FrameworkCDbConnection failed to open the DB connection: SQLSTATE[IMSSP]: Thisextension requires the Microsoft SQL Server 2012 Native Client ODBCDriver to communicate with SQL Server. Access the following URL todown
xles
php yii
I’m playing around with the Yii framework, and decided to do some file foo with the finfo class in php, like so:$finfo = new finfo(FILEINFO_MIME);This should work without issue (and it works just fine outside of Yii), I don’t see why it shouldn’t. However, this isn’t the case, Yii attempts to autoload the finfo class causing the obvious error:include(finfo.php): failed to open stream: No such file or directoryIs there a way to beat Yii into submission?Edit: I still haven’t figured out why it cr
tisha
yii yii-extensions yii-db cgridview
following is my code in view but i am unable to create button in cgridview <?php echo CHtml::link(‘Advanced Search’,’#’,array(‘class’=>’search-button’)); ?><div class=”search-form” style=”display:none”><?php $this->renderPartial(‘_search’,array( ‘model’=>$model,)); ?></div><!– search-form –><?php $this->widget(‘zii.widgets.grid.CGridView’, array( ‘id’=>’product-grid’, ‘dataProvider’=>$model->countregister($_GET[‘id’]), ‘enablePagination’ =&
teresko
php file-upload csv yii yii-cmodel
I am trying to upload CSV file using an Yii framework. I have added the code below : Model<?phpclass Import extends CModel{public $name,$email,$doctor = 0,$hospital = 0,$diagnostic = 0;public function rules(){return array(array(‘name,email,doctor,hospital,diagnostic’,’required’));}public function attributeNames(){return array(); }} ?>View(index.php)<div class=”form”><?php echo CHtml::beginForm(‘site/import’,$method=’post’,$htmlOptions =array(‘enctype’=>’multipart/form-data’));
Dency G B
php yii yii-extensions
I want to make a newsletter feature in my application. I need to send emails about 5000-6000 after I create a newsletter. When the newsletter is published it will create an email queue which will be stored in the database. Since it requires a lot of time I need to run it in the background. So I made a command to send the mail using YiiMailer and the email queue from the database.My command is working, but it is getting terminated after some time without completing the job. Also I need to run it
nosthertus
yii model checkboxlist
I have a problem on yii model, ive been told to use the generateAttributeLabel() on the model, but i tried to use it on the way i thought it would work but it doesnt. This is my codepublic function generateAttributeLabel($variable = file_get_contents(‘protected\column.txt’)) {return $variable; } public function attributeLabels() {return array(‘id’ => ‘ID’,’parametro_id’ => ‘Parametro’,); }There are some columns that are being generated automatically and i thought to save their names into
Sumit Gera
php yii
I am trying to write the code for parsing the uploaded .csv file. I have written the following code. The controller generates the rows of the CSV file in the form of arrays which I have also tried to print with print_r($buffer); statement and I get the expected output. Though the strings can be printed using echo $string;, but I am not able to pass them to the text-fields for editing before saving to the database.SiteControllerpublic function actionImport() {$buffer[] = array();if(isset($_POST[‘
armandomiani
php gridview yii
I’m trying to put these buttons inside my GridView:$extraButtons = array(‘class’=>’CButtonColumn’, updateButtonLabel => ‘Atualizar’,deleteButtonLabel => ‘Excluir’,viewButtonLabel => ‘Visualizar’,deleteConfirmation => ‘Deseja realmente excluir este ítem?’, buttons => array(‘btnCVs’ => array(‘label’=> ‘See resumes’,’url’=> ‘javascript:viewResumes($data->id_professional)’, //here is the line’imageUrl’ => ‘/gammarh/assets/dad4ddbc/gridview/cvs.gif’,’visible’ => ‘t
tisha
yii yii-extensions yii-db cgridview
following is my code in view but i am unable to create button in cgridview <?php echo CHtml::link(‘Advanced Search’,’#’,array(‘class’=>’search-button’)); ?><div class=”search-form” style=”display:none”><?php $this->renderPartial(‘_search’,array( ‘model’=>$model,)); ?></div><!– search-form –><?php $this->widget(‘zii.widgets.grid.CGridView’, array( ‘id’=>’product-grid’, ‘dataProvider’=>$model->countregister($_GET[‘id’]), ‘enablePagination’ =&
Danny Valariola
php mysql pdo yii yii-db
Editing my question:I want to count impressions (hits) on my website, and i’m using PHP 5.3 and Yii framework. I’m trying to run an application under Yii framework.My app is getting ~600K users per day.As suggested before the server may be crashing due to multiple connection trying to update the impressions.My question is: what is the recommended method for counting impression (hits, visits) to my site?Thanks, Danny
user714965
yii yii-db
I have created two models :User and UserProfile , Now I want display in some fields of UserProfile in User view (_form) , on create action in user table I have done this :public function actionCreate() {// Uncomment the following line if AJAX validation is needed// $this->performAjaxValidation($model);$user_form= new TblUser;$profile_form = new TblUserProfile;if(isset($_POST[‘user_form’], $_POST[‘profile_form’])){// populate input data to $a and $b$user_form->attributes=$_POST[‘user_form
laser_wizard
yii yii-extensions yii-db
When testing a CRUD generated Create form I receive the following error. Anyone familiar with this problem? Thanks ahead of time.undefined index: contactindivs07 $this->render(‘view’, array( 08 ‘model’ => $this->loadModel($id, ‘Companylocation’), 09 )); 10 } 11 12 public function actionCreate() { 13 $model = new Companylocation; 14 15 16 if (isset($_POST[‘Companylocation’])) { 17 $model->setAttributes($_POST[‘Compan
Levi Putna
php yii yii-db
This question seems to popup a lot however none of the answers have helped me solve my problem. SummaryI’m using Yii to create an application; I have three tables, i’m trying to do a Join and filter on two of them; I’m trying to use CDbCriteria and CActiveDataProvider to do the join and filter; I have models for all the tables however when I try join them I get an SQL error.TablesI have created an Model for the tables I want to join and filter on.Recordclass Record extends CActiveRecord {public
Web site is in building