cereal 1,524 Nearly a Senior Poster Featured Poster

The loop attribute works fine for me with this test:

<marquee behavior="scroll" loop="2" scrollamount="4" direction="left" width="100px" height="170px">
    <span>abc</span>
    <span>def</span>
    <span>ghi</span>
</marquee>

Live example: http://jsfiddle.net/8uqatjed/

But consider that the marquee tag should NOT be used, as it is obsolete and not anymore supported by most recent browsers releases:

So, if I've understood good your request, this could be the reason it's not working well for you.

cereal 1,524 Nearly a Senior Poster Featured Poster

Do you need that row in the following loop? If not then do:

$uid = mysqli_fetch_row($query, MYSQLI_ASSOC);
echo $uid[0]['a_uid'];

while($row = mysqli_fetch_assoc($query))
    # and so on

The loop will start from the second row in the result set. If you need that row in the loop then do:

$results = mysqli_fetch_all($query, MYSQLI_ASSOC);
$uid = $results[0]['a_uid'];

foreach($results as $row)
    # and so on

Another approach by using mysqli_data_seek():

# get first row
mysqli_data_seek($query, 0);
$uid = mysqli_fetch_row($query, MYSQLI_ASSOC);
echo $uid[0]['a_uid'];

# reset internal pointer
mysqli_data_seek($query, 0);

while($row = mysqli_fetch_assoc($query))
    # and so on

Besides, don't mix procedural with object, it won't work.

cereal 1,524 Nearly a Senior Poster Featured Poster

Use var_dump($val); instead of echo $val; to see what is returned. If the form ends like this (with a </form>) and there aren't other input fields, then it should work fine.

Also you could do echo "<pre>". print_r($_POST, true) . "</pre>"; to see what is sent to the $_POST array.

cereal 1,524 Nearly a Senior Poster Featured Poster

You have to set quotes around the value you want to search, otherwise COURT will be interpreted as a column name. So:

$sql = "SELECT full_name, tdoc_number, race, facility FROM inmate_board WHERE type = 'COURT'";

By using exceptions and the try/catch block, you would have seen the error:

Error Code: 42S22
Error Message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'COURT' in 'where clause'
cereal 1,524 Nearly a Senior Poster Featured Poster

Look at the array through var_dump(), it may add some information about that index.

cereal 1,524 Nearly a Senior Poster Featured Poster

The number sign # acts like a comment in MySQL, in your case it will affect the query by returning all the rows instead of selecting by id. But this should not return the Invalid argument supplied for foreach() error, it seems that your query returned boolean FALSE.

To understand what is going on, use a try/catch block and exceptions. For example:

$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

try {
    $stmt = $connection->prepare("SELECT full_name FROM customers where id = ?");
    $stmt->execute(array($_POST['id']));
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
}
catch(Exception $e)
{
    print 'Error Code: ' . $e->getCode() . PHP_EOL;
    print 'Error Message: ' . $e->getMessage() . PHP_EOL;
    die();
}

print $row['full_name'];

Note: using die() and printing error messages directly in page is good in development stage, while in production you should append all error codes and messages to the error log file and return a simple message, without details.

Documentation:

cereal 1,524 Nearly a Senior Poster Featured Poster

Sure is not $connection->query($sql) with -> instead of -? It seems you're calling a method, or an anonymous function, I think the former.

In the latter case, then in PHP you cannot use the dash in the variable name, unless you use brakets, for example:

${'connection-query'} = function() { return 'hello'; };
print ${'connection-query'}();

Or once I break out with ?> is that it, all variable can not be picked back up again futher down in the page?

What is declared in the top of the file is accessible in all the rest of the file, unless you unset the variable or rewrite it with something else.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

the set_rules() method requires three arguments:

  • field name
  • label
  • rules

See documentation at:

So your rules would look like:

$this->form_validation->set_rules('email', 'email', 'required|valid_email');
$this->form_validation->set_rules('password', 'password','required');
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, from what I've understood you have only to set the path of the libraries, follow the instructions in this tutorial and it should work fine:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, use prepared statements, start from here:

