Menu
  • HOME
  • TAGS

Include both local and server at the same time

php

file_exists: http://php.net/manual/en/function.file-exists.php is_dir: http://php.net/manual/en/function.is-dir.php Best way to do that is use dirname(__FILE__) which gets the directory's full path of the current file in ether unix of windows format. Then we use realpath() which conveniently returns false if file does not exist. All you have to do is specify a relative...

Warning: preg_match_all(): Unknown modifier '\' [duplicate]

php,regex,warnings

Use a different set of delimiters for the regex. For example, you can write preg_match_all('~[^/\s]+/\S+\.(jpg|png|gif)~', $string, $results ...

PHPMailer not sending e-mail through Gmail, returns blank page

php,email,gmail,phpmailer,send

You've got some very confused code here. You should start out with an up-to-date example, not an old one, and make sure you're using the latest PHPMailer (at least 5.2.10). Don't do this: require('PHPMailer-master/PHPMailerAutoload.php'); require_once('PHPMailer-master/class.smtp.php'); include_once('PHPMailer-master/class.phpmail.php'); All you need is this, which will auto-load the other classes if and when...

Symfony 2 unable to pass entity repository to form

php,forms,symfony2,runtime-error

You have not included the Symfony EnityRepository class at the top of your form file so PHP is looking for it in the same directory as your form class. Hence the error message. Add this to your form class (or qualify EntityRepository inline): use Doctrine\ORM\EntityRepository; ...

Composer dump-autoload gives preg_match error

php,composer-php,autoload

autoload should be moved out of require-dev: { "require-dev":{ "phpunit/phpunit":"4.5.*" }, "autoload":{ "psr-0":{ "Yii\\":"yii-1.1.14.f0fee9/" } } } You can test your composer.json file using composer validate. Your original file returned: ./composer.json is invalid, the following errors/warnings were found: require-dev.autoload : invalid value, must be a string containing a version constraint...

Laravel Interfaces

php,laravel,interface,namespaces

In my recent laravel 5 project, I'm used to prepare my logics as Repository method. So here's my current directory structure. For example we have 'Car'. So first I just create directory call it libs under app directory and loaded it to composer.json "autoload": { "classmap": [ "database", "app/libs" //this...

What are correct permissions for Linux Apache2 PHP 5.3 log file?

php,linux,apache,logging,permissions

I'd simply set its owner to apache user. This will give you the name of apache user : ps aux | grep httpd In my case (CentOS), it's 'apache' but sometimes it's 'www-data'... chown apache:apache /var/log/httpd/php_errors.log chmod 600 /var/log/httpd/php_errors.log ...

RecursiveIteratorIterator to fetch subdirectories

php

I would change if ( $dir->isDir() ) to if ( $dir->isDir() && $dir != $root) to remove the root directory...

Store regex pattern as a string in PHP when regex pattern contains both single and double quotes

php,regex

The quotes are an issue but not the issue you are running into when you escape them. Your delimiter is terminating your regex just before the closing a which is giving you the unknown modifier error. It appears you don't have error reporting on though so you aren't seeing that....

Use SQL output 1 by 1

php,mysql

Store your results arrays in an array: <?php $RankSql = 'SELECT * FROM games WHERE Genre LIKE "%'.$Genre.'%" ORDER BY Score DESC limit 5'; $Rankresult = mysql_query($RankSql); $games = array(); while($RankOrder = mysql_fetch_array($Rankresult)) { $games[] = $RankOrder; }; // ex: third game (remember, arrays start at zero) echo $games[2]['Game']; ?>...

Database connection successful but not able to insert data into database using php [on hold]

php,mysqli

I'll post this here, we all make mistakes so don't worry! As suggested your $mysqli function is undefined, you've stored your mysqli instance as the $con variable, so you should refer any mysqli functions on that. Examine http://php.net/manual/en/mysqli.query.php for more information!...

How to post time value in database in PHP

php,mysql

It is very simple: You code here: $id_time = date("d-m-Y",time()); Please UPDATE THAT INTO; $id_time = date("Y-m-d",time()); Your sql is ok. And I hope that will work....

access the json encoded object returned by php in jquery

php,jquery,ajax,json

Try: $.ajax({ url: "functions.php", dataType: "JSON", data: {id: id}, type: 'POST', success: function(json){ for(var i=0;i<json.length;i++){ alert(json[i].fname); } } }); ...

PHP: While loop not working after adjusting SELECT for SQL injection prevention

php,mysql,select,sql-injection,associative-array

You cannot bind column and table names, only data. You need to specify the table and then bind for your '%calendar weekday%'. $stmt = $conn->prepare("SELECT " . $selectLang . " FROM `TranslationsMain` WHERE `location` LIKE ? ORDER BY `sortOrder`, " . $selectedLang); $stmt->bind_param('s', $calendar_weekday); ...

Format date (with different input) php

php,date,format,multilingual,jquery-validation-engine

I know that Zend has some of this logic in there zend_date (requires Zend Framework ^^), but I would just use a simple solution like this: (where you get the format from a switch statement) $date = $_POST['date']; $toConvert = DateTime::createFromFormat('d-m-Y', $date); switch($lang){ case 'de': $format = 'Y-m-d'; break; default:...

Symfony/Twig how to render a Route set by anotation?

php,symfony2,routing,twig,url-routing

When you omit the name it's being autogenerated for you. The autogenerated name is a lowercase concatenation of bundle + controller + action. For example, if you have: Bundle AppBundle Controller MyController Action: testAction() the name would be app_my_test. You can list all routes using Terminal: php app/console router:debug All...

Error connecting to MSSQL using PHP

php,sql-server,pdo,odbc,sqlsrv

Change it to: $this->link = new PDO( "sqlsrv:Server={$this->serverName},{$this->port};Database={$this->db};", $this->uid, $this->pwd ); The default SQL Server port is 1433. Note the curly brackets, they allow for class variables....

How to register global variable for my Laravel application?

php,laravel,laravel-5

Actually, you should reserve in config/app.php file. Then, you can add In the Service Providers array : 'Menu\MenuServiceProvider', In the aliases array : 'Menu' => 'Menu\Menu', Finally, you need to run the following command; php artisan dump-autoload I assume that you already added this package in composer.json Sorry, I didn't...

mysql_real_escape_string creates \ in server only not in local

php,sql

Your server has magic quotes enabled and your local server not. Remove it with the following sentence set_magic_quotes_runtime(0) As this function is deprecated and it will be deleted in PHP 7.0, I recommend you to change your php.ini with the following sentencies: magic_quotes_gpc = Off magic_quotes_runtime = Off If you...

Dynamically select from a dynamically generated dropdown

php,html,select,drop-down-menu

It is because you aren't ending the value attribute, so your selected option becomes <option value="optionvalueselected" -- 'optionvalue' being the value of your selected option, and 'selected' being the attribute you want to set, but won't be set because you never ended value The following should work: <select name="course_id" id="course_id">...

php redirection working in chorme but not on firefox

php,google-chrome,mozilla

have you tried using header('location') function? example : <?php if (isset($_POST['putonline'])) { $query = "UPDATE user SET status= '1' WHERE id= '$new_id'"; $result = $cid-> query($query); if ($result== TRUE) { header("location:EidEmp.php"); die(); } else { echo "Failed"; } } ?> Edited : Maybe Change Your header function with javascript function...

How to get all ActiveRecord objects in Yii2?

php,yii,yii2

If you are getting your objects, you are still able to iterate through them. Try to make following simple change (look at "+=" change to "0"): public function getAllCategories(){ $categoriesList = array(); $categories = Category::find()->orderBy("id")->all(); foreach ($categories as $category){ $categoriesList[] = $category->title; } return $categoriesList; } Here is some reference...

Trying to rewrite mysql_* to pdo

php,mysql,pdo

I don't know the source of the array $arr = array();, but it is assigned to null before the insert query. So it means, literally you are inserting nothing into the database. So check your array well, maybe it was to be like $arr = array('name'=>'My Name', 'url'=>'url', 'email'=>'my email',...

Mixing

php

Set short_open_tag=On in php.ini And restart your Apache server...

Rewrite url not working in htaccess

php,apache,.htaccess,mod-rewrite,url-rewriting

QUERY_STRING is only used to match query string without URI. You need to use: Options -MultiViews RewriteEngine On RewriteBase /mywbsite/ RewriteCond %{THE_REQUEST} /search_data\.php\?keywords=([^&]+)&f=([^\s&]+) [NC] RewriteRule ^ search/%1/%2? [R=301,L] RewriteRule ^search/([^/]+)/([^/]+)/?$ search_data.php?keywords=$1&f=$2 [QSA,L,NC] ...

With a OneToMany relation between entities, how create the right queryBuilder with Doctrine (on the Inversed Side entity)

php,symfony2,doctrine2,one-to-many,query-builder

When you specify multiple FROMs, later one will overwrite the previous ones. So, instead of writing: $queryBuilder ->select('pm', 'c') ->from('MySpaceMyBundle:PointsComptage', 'pc') ->from('MySpaceMyBundle:ParametresMesure', 'pm') ->leftJoin('MySpaceMyBundle:Compteurs', 'c', 'WITH', 'pm.compteurs = c.id') ->where('pc.id = c.pointsComptage ') ->andWhere('pc.id = :id') ->setParameter('id', $id); I believe you need something like this: $queryBuilder ->select('pc', 'c', 'pm') ->from('MySpaceMyBundle:PointsComptage',...

Pass variable from Javascript to PHP to write to file

javascript,php,html,post

Add jQuery library in the <head> first: <head> .. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js/jquery.min.js"> .. </head> Then, try this with Ajax: $.ajax({ type: "POST", url: "my.php", data: { postres: res } }); ...

How to program a recurring billing/invoice system using PHP and MySQL

php,mysql

Cron sounds good. (Also it is worth to mention the MySQL Event Scheduler, but again I would go for a Cronjob) A copy would be something like this SQLFIDDLE: create table t ( id int, d date ); insert into t values( 0, CURDATE() ); insert into t values( 2,...

Laravel 4.2 Sending email error

php,email,laravel,laravel-4

Closures work just like a regular function. You need to inject your outer scope variables into function's scope. Mail::send('invoices.mail', array($pinvoices,$unpinvoices), function($message) use ($email) { $message->to($email , 'Name')->subject('your invoices '); }); ...

Comparing two values in the same row and change if needed

php,mysql,loops

Below query will work, unless you need to do query optimization and reduce the locking period UPDATE Product SET Voorraad = Minvoorraad WHERE Minvoorraad > Voorraad ...

How to modify CodeIgniter calendar to handle multiple events per day?

php,codeigniter,calendar

If you want to show all four boxes for the dates which has data, try to change the get_calendar_data() foreach as below, $content = ""; $lastDay = -1; $index = 0; foreach ($query->result() as $row) { if($lastDay != intval(substr($row->date_cal, 8, 2))){ if($index > 0 ){ if($content != ''){ $cal_data[$lastDay] =...

How do I display my mysql table column headers in my php/html output?

php,html,mysql,table,data

Note: You can just make a single file out of it to achieve your wanted output Use mysql_real_escape_string() to sanitize the passed-on value to prevent SQL injections You should use mysqli_* instead of the deprecated mysql_* API Form them in a single file like this (display.php): <html> <form method="post" name="display"...

how to escape php code in echo with javascript

javascript,php

You are mixing inline PHP with a PHP command (echo). When you are echoing a string, you do it just like normal, this means you can mix literal strings (the js you are manually typing) and the output of functions (like a json in this case): echo "<script type='text/JavaScript'> var...

Time format conversion with PHP

php,time

<?php $duration="1H10M5S"; $display=str_replace(array('H','M','S'), array(' Hour(s) ',' Minute(s) ',' Seconds'), $duration); echo $display; Output 1 Hour(s) 10 Minute(s) 5 Seconds Fiddle...

Laravel relation many to many with additional pivot

php,laravel,laravel-4

As per your requirement, I blieve you have to update your relation to Polymorphic Relations. and than to access other attributes try one of them method. $user->roles()->attach(1, ['expires' => $expires]); $user->roles()->sync([1 => ['expires' => true]]); User::find(1)->roles()->save($role, ['expires' => $expires]); If you still facing some dificulties to handle that requirement let...

How to secure configuration file containing database username and password

php,security

As @Darkbee stated, the simplest way is to have the file outside your website root. This would be accessible on the server, but not to the public under any circumstances. The alternative is to set the permissions to 400 on the file. .htaccess could block access, but not blocking access...

Count amount of inputfields with the same name in PHP?

php,input,count

You set $termin_von only once before loop. $termin_counter = 1; while(true) { $termin_von = 'termin'.$termin_counter.'_von'; if(!isset($_POST[$termin_von])) break; echo $termin_counter++; } ...

How to search images by name inside a folder?

php,mysql,image

This looks like a job for glob, which returns an array of file names matching a specified pattern. I'm aware of the other answer just posted, but let's provide an alternative to regex. According to the top comment on the docs page, what you could do is something like this:...

Having two arrays in variable php

php,mysql,arrays,variables,multidimensional-array

The explode function is being used correctly, so your problem is further up. Either $data[$i] = mysql_result($result,$i,"data"); isn't returning the expected string "2015-06-04" from the database OR your function $data[$i] = data_eng_to_it_($data[$i]); isn't returning the expected string "04 June 2015" So test further up by echo / var_dump after both...

Force linux to use php as php55

php,linux,fedora

You can create an alias: alias php="php55" Now if you type php it uses php55...

Changing file name to the user's name PHP

php,file,upload

You need to change your $target_file variable to the name you want, since this is what gets passed into move_uploaded_file(). I don't see anywhere in your code where you actually set this variable to their username (right now it's still using the name they selected when they uploaded it). Without...

MySQL Query returning strange values

php,mysql

You need to join by account_id and also question_id SELECT * FROM `quiz_questions` INNER JOIN `quiz_answers` ON `quiz_questions`.`account_id` = `quiz_answers`.`account_id` AND `quiz_questions`.`question_id` = `quiz_answers`.`question_id` WHERE `quiz_questions`.`account_id` = '1840979156127491' ORDER BY `quiz_questions`.`question_id` ASC LIMIT 5 ...

ZF 2 - Fatal Error: Call to a member function getPosts() on null

php,zend-framework2,fatal-error,member-function

You have registered the controller as an 'invokable'. When the the controller manager creates IndexController it will do so without using the IndexControllerFactory; therefore the Rxe\Factory\PostsTable dependency is never set. To fix this, update module.config.php and register the index controller with your factory class. 'controllers' => [ 'factories' => [...

php include capitalization on files

php

Your local host must be Windows, that doesn't differentiate between upper and lower case in file names and your web server Unix Based which does, simple as that.

Wordpress log out using URL and redirect to specify page

javascript,php,wordpress

Try wp_logout() function use the funtion . if($_GET['logout'] == 1) { ob_start(); error_reporting(0); wp_logout(); $redirect = wp_logout_url(); wp_safe_redirect( $redirect ); } ...

$http.get returns actual php script instead of running it (yeoman, grunt)

php,angularjs,pdo,gruntjs

Change $http.get('/scripts/php/articles.php') to $http.get('http://YOURDOMAIN.COM/scripts/php/articles.php') Off course you need to replace YOURDOMAIN.COM with localhost or any other domain you are using....

WooCommerce seems to only orderby date and not price

php,ajax,wordpress,woocommerce

Try this: $args = array( 'post_type' => 'product', 'posts_per_page' => 100, 'product_cat' => 'beast-balls', 'orderby' => 'meta_value_num', 'meta_key' => '_price', 'order' => 'asc' ); ...

Get filesystem path from a PHP streamwrapper?

php

The StreamWrapper class represents generic streams. Because not all streams are backed by the notion of a filesystem, there isn't a generic method for this. If the uri property from stream_get_meta_data isn't working for your implementation, you can record the information during open time then access it via stream_get_meta_data. Example:...

Symfony2 creating and persisting entity relationships

php,mysql,symfony2,doctrine2

When you create two entities with a one-to-one relationship, both entities need to be persisted either explicitly or by using cascade persist on one side of the relationship. You also need to explicitly set both sides of the relationship. Doctrine - Working with Associations - Transitive persistence / Cascade Operations...

Why am getting this error?: Unknown column 'firstname' in 'field list'

php,database,mysqli

$query = "INSERT INTO `myDatabaseForAll`.`users` (`id`, `firstname`, `lastname`, `username`, `password`) VALUES (NULL, $firstname, $lastname,$username,$password)"; you need single quote around text feilds in sql queries change above query to $query = "INSERT INTO `myDatabaseForAll`.`users` (`id`, `firstname`, `lastname`, `username`, `password`) VALUES (NULL, '$firstname', '$lastname','$username','$password')"; ...

timestamp SQL to Excel

php,mysql,sql,excel

The ###### is shown in MS Excel when the data in a cell is too long for the column width.... the data inside the cell is still correct, as you can see if you select one of those cells and look at the value displayed in the cell content bar...

Handling 500 Internal Server Error from DomDocument in Laravel 5

php,laravel,exception-handling,laravel-5

You could handle this in Laravel app/Exceptions/Hnadler.php NB: I have looked in the option of using DOMException handler which is available in PHP, however the error message you are getting in not really and exception by an I/O Warning. This what PHP native DomException looks like: /** * DOM operations...

How to Match a string with the format: “20959WC-01” in php?

php,regex

$pattern = '! ^ # start of string \d{5} # five digits [[:alpha:]]{2} # followed by two letters - # followed by a dash \d{2} # followed by two digits $ # end of string !x'; $matches = preg_match($pattern, $input); ...

Cant submit form

javascript,php

Your PHP is checking if $_POST['submit'] contains a value. Your form does not contain a form element with the attribute name="submit", so therefore it fails and moves straight to the else statement. If you want to check if the form was posted then you should instead check for: if (!empty($_POST))...

JQuery mutiple post in the same time

javascript,php,jquery,json

You can use the jQuery when function (https://api.jquery.com/jquery.when/) to wait for all three promises to resolve. You only need to make sure you also return the promise in your nb1, nb2, nb3 functions. function nb1() { return $.post("p1.php", { action: 1 }, function(data) { console.log(data); }, "json") .fail(function(data) { console.log("error");...

PHP / MySQLi: How to prevent SQL injection on INSERT (code partially working)

php,mysql,mysqli,sql-injection,sql-insert

In the New PHP code snippet, you are still vulnerable to injections. You are using a prepared statement in the insert part, but you are not actually using the preparations strengths correctly. When creating a prepared statement, you create a query in which you add placeholders instead of the raw...

How can we validate multiple fields with one validation in cakePHP 2.0?

php,cakephp

You will want to setup a custom validation rule for testing that the 'full name' is unique. For example, in your model add a new method for validation like this:- public function validateUniqueFullName(array $data) { $conditions = array( 'first_name' => $this->data[$this->alias]['first_name'], 'last_name' => $this->data[$this->alias]['last_name'] ); if (!empty($this->id)) { // Make...

PHP Regular Expressions Counting starting consonants in a string

php,regex

This is one way to do it, using preg_match: $string ="SomeStringExample"; preg_match('/^[b-df-hj-np-tv-z]*/i', $string, $matches); $count = strlen($matches[0]); The regular expression matches zero or more (*) case-insensitive (/i) consonants [b-df-hj-np-tv-z] at the beginning (^) of the string and stores the matched content in the $matches array. Then it's just a matter...

compare today's date with unix timestamp value in database

php,mysql

If I understand correctly you have a unix timestamp in a varchar field and you can't change this. If you compare the unix timestamp directly you will only get results that match the exact second of the timestamp. You can use FROM_UNIXTIME() to convert the timestamp in a date value...

Wordpress End If Statements

php,wordpress,woocommerce

<?php if ( sizeof( $woocommerce->cart->cart_contents ) == 0 ) { // The cart is empty } else { ?> <div class="header-cart-inner"> <a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo...

How many characters are visible like a space, but are not space characters?

php,regex

You can make use of a Unicode category \p{Zs}: Zs    Space separator $string = preg_replace('~\p{Zs}~u', ' ', $string); The \p{Zs} Unicode category class will match these space-like symbols: Character Name U+0020 SPACE U+00A0 NO-BREAK SPACE U+1680 OGHAM SPACE MARK U+2000 EN QUAD U+2001 EM QUAD U+2002 EN SPACE U+2003 EM SPACE...

SQL Group By multiple categories

php,mysql,sql,mysqli

Just include a case statement for the group by expression: SELECT (CASE WHEN Categories.name like 'Cat3%' THEN 'Cat3' ELSE Categories.name END) as name, sum(locations.name = 'loc 1' ) as Location1, sum(locations.name = 'loc 2') as Location2, sum(locations.name = 'loc 3') as Location3, count(*) as total FROM ... GROUP BY (CASE...

Fatal error catched by register_shutdown_function and update json_encode

php,json,fatal-error

Why move one array to another array and then echo the second array. Why not just do this function shutdown(){ $error = error_get_last(); echo json_encode($error); } Or even this function shutdown(){ echo json_encode(error_get_last()); } Apart form the use of an unnecessary array, this will give you all the information available...

option onsubmit and alert not working together

javascript,php

Quite simply, you just need to return true inside the function. function checkSubmit() { if (document.getElementsByName('link')[0].value == 'blank' ) { alert('Please select a database'); return false; } return true; } What was happening before was either false or undefined was being returned to the first section of the &&. Because...

Pull information from SQL database and getting login errors

php,sql,database

change $username = "'rylshiel_order"; to $username = "rylshiel_order"; and you should be through. You are passing on an extra single quote here. ...

Is it a good practise store the checkout steps fields in php $_SESSION?

php,session,e-commerce,checkout

Create an Class that uses $_SESSION to store the data so you can use something simple like this: // start checkout $checkout = new checkout(); // to add data $checkout->AddName = $_REQUEST['name_name']; // retrieve name $name_name = $checkout->Name; // empty checkout session on success $checkout->reset(); ...

Jquery parsley validate not working

javascript,php,jquery,ajax,parsley.js

Make sure this line: $('#remarks').parsley( 'addConstraint', { minlength: 5 }); is called before you check isValid()....

array and function php

php,arrays

$x and $y are only defined within the scope of the function. The code outside of the function does not know what $x or $y are and therefore will not print them. Simply declare them outside of the function as well, like so: <?php function sum($x, $y) { $z =...

Advise on simplifying a PHP statement

php,joomla,coding-style

I'd be inclined to do something like this: if(!empty($extrafields[15]) && !empty($extrafields[16])){ if($extrafields[15] == "Yes"){ echo "<span class=sgl-bold>Sponsored by:&nbsp;</span>"; echo $extrafields[16]; echo "<br>"; } //endif not empty } //endif yes ...

how to multiply two column names using codeigniter validation rule

php,codeigniter,validation

You done need to do anything with your controller. Add this change your view to <script> function calculate() { var myBox1 = document.getElementById('crop_quantity').value; var myBox2 = document.getElementById('per_rate').value; var result = document.getElementById('income_amount'); var myResult = myBox1 * myBox2; result.value = myResult; } window.onload = calculate(); </script> <div class="control-group"> <label class="control-label">Crop Quantity</label>...

Nested foreach loop in a While loop can make the condition for the while loop go over?

php,loops,foreach,while-loop

Glad you found an answer. Here is something I was working on while you found it. // SET START DATE $startDate = new DateTime($dateStart); $nextBill = new DateTime(); for($i=1;$i<$countDays;$i++){ switch(true){ case ($startDate->format('j') > $days[2]): // go to next month $nextBill->setDate( $startDate->format('Y'), $startDate->format('m')+1, $days[0]; ); break; case ($startDate->format('j') > $days[1]): //...

Validation of a form before submission

php,validation,symfony2,form-submit

In place of: $form->submit($request->request->get($form->getName())); Try: $form->submit(array(), false); ...

Unable to configure Symfony (3rd party) bundle

php,symfony2,rss

I havent tried this bundle yet, but i think you need to tell doctrine that you want to save your newly created feed into the database: $feeds = new Feed; $reader->readFeed($url, $feeds, $date); $em = $this->getDoctrine()->getManager(); $em->persist($feeds); $em->flush(); return $this->render('default/index.html.twig'); UPDATE According to the docs if you want to use...

convert from json to array

javascript,php,json

First off, your associative array is flipped. You need to change array($wholeNumber['DocumentNbr'] => 'Number', $wholeNumber['DocumentRevision'] => 'Revision'); to array('Number' => $wholeNumber['DocumentNbr'], 'Revision' => $wholeNumber['DocumentRevision']); You need that in order to access the elements of the JSON. Then, in your loop, you would use wholeNumberData[i].Number to get the number and wholeNumberData[i].Revision...

Click on link next link should be display on same page

javascript,php,jquery,html,css3

Ok, so i tried to decypher what you meant with your Question. To Clarify: He has this one page setup. inside the div Our Project, there are two Buttons or links Visit more. When clicked, he wants the About Section to be shown. All in all it is impossible for...

How to create multiple jquery form fields and insert in mysql database, without using mysql_real_escape_string

javascript,php,jquery,mysql

Your problem has nothing to do with jQuery and the form. It is just highly recommended to prevent SQL injection, an attack in which an attacker injects SQL commands into your DB Query by posting it in your form. That's why any data that comes from an untrusted source (eg...

php mysql select insert on different DBs in same server

php,mysql,insert-into

If your connection has rights to both databases, there is no need to have two connections. A database connection is a connection to the server, not to a specific database (although you can select a default database within the connection). What you can do is normal INSERT INTO SELECT within...

Making an alert() with PHP and ajax

javascript,php,jquery,ajax

You're trying to output javascript from the php, without outputting it in your ajax callback, won't work. The easiest way to do what you want, is to return the string with your php, and handle the outputting to your javascript. something like : if($QueueCount == 1){ Echo "You already have...

Fatal error in if stament [duplicate]

php,mysql,mysqli

Just change the condition to: if(isset($_REQUEST['userid']) && $_REQUEST['userid'] > $user_hack) isset tells is a variable is set, while this statement may be true or false, on which you cannot call isset function. Until you check if(isset($_REQUEST['userid'])), you cannot assign it to $userid variable....

MySQL trigger help, capturing a variable from php insert into

php,mysql,triggers

You are on the right path: IF (SELECT true FROM redcap_encryption WHERE ProjectID=NEW.project_id AND FieldName=NEW.field_name).... ...

How to check if objectB used instance of objectA from objectA using private variables

php,oop

Use Getters and Setters. The below code will let the $mesh_name property be read, but not written by external code. class MyObject { protected $mesh_name = 'foo'; protected $accessible = ['mesh_name']; protected $writable = []; public function __get($name) { if( in_array($name, $this->accessible) ) [ return $this->name; } else { //...

Using crontab to call wget every 5 minutes

php,symfony2,crontab,wget

use the console component make it run your hello.php script call the command in your crontab bash /your/dir/app/console yourcommand or even simpler run php your/dir/hello.php...

autoloading nested classes with composer

php,namespaces,psr-0,psr-4

Well you need to keep the guidelines of psr-4 as you are using it to autoload. change the folder name "rules" to "Rules" Uppercase all your file names of classes like: between.php --> Between.php that should do the job...

Array in Foreach (CodeIgniter)

php,arrays,codeigniter,foreach

You can use active record as below. $arrResult = $this->db ->where('id','foo') ->where_in('result',array(1,2)) // alternative to above condition //->where('(result = 1 OR result = 2)') ->get('mytable') ->result_array(); foreach($arrResult as $result){ // run code based on $result; } ...

most efficient way to create javascript array out of various php arrays

javascript,php,jquery,arrays

John, Try this: var dataSet = []; for (i = 0; i < mfrPartNumber.length; i++ ) { data = [dateReceived[i],name[i],color[i]]; dataSet.push(data); } This will build an array out of each instance of [i], and keep growing as your user keeps pushing the button....

concatenate field names in a mysql update with inner join

php,mysql

You can try as per below- UPDATE products pr INNER JOIN sub_categories sc ON sc.id = pr.sub_category SET slug = REPLACE(TRIM(LOWER(CONCAT(sc.subcat_name,'.',products.product_name))),' ', '-'); ...

How to pass a value from a page to another page in PHP

php

Only values that are sent by a form will be in the GET or POST array. From what you are showing I conclude that you don't want to show the field in your form, so make it hidden. Add this inside your form tag: <input name="price" type="hidden" value="'.$price.'" class="inputClass"> Also,...

Php Mysql Query not working properly

php,mysql

No need to use union as it will give a lots of duplicate data What you want to achieve can be done with simple left join or inner join SELECT m.issue_name ,m.issue_type , m.priority ,m.status,m.description , m.start_date,m.end_date,m.duration, s.name as server_name,p.name as product_name from mod_networkstatus as m LEFT JOIN tblservers as...

How can I replace the white rectangle within an image using ImageMagick?

php,image-processing,imagemagick

I think you can locate the shape pretty accurately with a simple threshold, like this: convert image.jpg -threshold 90% result.jpg and you can then do a Canny edge detection like this: convert image.jpg -threshold 90% -canny 0x1+10%+30% result.jpg The next things I would be looking at are, using the -trim...

When I click to the next page on pagination,it goes to 404 error in codeigniter

php,codeigniter,pagination

in config.php $config['base_url'] = ''; $config['index_page'] = ''; in your router $route['news/(:any)'] = 'news/$1'; $route['news'] = 'news'; $route['default_controller'] = 'news/create'; $route['(:any)'] ='pages/view/$1'; and place .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> EDIT 01 <?php $data['title'] = 'Database Details'; $count = $this->news_model->record_count()...

Error: Expected expression, got end of script

javascript,php,onclick,syntax-error

That makes no sense. You are assigning a URL to a onclick, that is wrong. If you want to go to a page, you need to set the window location or wrap the button in an anchor. onclick="window.location.href='http://www.example.com';" Using inline events is bad practice....

Notice: Array to string conversion in “path of php file” on line 64

php,mysql,arrays,oracle

Curly brackets are your friend when inserting variables into double quoted strings: $main_query=oci_parse($connection,"INSERT INTO ROTTAN(NAME,ROLLNO) VALUES('{$array[$rs][0]}','{$array[$rs][1]}')"); ...