• Member Avatar for cereal
    cereal

    Replied To a Post in $_Session['roleID'] not working?

    I made a mistake in my previous post, this: if ($_Session['roleID'] == 1) Should be: if ($_SESSION['roleID'] == 1) Uppercase! About this: `Parse error: syntax error, unexpected 'if' (T_IF) in...` …
  • Member Avatar for cereal
    cereal

    Replied To a Post in $_Session['roleID'] not working?

    The variable session must be always uppercase, so `$_Session` is not correct, change it to `$_SESSION`: $_SESSION['roleID'] The `session_start();` is included in the config file? Also, in the `IF` statement …
  • Member Avatar for cereal
    cereal

    Replied To a Post in array of post values

    Hi, you could use the `explode()` function: $data = array(); foreach($input as $key => $value) { $id = explode('-', $key); if(array_key_exists(1, $id)) $data[$id[1]][$key] = $value; } print_r($data); The `array_key_exists()` is …
  • Member Avatar for cereal
    cereal

    Replied To a Post in cannot pass if condition

    You have two form opening tags, remove: <form id="registration-form"> And it should work. Bye!
  • Member Avatar for cereal
    cereal

    Replied To a Post in set column limit in csv file in php

    You could use `array_chunk()`, for example in **file.csv** you have: column1,column2,column3,column4,column5 column1,column2,column3,column4,column5 column1,column2,column3,column4,column5 And your script executes a loop: $file = file('./file.csv'); $result = array(); foreach($file as $csv) { $s …
  • Member Avatar for cereal
    cereal

    Gave Reputation to OsaMasw in Simple Image Slider HTML/CSS/JS

    I've checked your website and found what is missing, on your <head> part you import js library for slider with <link> I've change it to <script> and its works fine …
  • Member Avatar for cereal
    cereal

    Began Watching Paypal API ... too much info is bad info!

    Well, it has recently been bugging me that I have 8 years of working with PHP under my belt and not once have I tried to implement a custom solution …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Simple Image Slider HTML/CSS/JS

    In addition: you have two `<body>` tags. And if you add `event.preventDefault()` to your links, the page will not move to the top each time you click: $('a.control_prev').click(function () { …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Issue querying database

    The problem starts with the quotes, you're writing: $q = "'SELECT * FROM mytable'"; If you read carefully you will see double and single quotes surrounding the entire query, use …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Join

    You must use `$query` inside the function as explained in the documentation: * http://laravel.com/docs/queries#advanced-wheres Also set the `debug` to TRUE in your app/config/app.php file, to see the errors. And check …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Join

    Try this: $name = Entitydetail::where(function($query) use($fname, $lname, $userID) { $query->where('First_Name','LIKE','%'.$fname.'%') ->where('Last_Name','LIKE','%'.$lname.'%'); }) ->where('Entity_Id','!=', $userID) ->get(array('Entity_Id')) ->toArray(); dd("<pre>".print_r(DB::getQueryLog(),true)."</pre>"); By using `DB::getQueryLog()` you can see the query created by Laravel. The above …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Simple Image Slider HTML/CSS/JS

    Hi, it seems the problem is given the `<a>` tag on line `7`: <li> <a href="http://this-node.net/"> <img src="http://this-node.net/This-NodeLogo.ico"> </li> It is not closed, fix it and it should work. Here's …
  • Member Avatar for cereal
    cereal

    Replied To a Post in problem with table and leader dots

    On **september 8** the dots are in the first row, only apparently are in the last, because you're using `<br />` on the first child to add new lines, and …
  • Member Avatar for cereal
    cereal

    Began Watching Master-master Synchronising issue in mysql server

    I have 2 servers.Both are masters.One is local another is live.local generates even primary keys and live generates odd primary keys.But i want these primary keys in sequential manner (like …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Mysql(db design) - storing invoices that starts from 1 each financial year

    A little update to use transactions and InnoDB tables. We could create a table without an `auto_increment` column and the use transactions to get the max invoice number, for example: …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Mysql(db design) - storing invoices that starts from 1 each financial year

    Hi, I'm not sure this will work, because in this case the `auto_increment` column needs to be in the first position of the primary key, example with the auto increment …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Fpdf in PHP

    In practice you're checking for [widows](http://en.wikipedia.org/wiki/Widows_and_orphans): if at the end you have only five (or less) rows then you add them to the previous page, if you have more, then …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Fpdf in PHP

    > I need to generate six tables one by one but i am not able to generate with proper alignment its running out of page Hi, can you provide some …
  • Member Avatar for cereal
    cereal

    Gave Reputation to veedeoo in PHP/MYSQL remove row by id

    @Cereal I don't understand why you get a down vote for it though. It must be a C++ pride or something. I will give you an up vote to reflect …
  • Member Avatar for cereal
    cereal

    Replied To a Post in PHP - Wrong calculation

    Hi, this happens in Javascript and PHP when using float numbers, to avoid this problem you can use the **BC Math** library: echo bcdiv(bcmul(47.60, 554.82), 100, 2); Which returns `264.09`, …
  • Member Avatar for cereal
    cereal

    Replied To a Post in PHP/MYSQL remove row by id

    To the downvoter, please explain me why. Reading this: > As you can see the condition !$results, to me it is saying if the record does not exist then kill …
  • Member Avatar for cereal
    cereal

    Replied To a Post in set restriction on upload in php is not working.

    To convert try the previously suggested library, but I did few tests and I think it needs some fixes to get it to work. If you can access a terminal, …
  • Member Avatar for cereal
    cereal

    Replied To a Post in set restriction on upload in php is not working.

    After the first `IF` statement. Try this, is a rewrite of your above code: <?php $allowedExts = array("txt", "doc", "rtf"); $extension = pathinfo($_FILES['datafile']['name'], PATHINFO_EXTENSION); $File = ''; $data = ''; …
  • Member Avatar for cereal
    cereal

    Replied To a Post in PHP/MYSQL remove row by id

    Hi, dont' use `+` to concatenate strings like in javascript, use dots: die ("Cannot delete data from the database! " . mysql_error());
  • Member Avatar for cereal
    cereal

    Replied To a Post in set restriction on upload in php is not working.

    Those are control words, used as the HTML tags to give formatting to the document. If you want to convert the above to plain-text then try this library: - https://github.com/joshribakoff/rtf …
  • Member Avatar for cereal
    cereal

    Gave Reputation to iamthwee in Proud to announce...

    Hi guys, It gives me great pleasure to announce that I will be collaborating with fellow Daniwebber Veedeo in creating a fully baked, no nonsense CMS in Codeigniter. I will …
  • Member Avatar for cereal
    cereal

    Replied To a Post in form

    **@AndrisP** By the way, do not use `$_SERVER['HTTP_HOST']` because it can be set by the client header request, it's not a value set by the server, so it can be …
  • Member Avatar for cereal
    cereal

    Replied To a Post in timer storage

    Hi, if you're referring to the execution time of a PHP script, then change the value of `max_execution_time`: * http://php.net/manual/en/info.configuration.php#ini.max-execution-time The value can be modified at PHP level through the …
  • Member Avatar for cereal
    cereal

    Began Watching Missing Rows?

    Hello, I'm having a problem with my MySQL InnoDB table, only one of five. Every now and then a row or two will go missing completely with no trace of …
  • Member Avatar for cereal
    cereal

    Replied To a Post in How to use light open ID on Laravel 4 framework

    Ok, first of all a **resource controller** is not meant to define a specific method, but a set of actions that will work using RESTful verbs, this means than in …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Saving external image URL's instead of actual uplaod

    You can try the **imgur** API which, for non-commercial websites, is free up to 1.250 uploads per day or 12.500 requests per day: * https://api.imgur.com/ * https://api.imgur.com/#limits * http://api.imgur.com/endpoints/image * …
  • Member Avatar for cereal
    cereal

    Replied To a Post in how to get and echo input file name?

    Hi, check the `name` index: $_FILES['datafile']['name'] Below you can read the full array structure returned by `$_FILES`: * http://php.net/manual/en/features.file-upload.post-method.php
  • Member Avatar for cereal
    cereal

    Replied To a Post in How to use light open ID on Laravel 4 framework

    Hi, you can include it via composer, in your shell write: composer require lightopenid/lightopenid:dev-master Or edit **composer.json** and to `require` add: "lightopenid/lightopenid": "dev-master" And perform `composer update` from the terminal. …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Saving external image URL's instead of actual uplaod

    If you simply paste the url into the html output, then it will be the client (i.e. the browser of the user) to execute the request to the remote server, …
  • Member Avatar for cereal
    cereal

    Began Watching Looking to have a Signup with 2 image uploads stored to database

    Hi there, I have a website that i need to have a user submit some information and upload 2 files. And add the information to the database. what is the …
  • Member Avatar for cereal
    cereal

    Began Watching Searching using optional parameters

    I am currently working on an online website which houses a database inside that has 50-75 fields. I have what I believe may be a somewhat rudimentary question. Assuming we …
  • Member Avatar for cereal
    cereal

    Replied To a Post in HTML page within div

    By the way, use another website for the check: Google doesn't allow to be embedded into external frames and if you load the javascript console, you'll see the reason: Refused …
  • Member Avatar for cereal
    cereal

    Replied To a Post in how to get link href from alternate?

    Hello, first, are you sure your script can access the link? Because from the browser, it displays fine, but from script it returns error 503, that's due to a restriction. …
  • Member Avatar for cereal
    cereal

    Began Watching e.currentTarget explained

    hi guys, I am doing some tests on e.currentTarget vs $(this) to get things clear in my head. It is said that the two are equivalent, so I created a …
  • Member Avatar for cereal
    cereal

    Stopped Watching php running mysql query inside a query

    Hello, I have been breaking my head here and I can't figure out what I am doing wrong, I am trying the get the result of the first query into …
  • Member Avatar for cereal
    cereal

    Began Watching php running mysql query inside a query

    Hello, I have been breaking my head here and I can't figure out what I am doing wrong, I am trying the get the result of the first query into …
  • Member Avatar for cereal
    cereal

    Replied To a Post in import csv pdo msql

    If you're sure the first line is always an header then you can skip it: $i = 0; while() { # skip condition if($i == 0) continue; # other code …
  • Member Avatar for cereal
    cereal

    Replied To a Post in Uploading large file

    Change `post_max_size`, default is 8MB and by conseguence modify also `memory_limit`, it must be higher than `post_max_size`: * http://php.net/manual/en/ini.core.php#ini.post-max-size
  • Member Avatar for cereal
    cereal

    Replied To a Post in file upload script for music files

    The remote server needs to be reloaded otherwise it will not read the new settings in the php.ini file. Otherwise you can use `ini_set()`: <?php ini_set('upload_max_filesize', '20M'); ini_set('memory_limit', '128MB'); ini_set('max_execution_time', …
  • Member Avatar for cereal
    cereal

    Replied To a Post in file upload script for music files

    *Sounds* like you've reached the size limit. Check the contents of `$_FILES` array by placing this at the top of your upload script: die(print_r($_FILES)); Then check the value of the …
  • Member Avatar for cereal
    cereal

    Replied To a Post in header problem

    It generally happens when you output something before the `header()` function, for example: <?php echo 'hey!'; header('Location: /'); You should write your script to avoid these situations or, if you …
  • Member Avatar for cereal
    cereal

    Replied To a Post in import csv pdo msql

    No `PDO::PARAM_STR` for example: $import->bindParam(2, $data[0], PDO::PARAM_STR); is a constant that will check only if the input is a string, instead of an integer, null or a boolean, but it …
  • Member Avatar for cereal
    cereal

    Gave Reputation to timetraveller1992 in How to echo html code in php echo

    A better idea would be to use the HEREDOC method as its much neater <?php $url = trim($_POST['url']); $title = trim($_POST["title"]); echo <<< THEHTML <a href="http://digg.com/submit?phase=2&url=$url&title=$title" target="_blank"><img src="http://www.virtualdolphintherapy.com/images/digg.png" alt="Digg" width="64" …
  • Member Avatar for cereal
    cereal

    Replied To a Post in import csv pdo msql

    Yes, that's the correct and safe method to avoid SQL injections, but you always need to sanitize data because some javascript could be submitted: ... aaa4,bbb4,,ddd4,eee4 aaa5,<script>alert('hello');</script>,ccc5,ddd5,eee5 aaa6,bbb6,ccc6,ddd6,eee6 ... and …
  • Member Avatar for cereal
    cereal

    Gave Reputation to wikit in Two Seperate Search Results, Same Table/Page

    I'm very sorry I'm going to give up on this. It's way beyond me and I cant seem to wrap my head around it. Thankyou very much for your time …

The End.