Look at the first example in the first link, I'm not converting the code directly for you, because it's more important that you understand how it works and how the methods/functions are used.

cereal 1,524 Nearly a Senior Poster Featured Poster

what's that 'as dummy_3 ' ??

It's '' as dummy_3 i.e. empty space defined with an alias, it will return an empty column, for example:

select '' as dummy_3;
+---------+
| dummy_3 |
+---------+
|         |
+---------+
1 row in set (0.00 sec)

It can be used as workaround when quering tables with column mismatch.

diafol commented: Nice explanation +15
cereal 1,524 Nearly a Senior Poster Featured Poster

It happens because of:

//If form is of GET type
$x = filter_input(INPUT_GET, 'howmanytimes', FILTER_SANITIZE_NUMBER_INT);
//if form is of POST type
$x = filter_input(INPUT_POST, 'howmanytimes', FILTER_SANITIZE_NUMBER_INT);

If using a GET request, i.e.: script.php?howmanytimes=2, then $x will be overwritten by the INPUT_POST check, by using a POST you won't notice the error. To avoid this use only one request method or use conditional statements:

<?php

$y = 1;

if($_SERVER['REQUEST_METHOD'] == 'GET')
    $x = filter_input(INPUT_GET, 'howmanytimes', FILTER_SANITIZE_NUMBER_INT);

elseif($_SERVER['REQUEST_METHOD'] == 'POST')
    $x = filter_input(INPUT_POST, 'howmanytimes', FILTER_SANITIZE_NUMBER_INT);

else
    $x = FALSE;

function f($x, $y)
{
    if(in_array($x, array(null, false)) || in_array($y, array(null, false)))
        return FALSE;

    return $x + $y;
}

print f($x, $y);
cereal 1,524 Nearly a Senior Poster Featured Poster

Hmm, it works fine for me. What you get? Could be the array, if using PHP version prior to 5.4 then replace [null, false] with array(null, false).

cereal 1,524 Nearly a Senior Poster Featured Poster

And how would you know which result sets belongs to what? If you're expecting a row for each table, then you could add empty columns:

select id, name, lastname from users where id = 1
union all
select user_id, email, '' as dummy_3 from addresses where user_id = 1;

But in this case the join solution is better.

shany0786 commented: what's that 'as dummy_3 ' ?? +0
cereal 1,524 Nearly a Senior Poster Featured Poster

About the function issue: the form will send strings, so filter_input() will return strings or:

  • FALSE when condition fails
  • NULL when variable name is not set, i.e. when submitting a form with wrong/missing field name

so the is_int() check will always return boolean FALSE. You can convert the input through intval(), or change the conditional rules in the function to verify that the argument is not null or false. An example:

<?php

function f($x, $y)
{
    if(in_array($x, [null, false]) || in_array($y, [null, false]))
        return FALSE;

    return $x + $y;
}

print f(FALSE, "6");
print f("5", "6");
cereal 1,524 Nearly a Senior Poster Featured Poster

Ops! I'm sorry, I didn't noticed it was a challenge... o_o'
Now that I see that link I understand... I solved this some time ago... :D

I can say that defining the type helps.

cereal 1,524 Nearly a Senior Poster Featured Poster

Something like this will fit?

<?php

    $tests = file("php://stdin", FILE_IGNORE_NEW_LINES);

    foreach($tests as $test)
    {
        for($i = 0; $i <= $test; $i++)
        {
            $size   = 9283412;
            $isEven = (($test % 2) != 0 ? true : false);

            if($test == 0)
            {
                $size = 1;
                break;
            }

            elseif($isEven)
                $size *= 2;

            else
                $size += 1;
        }

        print $size . PHP_EOL;
    }

Giving an input file:

php script.php < data.txt

With a number each line:

1
2
3
0
4
17

Returns:

18566824
9283413
18566824
1
9283413
18566824

Is this you're trying to accomplish?

Besides, you can get the same results by avoiding the inner loop:

