• Member Avatar for AndrisP
    AndrisP

    Created bash sed save to variables and do something

    How i can `sed` save pattern matches to variables and do something with it? eg $ echo "string_4.3.2" | sed 's/^string_\([0-9]\)\.\([0-9]\)\.\([0-9]\)$/\1 \2 \3/' output "4 3 2" but I want …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching bash sed save to variables and do something

    How i can `sed` save pattern matches to variables and do something with it? eg $ echo "string_4.3.2" | sed 's/^string_\([0-9]\)\.\([0-9]\)\.\([0-9]\)$/\1 \2 \3/' output "4 3 2" but I want …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in SVG Path to Circle to Canvas system ?

    You can drav small circle eg <circle r=".5" cx="73.3" cy="73.1" fill="black" />
  • Member Avatar for AndrisP
    AndrisP

    Began Watching SVG Path to Circle to Canvas system ?

    How can I take a path such as what you see below and have Javascript make a visible circle or dot based on the path class ? As well output …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Need help on how to if record exists update else insert

    begin insert into your_table .... exception when dup_val_on_index then update your_table... end;
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Need help on how to if record exists update else insert

    Need on the best way to going about programming this in c#. I'm trying to do an if record exists update statement else insert statement: OracleConnection con = new OracleConnection(strConnection); …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Help with sum of Even or Odds Array

    @ deceptikon - Thank you for comment. I will follow on your recommendation.
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Help with sum of Even or Odds Array

    ... or use bitwise operator `if(i&1)` if true even else odd. Its faster because compare one bit only without mathematics
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Help with sum of Even or Odds Array

    Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in What is correct regex for alphanumeric and space

    Your pattern checked only first character. Change to: `(!preg_match("/^[0-9a-zA-Z ]+$/", $name3))`
  • Member Avatar for AndrisP
    AndrisP

    Began Watching What is correct regex for alphanumeric and space

    I've been Googling this one, and I've come across solutions, but they don't seem to work for me. The code is as follows: <?php $name1 = "Jack Random"; // true …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Count characters in a string

    strlen(trim($string))
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Count characters in a string

    Sir I have these codes $string = ' ab'; echo (strlen($string))."<br>"; // returns 4 $count = mb_strlen($string); echo $count."<br/>"; // returns 4 $length = count(str_split($string)); echo $length."<br/>";// returns 4 All …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Array not running after file prompt.

    "array" need passing as reference to function "selectionSort"
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Array not running after file prompt.

    I've been struggling with this for a few days now. I've finally got it working in pieces, but when my sorting array runs, all I get is empty space. My …
  • Member Avatar for AndrisP
    AndrisP

    Gave Reputation to rubberman in c++ code

    Sorry, but this is invalid code. i is not initialized before you use it in the switch statement. It will contain random values.
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in c++ code

    #include <stdio.h> int main(){ int i,s=8; while(s<=100){ printf("\t%d\n", s); switch(i){ case 4: i+=1; break; case 5: i+=2; break; default: i=4; } s+=i; } return 0; }
  • Member Avatar for AndrisP
    AndrisP

    Began Watching c++ code

    8 12 17 24 28 33 40...100 by while loop
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP MYSQL - saving data from forms to database

    You have a form inside another form - may not correctly treated by browser
  • Member Avatar for AndrisP
    AndrisP

    Began Watching PHP MYSQL - saving data from forms to database

    What's wrong with my code? my save button is not working.. I need help please? thanks! here's my code: <?php include('header.php'); session_start(); ?> <?php include('navbar1.php'); ?> </br> </br> </br> </br> …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP and mysql Upload files

    Raed this topic https://www.daniweb.com/programming/web-development/threads/505941/insert-user-details-with-photo-into-database#post2209304
  • Member Avatar for AndrisP
    AndrisP

    Began Watching PHP and mysql Upload files

    dear friends, I have created Php form to store data in my mysql database. But i am facing problem in updating file data to store in database. Please check my …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in My C++ code works on Windows but I'm getting a segmentation fault on Ubuntu

    Your code works properly on Ubuntu 16.04 compiled by CodeBlocks IDE 13.12
  • Member Avatar for AndrisP
    AndrisP

    Began Watching My C++ code works on Windows but I'm getting a segmentation fault on Ubuntu

    I wrote and run this code in Windows, in DEV C++ but I am keep getting a Segmentation fault on Ubuntu's terminal when I try to run this program. Here …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in MySql syntax, can't get it to work

    Use brackets when you combine multiple `AND OR` conditions eg WHERE `aprove` = 1 AND (`descripcion` LIKE '%$search%' OR `nombre` LIKE '%$search%')
  • Member Avatar for AndrisP
    AndrisP

    Began Watching MySql syntax, can't get it to work

    Hello, its been a while since I use mysql and I breaking my head with this syntax: SELECT * FROM `Botones` WHERE `aprove` = 1 AND `descripcion` LIKE '%$search%' OR …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in SQL ERROR ORA-02270

    You cannot set combined primary key `CONSTRAINT SCREEN_PK PRIMARY KEY(BRANCHID,SCREENID)` The unique index may combine two (or more) fields eg `UNIQUE(BRANCHID,SCREENID)`
  • Member Avatar for AndrisP
    AndrisP

    Began Watching SQL ERROR ORA-02270

    /DROP TABLE STATEMENTS/ DROP TABLE BRANCH CASCADE CONSTRAINT PURGE; DROP TABLE SCREEN CASCADE CONSTRAINT PURGE; DROP TABLE SESSIONS CASCADE CONSTRAINT PURGE; DROP TABLE MOVIE CASCADE CONSTRAINT PURGE; /CREATE TABLE STATEMENT/ …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP category links

    What browser (version) do you use? And what DOCTYPE is declared in your HTML? Tag "details" is new in HTML5. It can be unsupported if your DOCTYPE declared older than …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP category links

    better looks this <?php function makeList(array $Array, &$Output) { foreach($Array as $Key => $Value) { if(is_array($Value)) { $Output .= '<details>'; $Output .= '<summary>'.$Key.'</summary>'; $Output .= makeList($Value, $Output); $Output .= '</details>'; …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP category links

    You can use http://www.w3schools.com/tags/tag_details.asp <?php function makeList(array $Array) { $Output = '<details>'; foreach($Array as $Key => $Value) { if(is_array($Value)) { $Output .= '<summary>'.$Key.'</summary>'; $Output .= makeList($Value); } else { $Output …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching PHP category links

    Hello, I have a multidimensional array i like to make every category to be clickable and to show its own sub-categories i have something like this... pls help to achieve …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP array categories

    PHP arrays unlimited levels but ini file seems 2 levels only
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP array categories

    Make multidimensional array eg $categories = array( 'cars' => array( 'BMW' => array( 'X1', 'X3', 'X5', 'X6' ), 'AUDI' => array( 'A3', 'A6' ), 'MERCEDES' ), 'moto' => array( 'SUZUKI', …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in insert user details with photo into database

    MySQL is deprecated http://php.net/manual/en/function.mysql-query.php use MySQLi instead http://php.net/manual/en/book.mysqli.php or PDO http://php.net/manual/en/class.pdo.php . For BLOB upload you can use http://php.net/manual/en/mysqli-stmt.send-long-data.php
  • Member Avatar for AndrisP
    AndrisP

    Began Watching insert user details with photo into database

    <?php error_reporting(E_ALL ^ E_DEPRECATED); // connection to database include 'database.php'; ?> <?php if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { //// Temporary file name stored on the server $tmpName = $_FILES['image']['tmp_name']; …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP array categories

    Make DB table for categories and another table for brends with foreigh keys constraints referenced to categories and another table for models with constraints referenced to brends
  • Member Avatar for AndrisP
    AndrisP

    Began Watching PHP array categories

    Hello, i want to make a categories menu which each will have its own sub-categories and that category will have own sub-categories im trying to make with arrays but i'm …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Dynamic PHP pagination for different queries with different result sets

    oh sorry its a copy-paste
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Dynamic PHP pagination for different queries with different result sets

    maybe try $query = "select * from manuscript where year = :year limit, :offset , :refs"; $sql = $con->prepare($query); $offset = $page * $refs; $sql->bindParam(':year', $year, PDO::PARAM_INT); $sql->bindParam(':offset', $offset, PDO::PARAM_INT); …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Dynamic PHP pagination for different queries with different result sets

    use one of $query = "select count(*) from manuscript where year = :year"; $sql=$con->prepare($query); $sql->bindParam(':year', $year); $total = $sql->fetchColumn(); echo $total; or $query = "select count(*) from manuscript where year …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Dynamic PHP pagination for different queries with different result sets

    edit links: for($x=0; $x<$pages; $x++){ echo '<a href="index.php?page='.$x.'" style="text-decoration:none">'.($x+1).'</a>'; } after line 10 insert line `$sql->bind_param('i', $year);`
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Dynamic PHP pagination for different queries with different result sets

    Initialize request variables outside of function before you call it $year = filter_input(INPUT_GET, 'year', FILTER_VALIDATE_INT); $page = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $refs = filter_input(INPUT_GET, 'refs', FILTER_VALIDATE_INT); getYear($year, $page, $refs); drop lines …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Dynamic PHP pagination for different queries with different result sets

    show me your new version of function
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP OOP SELECT Query

    In fact you call basic function which contained in to the object declaration. I wold recommend write database class which is extended mysqli. In connstructor make connection, in destructor call …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Dynamic PHP pagination for different queries with different result sets

    Two similar function for different year is irrationally. I would suggest to transform `getYear()` and put year as parameter eg `getYear($year)`. You can set many parameters eg `getYear($year, $page, $refs)` …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Dynamic PHP pagination for different queries with different result sets

    I have been trying to get my PHP script return two different pages namely: get2015 and get2016. The aim is to have these two pages have pagination links below them. …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in PHP OOP SELECT Query

    It is not good idea because your db_select() function make new connection on each query
  • Member Avatar for AndrisP
    AndrisP

    Began Watching PHP OOP SELECT Query

    I'm trying to learn OOP and i'm trying to create a class which will select me info from a table and a line that i choose. (trying my best to …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in help i used forms html with php and getting the wrong email!

    And you can use attribute "required" for all required fields in a form such as: <input type="email" name="email" width="20" required="required" /> HTML5 input type "email" is supported. if you use …

The End.