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

You should not include two html headers in the same page. Just include the table.
Is your main file a PHP file? What you get?

cereal 1,524 Nearly a Senior Poster Featured Poster

Do you session_start() also on /abc/demo.php?

cereal 1,524 Nearly a Senior Poster Featured Poster

Time stamps in mysql are saved in unix time, which is of seconds between the date you specify and 1970-01-01. In your query you can write:

SELECT fieldA, IF(strcmp(fieldB,'0000-00-00'),fieldB,'0') AS 'fieldB' FROM mytable;

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

I can think only to an encoding issue between browser (e.g. ISO-8859-1) and server (e.g. UTF8). A part from the table encoding. Have you tried doing that query from another browser? Or accessing to mysql through the shell?

cereal 1,524 Nearly a Senior Poster Featured Poster

I can't help you.

cereal 1,524 Nearly a Senior Poster Featured Poster

That scripts saves data to an sqlite db through Ruby, is not using PHP, so: what are you using?

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

This is related to CSS not PHP. Which DocType are you using? Are you using z-index somewhere? Are you closing the div in head.php?

Try to use display:block; position:relative; float:left; z-index:0; in both divs, at this point you can use margin to set a distance between them.

cereal 1,524 Nearly a Senior Poster Featured Poster

It seems this happens if the resource given sends an header with prefetch or next, just like you wrote:

- http://support.mozilla.com/en-US/kb/Firefox%20makes%20unrequested%20connections#w_link-prefetching
- https://developer.mozilla.org/En/Link_prefetching_FAQ

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

If you can make an array with unix timestamp as key and post numbers as value you can do this:

<?php

$a = array(
	'1322828101' => '500',
	'1322827133' => '450',
	'1322826151' => '360',
	'1322825391' => '200',
	'1322824530' => '180',
	'1322823000' => '100'
);

foreach($a as $key => $value)
{
	echo current($a) - next($a);
}

?>

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

It's not clear to me. PHP is noticing you that _e is not defined, my question are:

1. where is located _e() function? in which file?
2. how do you include it to your script?

This <?php _e('hello world') ?> by itself can't work.

cereal 1,524 Nearly a Senior Poster Featured Poster

With same CPU? In my opinion dedicated is better, because you don't have to share CPU and RAM with others.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, but lets try to simplify the problem, in your example code there are no form tags, so you can't send data to the server. In the code you wrote here the problem is not PHP (which is not included) but the HTML part. You need something like this:

<form method="post" action="page.php">
<input type="text" name="first_name" />
<input type="submit" name="button" value="send data" />
</form>

And basically in page.php you need:

<?php
echo $_POST['first_name'];
?>

So: you need to give name or id to input fields, and you need to enclose all your input fields between form tags.

cereal 1,524 Nearly a Senior Poster Featured Poster

This works for me:

<?php
function _e($w) # define function
{
	return 'hello ' .$w;
}

echo _e('world');
?>

Now: are you loading your _e() function? is this _e() a po function? Are you using php.ini extension directive to load it? bye

cereal 1,524 Nearly a Senior Poster Featured Poster

I don't understand. Which error you get? Can you post a simplified code example?

cereal 1,524 Nearly a Senior Poster Featured Poster

You are missing form tags:

<form action="do_upload.php" method="post" enctype="multipart/form-data">
# your input fields here
</form>

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

An alternative solution: use filectime(), each file saves 3 different dates: created, modified and access, with touch() or file_put_contents() you can change "modified" date without changing contents. Here is an example:

<?php
$a = glob('*.jpg', GLOB_NOSORT);
$b = array();
print_r($a); # all images
for($i = 0; $i < count($a); $i++)
{
    $time = filectime($a[$i]);
    $b[$time] = $a[$i];
}

$mx = max(array_keys($b));
$mn = min(array_keys($b));

if((time() - $mx) < 3) # at moment 3 seconds, 1800 = 30 minutes
{
    echo 'visible: ' . $b[$mx] . "\n";
}
else
{
    echo 'new: ' . $b[$mn];
    touch($b[$mn]); # update "inode change time"
}
echo "\n";
?>

In order to work you need to change the "modified" date to each image, you can run this script right before you start the above one:

<?php
$a = glob('*.jpg',GLOB_NOSORT); # remove second parameter to sort files
for($i = 0; $i < count($a); $i++)
{
     touch($a[$i]);
     sleep(2);
}
?>

After this, if you don't modify the images there will be always the same order. Every time the page is loaded the script will check for the latest updated "modified" date and if the difference between this value and the current time is higher than 30 minutes (3 seconds in my example) it will update the file with the oldest time, and so on, in loop.
bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Use floor() or ceil(), floor will output 12 no matter if it is 12,2 or 12,9, ceil is different, since 12,51 will output 13 instead of 12.

$filesize=floor($size/1000000);
cereal 1,524 Nearly a Senior Poster Featured Poster

Line 89, rewrite the query:

$sql = "INSERT
		INTO
		blog_users(
		blog_user_name,
		blog_user_password,
		blog_user_email,
		blog_user_access_level,
		blog_user_status)
		VALUES (
		'$blog_user_name',
		'$blog_user_password',
		'$blog_user_email',
		'1',
		'$verification_code');

And do the same on query of line 63, remove those curly brackets.
bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, if you want to try my solution just install Memcached (be aware: Memcache is another product) and Igbinary:

- http://memcached.org/
- https://github.com/phadej/igbinary

Then configure Memcached daemon and run those scripts. The first is needed only to create the files to be used in the second script. This second script it can be ran once a day just to make sure the keys are still in memory, and the third script is what you can use to find data.. anyway mine was just a test, good luck! :)

cereal 1,524 Nearly a Senior Poster Featured Poster

In a project I used CodeIgniter as main framework integrated with Zend to deal with their Gdata library and worked pretty well. I prefer CI. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Like Veedoo I'm not sure of the question but I started playing around with HanDeDict dictionary (1) and came up with a script to search "rapidly". I don't know if this can be helpful for you.

I'm using memcached to load data in memory and igbinary as serializer to save space. First of all I downloaded your same dictionary and in the first script I converted it to an array, and splitted all rows into files of 5000 words each, so at the end I get 30 files of 500kb each one or so.

Memcached has a limit of 1mb per each item, this is why I decided to split them. Together with this array I created another one of only keys, used to perform the searches, this array (splitted as the previous) is hashed: I used sha1() on each key (ie Chinese word).

In the second script I load all keys files in memory. The data files (dictionary arrays) are loaded on demand in the third script, but if you have enough memory you can load everything.. in my opinion is better to load on request, so you don't occupy to much memory.

Now: the first time a term is searched, the key arrays are queried from memory, until there's a match, when this happens, the script saves the result in memory, singularly, so the next time, the same word, will be outputted much faster than previous.

Here are the scripts:

<?php
$file = …
cereal 1,524 Nearly a Senior Poster Featured Poster

Are you using a CMS? Can you check the logs of your website? Which version of PHP are you using? Are you in a shared hosting or dedicated? What they did? Just defacement? Let us know, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

You're welcome :)

cereal 1,524 Nearly a Senior Poster Featured Poster

The simplest way, for me, is to use array_filter and preg_match, set null on the array you want to remove and then filter the array, at the end reindex, otherwise you get discontinuous keys:

<?php
$a = array(
	array('name' => 'MHK VL', 'PTID' => 'bab'),
	array('name' => 'nbn', 'PTID' => 'bbb'),
	array('name' => 'ncn', 'PTID' => 'bcb'),
	array('name' => 'MHK VL', 'PTID' => 'bab'),
	array('name' => 'MHKVL', 'PTID' => 'bbb'),
	array('name' => 'ncn', 'PTID' => 'bcb'),
);

$c = count($a);
for($i = 0; $i < $c; $i++)
{
    if(preg_match('/^MHK VL$/i',$a[$i]['name']))
    {
	$a[$i] = null;
    }
}

$filtered = array_filter($a);
#print_r($filtered); # uncomment to check discontinuous keys

$result = array();
foreach($filtered as $key => $value)
{
	$result[] = $value;
}

print_r($result); # reindexed array
?>

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

I'm sorry but I don't understand, maybe because English is not my main language, can you provide an example of what you would like to do?

cereal 1,524 Nearly a Senior Poster Featured Poster

Hm, with null/false/-1/'' as value you can display the array:

$a = array('a' => false, 'b' => '', 'c' => '1a');
print_r($a);

Just make sure to not run array_filter() against this array or those will be removed.

vedro-compota commented: +++++++++++ +3
cereal 1,524 Nearly a Senior Poster Featured Poster

Try:

<?php
echo date('Y-m-d- G:i:s'); # systme
date_default_timezone_set("GMT");
echo date('Y-m-d- G:i:s'); # GMT
?>
diafol commented: :) +14
cereal 1,524 Nearly a Senior Poster Featured Poster

Together with chrishea suggestions you can:
1. cache queries on mysql
2. run tables in memory engine (a copy of the original)
3. cache result to a file or better cache php
4. cache results to memory through memcached

For reference:
1. http://dev.mysql.com/doc/refman/5.1/en/query-cache.html
2. http://dev.mysql.com/doc/refman/5.5/en/memory-storage-engine.html
3. http://php.net/manual/en/book.apc.php
4. http://php.net/manual/en/book.memcached.php

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

So it seems, but I don't have any ideas. I'm sorry ;(

cereal 1,524 Nearly a Senior Poster Featured Poster

This should work:

<?php
# ...
# connection code
# ...

$q = mysql_query('select defect_code, total from grandTotal');
$a = array();
while($row = mysql_fetch_object($q))
{
    $a[$row->defect_code] = $row->total;
}

print_r($a); # display array
?>

bye :)

ooops ardav, I just saw your reply, sorry.. :D

cereal 1,524 Nearly a Senior Poster Featured Poster

According to adobe livedocs:

When you define variables within the URLVariables constructor or within the URLVariables.decode() method, you need to make sure that you URL-encode the ampersand character because it has a special meaning and acts as a delimiter. For example, when you pass an ampersand, you need to URL-encode the ampersand by changing it from & to %26 because the ampersand acts as a delimiter for parameters.

So if your link is something like this:

http://a_server/a directory/page.php&id=1

You have to change it to:

http://a_server/a%20directory/page.php%26id=1

You can easily use urlencode() to create those links: http://php.net/manual/en/function.urlencode.php
Hope is useful, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Try add the url to the URLRequest:

var myRequest:URLRequest = new URLRequest("http:/your_server/test.php");

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Well I use CodeIgniter :p
To me the must important thing is the knowledge of the framework you decide to use, so what I look for is a good community and clear documentation, if you have them you can do everything.
What are you looking for? There are many frameworks: CakePHP, Zend, Kohana (which is CodeIgniter on steroids..), Symfony, Yii... It really depends on you. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

@veedeoo print_r(mysql_fetch_array($result)); won't print all the result, but only the first available row, because mysql_fetch_array():

Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.

So if you don't want to use a while loop, but you still want to print the first and, for example, the fifth row, you can move the pointer using mysql_data_seek:

mysql_data_seek() moves the internal row pointer of the MySQL result associated with the specified result identifier to point to the specified row number. The next call to a MySQL fetch function, such as mysql_fetch_assoc(), would return that row.

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

You can see other entries by using mysql_data_seek(): http://www.php.net/manual/en/function.mysql-data-seek.php
When using while() with mysql_fetch_array() there will be a move of the internal row pointer for the query result, so it moves from one key to another, automatically:

<?php
$result = mysql_query("SELECT * FROM post_categories");
$row = mysql_fetch_array($result);
echo $row['Name'];
print_r($row);

mysql_data_seek($result, 1);
$row = mysql_fetch_array($result);
print_r($row);

mysql_data_seek($result, 2);
$row = mysql_fetch_array($result);
print_r($row);
?>

bye :)

note: using mysql_fetch_array() you will end up with an array with both numerical and field name keys, if you use mysql_fetch_assoc() you will get just the table field names.

Martin C++ commented: Thanks for good answer +1
cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, you can use file_get_contents(): http://php.net/manual/en/function.file-get-contents.php
Or you can use cURL if you need authentication. If remote data is XML than use SimpleXML. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Change line 12 with mysql_query($sql, $con) or die(mysql_error()); and see what it happens, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

cPanel is not a CMS (Content Management System), what you're looking for is something like joomla, drupal, mambo...

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, first of all you need to save the value and do a comparison when you go in the edit page:

<?php

$opt = 3;

?>

<select name="adtype" onchange="showHint(this.value);">
 <option>------Select ad type------</option>
 <option value="1" <?php echo ($opt == 1) ? 'selected="selected"': null; ?>> Ad-One photo will be displayed</option>
 <option value="2" <?php echo ($opt == 2) ? 'selected="selected"': null; ?>>Priority Ad-Only 3 photos will be displayed</option>
 <option value="3" <?php echo ($opt == 3) ? 'selected="selected"': null; ?>>Premium Ad-Upto 6 photos will be displayed</option>
</select>

Then you need to run a js function similar to the previous function while loading the page:

function ohey()
{
  str = <?php echo $opt; ?>;
  if (window.XMLHttpRequest)
  {
    xmlhttp=new XMLHttpRequest();
  }
  else
  {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }

  xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
  xmlhttp.open("GET","ads.php?q="+str,true);
  xmlhttp.send();
}

Finally change body tag to: <body onload="ohey()"> I've attached an example page, probably there's a cleaner way to do this, hope someone else will give you a better solution, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

We need your code, simplified if you can.

cereal 1,524 Nearly a Senior Poster Featured Poster

imo the best exercise is to try to solve problems here in the forum ;)

cereal 1,524 Nearly a Senior Poster Featured Poster

@davy_yg
with your code you have to write:

$_GET['mode'] == 'delete'

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

In your code the mode is set by the link, so it's $_GET but you should not use it to change data, you should use $_POST. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Add strtotime(): date('j-M-Y',strtotime($data['tgl_masuk'])) bye :)

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

It's related to objects, in PHP you can write something like this:

<?php
$obj = (object) array("a" => "hello", "b" => "world");
echo $obj->a . ' '. $obj->b;
echo "\n";
?>

Source: http://php.net/manual/en/language.types.object.php
bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

I never tried that but it's interesting how, in ez_sql_core.php, he writes cache to disk, he is using error_log(), but as stated in error_log() function page: the maximum length that you can pass as the $message is limited by log_errors_max_len, which is 1024 bytes by default in php.ini. So, if you want to use ezsql you can:

1. increase that limit
2. use igbinary_serialize() & igbinary_unserialize() which occupies less space when serializing a string and is also faster than the current php serialize()/unserialize()

igbinary: http://opensource.dynamoid.com/
error_log: http://php.net/manual/en/function.error-log.php

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

@gikonyo you could do the same: http://www.swreg.org/getting_started_guide.htm