foreach($tests as $test)
{
    $size   = 9283412;
    $isEven = (($test % 2) != 0 ? true : false);

    if($test == 0)
        $size = 1;

    elseif($isEven)
        $size *= 2;

    else
        $size += 1;

    print $size . PHP_EOL;
}

Because $test ($_tmp in your script), it never changes, for example: if even it will be even for all his loops.

Aeonix commented: Solution. +4
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

it happens because of the variable scope, $conn is defined outside the function, so or you pass it as parameter, or you set it as global, or you use an anonymous function. Example:

$getUsers = function() use($conn) {
    $getAllUsers = mysqli_query($conn,"SELECT * FROM login");

    if($getAllUsers === FALSE)
        return FALSE;

    return mysqli_fetch_all($getAllUsers);
};

print_r($getUsers());
cereal 1,524 Nearly a Senior Poster Featured Poster

Good, with fputcsv() you can do:

$list = $sql->fetchAll(PDO::FETCH_ASSOC);
$f = fopen('file.txt', 'w');

foreach($list as $line)
    fputcsv($f, $line);

fclose($f);

You need fetchAll() because you need an array, fetch() instead will return a single row of the result set. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,
it happens because fwrite() is outside the loop and will write the last vallue assigned at $line. Use fputcsv():

Look at the first example, it does what you need.

cereal 1,524 Nearly a Senior Poster Featured Poster

Oh, a backdoor! :D

I'm afraid it's not legal. If the client signed an agreement then, in cases you don't get payment, it's better to talk to a lawyer.

If you still want help with this, wait for other suggestions, I'm out.

cereal 1,524 Nearly a Senior Poster Featured Poster

So, all you want is to prevent hotlinks? Why don't you use .htaccess? It works without involving Javascript: if the request referer is your domain, then the server will give access to the protected files, otherwise it will deny.

You can try this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|css|js)$ - [NC,F,L]

Where the last rewrite rule defines the extensions of the file types you want to protect. By searching you can find many .htaccess rule generators, the above was created by:

But there are other solutions, always with .htaccess file, read here (bit old but always good start):

Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

it happens because both tables will return the same column name tableA_id, since you're fetching as assoc, it will create an array in which the first index will be rewritten by the second column value. You see how it works by playing this:

<?php

    $stmt = $conn->prepare("select * from tableA left outer join tableB on tableA.tableA_id = tableB.tableA_id where tableB.tableA_id is null");
    $stmt->execute();
    $result = $stmt->fetchAll();

    print_r($result);

It will return both numeric and assoc index keys, so tableA_id index key will be empty, the numeric [0] and [4], instead, will show the current values i.e. 2 and null. Here's an example:

Array
(
    [0] => Array
        (
            [tableA_id] => 
            [0] => 2
            [title] => pneumonia
            [1] => pneumonia
            [month] => jan
            [2] => jan
            [tableB_id] => 
            [3] => 
            [4] => 
            [correspondence_ref] => 
            [5] => 
            [date_received] => 
            [6] => 
            [date_dispatched] => 
            [7] => 
        )

You see how tableA_id index is appearing only once? If you define the columns you want to return and use a column alias, then you can solve this issue.

So instead of select * do:

select tableA.tableA_id as tableAID, tableA.month, tableA.month, tableB.*

Note that if you were going to define a different WHERE condition (IS NOT NULL instead of IS NULL), you would not notice this error, as also the other columns would return populated. Check the examples here:

cereal 1,524 Nearly a Senior Poster Featured Poster

Cache: probably the new thread was appended to the index cache and was not updated after user's edit.

cereal 1,524 Nearly a Senior Poster Featured Poster

MySQL needs single quotes:

P. that should not make difference:

or I'm missing something? :)

@blueguy777

if you using mysql_* then try to add mysql_error() after the query to catch the error, for example:

$q = mysql_query($m_query) or die(mysql_error());

Show also what would be the end query.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, you are enclosing the query into single quotes:

$a = 'apples';
$b = 'oranges';

So in order to append another variable you have to use the dot operator:

$c = 'list '. $b . ' and ' .$a;

Basically is this. You have done that when defining the table name ($job_id), so the query would turn to:

$m_query = 'Insert into '.$job_id.'(`mobile`,`routeID`,`status`) values ('.$mobile.','.$routeID.',"Sent")';

Note:

  • the space after the into keyword
  • also 'Sent' becomes "Sent"

But it will not work, unless $mobile and $routeID are integers, if those are strings, then you have to add quotes (double quotes in this case):

$m_query = 'Insert into '.$job_id.'(`mobile`,`routeID`,`status`) values ("'.$mobile.'","'.$routeID."',"Sent")';

This can be refactored with double quotes:

$m_query = "insert into {$job_id} (`mobile`, `routeID`, `status`) values ('{$mobile}', '{$routeID}', 'Sent')";

In any case, you really don't want to create a query like this, you want to use prepared statements, as explained here:

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, that's clear. But, excuse me, I'm a bit lost. At the moment I can only suggest you to try the query from a MySQL client and see if you get results, without involving PHP and sessions. Then you could share tables, data and queries through a service like SQLfiddle, to help us (or at least me :D) to understand better the issue. Here's an example:

Anyone wants to help?

cereal 1,524 Nearly a Senior Poster Featured Poster

Sure? So friends table is not like this:

userid | user_1 | user_2 | status
---------------------------------
  1    | user 1 | user 2 |   1   
  2    | user 1 | user 3 |   0   

but:

userid | user_1  | user_2  | status
-----------------------------------
  1    |    1    |    2    |   1   
  2    |    1    |    3    |   0   

Correct? Because, if the values of user_1 and user_2 are strings, when you do:

$user["user_1"] == $_SESSION["uid"]

you're comparing integers to strings: 'user 1' == 1 and it will not work. Same for messages table. Sorry if I insist on this point, but it's unclear to me.

cereal 1,524 Nearly a Senior Poster Featured Poster

Can you show users table? I don't understand which values will assume uid, to me it should be an integer, but looking at your code it seems it would be a string, like user 1, otherwise those conditional statements are wrong:

if($user["user_1"] == $_SESSION["uid"])
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, few questions:

  • the data is correctly inserted in the database?
  • if, in view, you do var_dump($datame); what you get?
  • have you tried to remove the error control operators @ in your getdata() method? In this stage it's more important to get debug information rather than hiding.
cereal 1,524 Nearly a Senior Poster Featured Poster

If you're using the resize() method of the image library, it happens because of:

Image_lib class already loaded. Second attempt ignored.

You can see that from the log of CodeIgniter. I don't know if they added something to avoid this problem, I just use this solution:

see the last comment, in practice when you load the library you assign a dynamic name and use that to load the new instance:

private function _resize($source, $filename, $num = 1)
{
    $config['image_library']  = 'gd2';
    $config['source_image']   = $source;
    $config['new_image']      = FCPATH . 'thumbs/' . $filename;
    $config['create_thumb']   = TRUE;
    $config['maintain_ratio'] = TRUE;
    $config['width']          = 75;
    $config['height']         = 50;

    $instance = 'image_lib_'.$num;

    $this->load->library('image_lib', $config, $instance);

    return $this->$instance->resize();
}

Then, you can insert this _resize() method in the for loop:

$this->_resize($upload_data['full_path'], $upload_data['file_name'], $i);

And it should work fine.

Just a note: imagine what can happen if N users start to upload images at the same time, they could kill the server, since this is an intensive task for the CPU, if you can, you should consider to go asynchronous and let the server start just few resize processes (no more than a resize process per core). It can be done with tools like beanstalkd or gearman:

This requires access to a ssh session and the privilege to install apps. See example here:

shany0786 commented: thnks for reply plz see below it's not working yet +0
cereal 1,524 Nearly a Senior Poster Featured Poster

So you want to change the DocumentRoot? In that case it can be done only in these contexts:

  • server config
  • virtual host

It cannot be done at .htaccess level. More information here:

cereal 1,524 Nearly a Senior Poster Featured Poster

Same here on Google Chrome:

Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, you could use json or base64, but what happens if you want to search throught collected data? It would be unusable without extra processing. Why don't you normalize the array? Look at section 8 of this tutorial:

cereal 1,524 Nearly a Senior Poster Featured Poster

So,

in the controller you're trying to rewrite the $_FILES array to condition the execution of line 27:

if(!$this->upload->do_upload('file'))

Ok, then replace lines 4, 5 and 6 with:

$files = $_FILES;

foreach($files as $key => $value)
{
    for($s = 0; $s < count($files['file']['size']); $s++)
    {

The $files variable will hold a copy of the original $_FILES array. Otherwise the loop will stop because you're overwriting the $_FILES array and it cannot continue. A test method:

public function upload()
{
    $files = $_FILES;

    print '<h3>Original $_FILES array:</h3>';
    print "<pre>" . print_r($_FILES, true) . "</pre>";

    foreach($files as $key => $value)
    {
        for($s = 0; $s < count($files['file']['size']); $s++)
        {
            $_FILES['file']['name']     = $value['name'][$s];
            $_FILES['file']['type']     = $value['type'][$s];
            $_FILES['file']['tmp_name'] = $value['tmp_name'][$s];
            $_FILES['file']['error']    = $value['error'][$s];
            $_FILES['file']['size']     = $value['size'][$s]; 

            $config['upload_path']   = FCPATH . 'uploads/';
            $config['allowed_types'] = 'gif|jpg|png';

            $this->load->library('upload', $config);
            $this->upload->do_upload('file');

            print "<hr>";

            print '<h3>Rewritten $_FILES array number #'.$s.':</h3>';
            print "<pre>" . print_r($_FILES, true) . "</pre>";

            print "<h3>Upload data:</h3>";
            print "<pre>" . print_r($this->upload->data(), true) . "</pre>";

            print "<h3>Errors:</h3>";
            print "<pre>" . print_r($this->upload->display_errors(), true) . "</pre>";

        }
    }
}
cereal 1,524 Nearly a Senior Poster Featured Poster

It would be helpful to know how you upload multiple images:

  1. are you using an array?

    <input type="file" name="image[]">
    
  2. or different names?

    <input type="file" name="image_1">
    <input type="file" name="image_2">
    <input type="file" name="image_3">
    <input type="file" name="image_4">
    <input type="file" name="image_5">
    

Because in first case you must loop the $_FILES array to get each image information, for more information follow these instructions:

Or simply print the contents of the $_FILES array to see the format of the received request.

cereal 1,524 Nearly a Senior Poster Featured Poster

As I wrote in previous post:

About the headers: if not defined, Node will set implicit headers, but you should always set a status [code|message] response:

https://nodejs.org/api/http.html#http_response_statuscode

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, does it work now?

Applying the end() method after you write the response body is mandatory. About the headers: if not defined, Node will set implicit headers, but you should always set a status [code|message] response:

By the way, you last attempt wasn't working for you because the send() method does not exists in the http module.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, in order to write a response you have to send an header and then call end():

res.writeHead(200, {'Content-Type': 'text/html'});
res.write('2working');
res.end();

Also, probably mistype, on console log you wrote that it listens on port 8080, but it's executing on 8889.

Docs:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, read this guide:

In particular follow the instructions for Ubuntu 13.10+, you have to include the configuration file into the server, the guide refers to Apache.

Anyway, I prefer to install it directly from source, to get the latest version. Just uncrompress to a directory in /var/www/, assign a local domain (for example phpmyadmin.sql) and follow the setup guide from PHPMyAdmin.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi!

Bit border line, but I suggest you to learn also how to build raw HTTP requests and parse responses to understand: how to deal with RESTful APIs, how to build them, how mails are sent, how (chunked) uploads are performed and in general how socket programming and web servers work.

These are tasks that can be performed with a telnet client. In PHP there are many functions and libraries that simplify it, but by understanding what's going it will help you a lot.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

on terminal write hp- then hit tab, you should see:

hp-align               hp-info                hp-query
hp-check               hp-levels              hp-scan
hp-clean               hp-logcapture          hp-setup
hp-colorcal            hp-makeuri             hp-testpage
hp-config_usb_printer  hp-pkservice           hp-timedate
hp-doctor              hp-plugin              hp-unload
hp-firmware            hp-plugin-ubuntu       
hp-hpdio               hp-probe        

Which are the utils installed by the hplip package, among them there is also the command hp-scan but you need to setup the printer, so try hp-info to see if it's detected... you can also install the GUI, package name is hplip-gui.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you can use IMAP to access the ticket@domainname.tld account, then update a database table in which you save the ticket number: http://php.net/manual/en/book.imap.php

If you also need to parse the message use Mailparse: http://www.php.net/manual/en/book.mailparse.php

Note: you have to compile PHP with IMAP support, or if in Debian & co. install the php5-imap package. Mailparse instead is a PECL package.

cereal 1,524 Nearly a Senior Poster Featured Poster

I'm not sure I've understood the problem and the request.

it won't work when i have time more than 2 hours

So if you do:

$next_program_times = $program_times + 3;

It will give problems? Or you refer to multiple program_times?

when i try this:

$next_program_times = '<span id="time', $show_id + 1, $program_times,;

it don't work

I see few problems here:

  1. if you end the string with a comma you will generate a parsing error for unexpected ;
  2. you can use commas to separate variables and strings when outputting the variables and strings but not to assign them to a variable, so change the above to:

    $next_program_times = '<span id="time' . $show_id + 1 . $program_times;
    

    But if you add an integer to the string you loose the <span tag and end with something that looks like 110:00 AM. So something more correct is:

    $abc = $show_id + 1;
    $next_program_times = '<span id="time' . $abc . $program_times;
    

    This will generate something like <span id="time11410:00 AM which is still wrong, as an id cannot contain a space character.

  3. I don't know how you set $show_id but I assume this is set outside the loop, so there are good chances that it will generate a group of same ids at least as in your original code that does not include the $program_times variable. An id attribute in HTML must be unique over the document, if you don't fix it you can encounter problems with javascript …

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, the issue is at line 12:

$next_program_times = $program_times + 1;

If $program_times has value of 3:00 PM which is a string and you add an integer, you get only 4, so PM does not exists anymore, nor the formatting. To keep the current format, instead, you have to use the DateInterval class, as done on line 9:

$next_program_times = (new Datetime($program_times))->add(new DateInterval('PT1H'))->format('g:i A');

Which will output 4:00 PM.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, Slim Framework supports composer so you can get a pagination library from packagist.org or you write it by your self.

cereal 1,524 Nearly a Senior Poster Featured Poster

Don't know your current code but, you're using procedural style, so the first argument for mysqli_query() is the connection link, which is missing from your last pasted code. It was set in the first line of your original script but not at line 42. I forgot to point that particular. Try to add that and it should work fine:

$query = mysqli_query($db, $select . $Order);
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

use DateTime and DateInterval, like this:

<?php

    $time = '05:00 PM';
    $dt = (new Datetime($time))->add(new DateInterval('PT5H'))->format('g:i A');

    echo $dt; # outputs 10:00 PM

For more information check the documentation.

Docs about DateTime:

Docs about DateInterval:

@jkon sorry, just saw your answer!

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, a part those exit; at lines 25 and 32 I don't see anything wrong, those will stop the execution of the script, in one of the cases it setting $Filter and $Order and then stopping, the query will not be executed.

Also, you wrote you have tested the query on PHPMyAdmin and that works, I'm in doubt if you have tested the one generated by the script or the intended query. Could you paste what was generated? In practice instead of:

$query = mysqli_query($select . $Order);

do:

$query = $select . $Order;
echo $query;

And return it or simply test it. You could also add error checking to see if the database returns an error code.

cereal 1,524 Nearly a Senior Poster Featured Poster

At line 1 instead of:

$select =mysqli_query($db,"SELECT created, views_count, message, category_id from table AS M ");

write:

$select = "SELECT created, views_count, message, category_id from table AS M ";

So at line 42 you can execute it correctly.