QLaravel mass assigment [1452] errorPHP

MySql throws error an error when trying to create a new instance of a model. The user_id field is valid, I’ve tried to set it manually but it didn’t work either. User with id 1 exists. Error: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`production_paperclip`.`widgets`, [...]

QHow to execute external PHP script in command line from your browserPHP

I have an external php script named external.php which includes this: <?php echo ‘External Output’; ?> When I run that on command line with command: php external.php I get output as External Output But when the same script I execute from my browser’s php file named index.php which has this code: <?php $exe=exec(‘php external.php’,$out,$ret); print_r($out); [...]

QTwo stage redirectPHP

I am looking for a two-stage redirect for my website www.listprice.us that will put up an offsite permission notification before redirecting users to a new website. I have a million offsite redirects, need them to go to a single, new page with ultimate destination link in tow and pause there until the user has consented [...]

QPHP Isset: If Condition Not Working [on hold]PHP

I’m having a problem getting my PHP IF condition to work which also involves issets. This is how the code is supposed to function on all conditions: (It’s basically a leaderboard, so I’m trying to get the fastest race time out of Single Player and Multiplayer modes no matter what.) I put the conditions below [...]

Qprevent caching in browserPHP

I am writing a script which modifies its own contents and I am having a hard time with preventing it from caching itself and NOT showing the updated page… I have tried everything I can think of… I added these headers in the PHP code: header(“Expires: Mon, 26 Jul 1997 05:00:00 GMT”); // Date in [...]

Qphp throwing undefined index warning but the script works as intended?PHP

I wrote a simple php script that basically echos the values put into a form on the page, later, I will have this write to a DB but I was working on troubleshooting it before I did that since I keep getting this warning. Does anyone know why I am getting it? If I just [...]

Qconnect multiple db using SqlitePHP

The code below is an attempt to connect more than one database using PHP PDO and SQLite. No matter what I tried, it does not accept the select test1.table1. If I remove the database name the select works; so how do I reference more than one database in the select? <?php // connect to SQLite3 [...]

QAPPLICATION PATH in Zend Framework getting appended to virtual host namePHP

In my Layout, when I do this <?php $js = APPLICATION_PATH.”/../public/js”; ?> <script src = <?php echo $js.”/signup_layout_js.js”; ?> ></script> I get a js error http://proj_name/home/aman/Work/proj_name/public/js/signup_layout_js.js My APPLICTION_PATH is getting appended to http://proj_name/, I dont want that. But if I do this, it works fine on http://proj_name/ but breaks when i go to a controller/action [...]

Qarray_multisort appears sort is incorrectPHP

I have several arrays containing team data… array_multisort() appears to not be keeping the team data associations. I have something like this: Teams[$z] = various strings ConfNum[$z] = various strings $DivNum[$z] = various strings $DivWinner[$z] = integer of 1 or 0. $TeamRank[$z] = integer of the team’s rank for debugging, I use a for loop [...]

Qavoid displaying an empty column in a row during loopPHP

I have this form that takes information from a live search form it then goes to another form to be edited if web owner wants to edit it. As you can see the form has an Order Number column, when client enters a new order number for the same customer they do not fill in [...]

Qphp – keep value that is shuffled even if page is refreshedPHP

I made a quiz that generates a random answer at the end by using the shuffle() function. I want it to stay on the same answer and not to shuffle again. My code: <?php //Array of cars $answer = array( “Mercedes”, “Benz”, “Honda”, “Toyota”, “Nissan”, “Mazda”, “Hyundai”, “Ford”, “Lexus”, “Lamborghini”, “Ferrari”, “Porche”, “Mitsubushi”, “Scion”, “Chrysler”, [...]

QDelete multidimensional array by a specific keyPHP

I have this multi-dimensional array and I want to delete completely if the [earnings] index are empty. Array ( [0] => Array ( [earnings] => [other] => Array() [ord] => 2 [days] => 1 [total] => 1 ) [1] => Array ( [earnings] => The campaign was effectively ended in November 1917. [other] => Array [...]

QRedirect with header and javascript codePHP

I created a redirect page in PHP that whenever some one visits that page, it will add a cookie in browser and redirect user to some other page: ex: google.com. To do that, I have used javascript to redirect but problem is that when I extract my url it doesn’t show google.com. During extraction it [...]

QGetting different values from multiple buttonsHTML

I am using php and html. I have two buttons in my table as shown in the image bellow. When I press the Update button, it displayed the correct name and value properties of the Update button. However, when I press the jan_data button, it doesn’t show the properties of that button. Instead it shows [...]

QLaravel: Where to Add booted and booting Callbacks?PHP

The main Laravel application object has two methods, booting and booted. These methods allow you to configure callbacks. The application object will call these callbacks before and after it boots. Where, as a Laravel application developer, can I hook into these events? Looking at the framework it seems like bootstrap/start.php is the obvious place — but [...]

QRedirecting without refreshing every 10 secondsHTML

I want to redirect my page to another page using HTML but when I try to use the method that everyone suggested me: <meta http-equiv=”refresh” content=”0; URL=http://zacharycabal.tumblr.com/tagged/b&w”>, the webpage refreshes every 10 second which make it look bad. Is there a possible way to make it redirect and then never refresh again?

Qphp str_replace dollar signPHP

Hi I am having trouble replacing a string with dollar sign $string = “The $NAME brown fox jumped over the lazy dog.”; echo preg_replace(‘/\$NAME/’, “Sample Name”, $string); Output: The brown fox jumped over the lazy dog. The problem is that $NAME is not replaced with Sample Name. I will be happy if there will be [...]

QbindParam and NULL int valuesPHP

I am using bindParam to set values for a MySQL insert. The column in question is an INT (11). It has a default of NULL and null is allowed. However, using bindParam it always receives a 0. I have confirmed that my $_POST['value'] is indeed null. if(isset($_POST['value'])){ $stmt = $db->prepare(“INSERT INTO table (column) VALUES (:column)”); [...]

QHow to startActivityForResult with a medium activity?Android Solutions

I have 3 activities A, B, C. I need to call A -> B -> C -> A. Activity A needs result from C but compulsorily calls B. I did try below, but it does not work!: A calls startActivityForResult(B), B calls startActivityForResult(C) then B.finish(), C has returnIntent to A then finish(). Thank you very [...]

QPHP lazy evaluationPHP

I’m trying to do lazy variable evaluation using PHP. Contrived example code: <?php function title($page) { return $page . ‘ – $_GET["title"]‘; } ?> <title><?= title($_SERVER['SCRIPT_NAME']) ?></title> $_GET['title'] isn’t being evaluated. How can I achieve this?

QOutputting database result to a text boxHTML

When I connect to my database and try to output it’s result in to a text box, it wouldn’t print anything that would comes after a space. For example, as shown in the image bellow, it only prints out Brown and wouldn’t show the rest. (This only happens if there is a space). However, this [...]

Qget page information and not the entire pagePHP

In index.php though the name can be anything, I have an array at the very top for now, just for testing purposes. <?php $settings = array( enabled => true, id => “KMS”, theme=>”kms_standard”, ); ?> I started this to use as information to use in my CMS table. Basically I am scanning the main directory [...]

QHow to get data from mySQL database table with certail answer into php outputPHP

I am a new guy when it comes to using php and mysql. I am just working on something for my personal development and I have ran into a few things that I can not find the answer to. I have found from the the php.net tutorials on mysql and php output that I can [...]

QTextView different size and arrangement issueAndroid Solutions

PROBLEM I want to make my TextView look like below pic, is it possible ? please advice, Thank ! NOTE when I use spannable and set ° to become small, its height is place at the middle of 20. However, I can’t make C and ° in the same vertical.

Qwhat files to share android app sourcecodeAndroid Solutions

What is the best way to share android app with friend like i send him the whole project files or should i delete some files like cache or gen folder or something. i just started in android development and i want the right way to share app without having problems on the other side. also [...]

QLogout scripts in php [on hold]HTML

My logout script in php is as follows. <?php //log out script for the whole application //Destroying the session session_start(); session_destroy(); header(“Location:../../index.html”); ?> But it wont go to the proper place.my index file is just outside the logout script.Thanks in advance.

QAndroid debugging only reporting errorAndroid Solutions

I’m developing an app for android and when my phone (other phones I try with don’t have the same problem) is hooked up and running, logcat constantly reporting and error that’s not originating from my app and no other log information is buried in there. The tag reads QCPFile and the text reads LHJ – [...]

QAndroid AOSP – adding app to /packages/appsAndroid Solutions

I need to add a new app that I wrote in Eclipse to the /packages/apps folder in Android AOSP. But after the copying the app folder into that directory, building, and rebooting Android, I don’t see my app in the launcher. I see that the Android.mk file is missing. I want to ask what is [...]

QChanging images periodically in JavaScriptHTML

So basically I want to change image in every 5 second, so I wrote the following Javascript code and tag it to html. But the console keep saying that “No javaScript on this page” and the code does not apply <!DOCTYPE html> <html> <head> <meta charset=”utf-8″> <title>JavaScript for Programmers</title> </head> <body> <h2>Mood Change</h2> <p>The mood [...]

QHow to add validation to my input form? [on hold]HTML

I’m new at this so please bear with me. I have created a working form where a user can input his information which will later on be sent to the phpMyAdmin database when he/she clicks submit. This function is working perfectly. However, I would like to add validation to my this form. The following fields [...]