cereal 1,524 Nearly a Senior Poster Featured Poster

Hmm. Apache is running, right?

cereal 1,524 Nearly a Senior Poster Featured Poster

Try to simplify the problem, create an empty file, without MySQL, write:

<?php
echo "<br>Tables were set up correctly.";
?>

And see what it happens. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

The problem is related to the double quotes, rewrite that line 19:

$img = $info['photo'];
echo '<img width="240" height="240" alt="Wonky Buildings"  src="images/'. $img .'>';

Or:

echo "<img width=\"240\" height=\"240\" alt=\"Wonky Buildings\" src=\"images/".$img ."\">";

Or:

echo "<img width='240' height='240' alt='Wonky Buildings' src='images/$img'>";

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

Change the path for the images, for example:

<img src="C:/wamp/www/site/images/milk.jpeg" width="175" height="175" /> # wrong
<img src="/images/milk.jpeg" width="175" height="175" /> # ok

Just as for the css file. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

In your case that will be localhost or your domain. So http://localhost/site.css

cereal 1,524 Nearly a Senior Poster Featured Poster

First problem is include.php file, you're going to include another header section to your main file. So if you look at the output source in your browser you will see two header sections.

This means: in your include.php write only:

<table border=1 cellspacing=0  align ="center" >
       <tr>
        <td><a href="home.php">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>home</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
        <td><a href="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>more information</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
        <td><a href="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>login</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
        <td><a href="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>feedback</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td>
       </tr>
     </table>

Then check if you are able to view the css file through your browser by typing http://your_server_link/site.css

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

Then post the code you're using. Not only this tag. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Use an absolute path:

<link rel="stylesheet" href="/site.css">
cereal 1,524 Nearly a Senior Poster Featured Poster

This is way I suggested...

My bad English! Among other mistakes I meant "why" not "way".. I'm sorry this is not my first language :D

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes I know, this mainly depends on how the browser determines the mime-type, for example Firefox use different methods to determine mime-types, on MacOS it uses type and creator code:

- https://developer.mozilla.org/en/How_Mozilla_determines_MIME_Types

This is way I suggested you to use finfo or exec/file, both use magic file which is used in *nix box to determine file mime-types:

- http://en.wikipedia.org/wiki/File_(command)

You may want to wait for someone else solution. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Great :)
then mark it as solved, this will help other users with your same problem, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

If you can, use file command through exec():

exec("file -b --mime-type $file");

Or finfo_file():

<?php
$file = 'test.pdf';
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$result = finfo_file($finfo, $file); # echo mime-type
finfo_close($finfo);
?>

finfo_file(): http://www.php.net/manual/en/function.finfo-file.php

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

When? Did you tried to run this example script?

<?php
include('whois.main.php');

$whois = new Whois();
$query = 'daniweb.com';
$result = $whois->Lookup($query,false);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

It works if the script example is in the same directory of the PHPWhois Class.

cereal 1,524 Nearly a Senior Poster Featured Poster

Check the README file, there you find instructions and examples:

- http://phpwhois.cvs.sourceforge.net/viewvc/phpwhois/phpwhois/README?revision=1.22&view=markup

bye.

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

yep. just leave the table block into include.php

cereal 1,524 Nearly a Senior Poster Featured Poster

Great :)
On the two headers, it seems to me that you have an html header on main page, and another one on include.php, that will output two headers.
Bye :)

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

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

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

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

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

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

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

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

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

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

Maybe I'm wrong but searching on web I came up with a thread discussing of that obfuscated js code, and it seems to match an injection attack, here's the link:

- http://www.reddit.com/r/javascript/comments/mk1u8/i_found_code_in_my_files_i_did_not_add_what_does/c31jt8k

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

No problem, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

This is old but it still can be useful:

in line 15 of header_view.php file add a slash to the url:

'/index.php/home/productsList/'+catId

in line 78 of home.php (the controller) there is a mistake, where did you get $this->params? Refer to the URI Class, you should solve:

$data['products'] = $this->m_products->getProducts($this->uri->segment(3));

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

It's late and I still think to let users figure how to match limits but, I was reading imagemagick docs and found this: -define jpeg:extent={size} You can use it like this:

convert -define jpeg:size=900x900 -define jpeg:extent=32kb -thumbnail 450x450 -quality 95 IMG_7070.jpg test_50_b.jpg

This command will rewrite the thumbnail changing quality until it matches the right sizes. It will slow down respect to normal converting but it's not too heavy. The first define it's used to increase speed, you can set it at the same size of the thumbnail -define jpeg:size=450x450 , but I prefer an higher value, it will give a better quality.

Bye :)

Source: http://www.imagemagick.org/Usage/formats/#jpg_write

cereal 1,524 Nearly a Senior Poster Featured Poster

change it with this:

echo '<img src="'.$data['gambar'].'"><br>';

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

This is called Method Chaining and yes, you can use it whenever you want if the class is built in the right way. Check this comment on PHP Manual: http://www.php.net/manual/en/language.operators.php#87904
bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

You can create that file and start mysql like this:

mysql --defaults-extra-file=/etc/mysql/my.cnf

Here you can find more information about Option Files: http://dev.mysql.com/doc/refman/5.5/en/option-files.html
bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Sure, in this line you need to set the value:

<input type="text" name="Conveyor Number" />

that becomes something like:

<input type="text" name="Conveyor Number" value="<?php echo $id; ?>" />

Right now, update_record.php doesn't send out this value. And the form in your layout.php page doesn't have an ID field value, you set a different name for each button and send a value like this: CMD_LRC1140
this:

<input name="CMD_LRC1138" type="button" id="CMD_LRC1138" value="CMD_LRC1138" onclick="location.href='update_record.php'"/>

should be:

<input name="id" type="submit" id="CMD_LRC1138" value="CMD_LRC1138" />

So try to change your layout.php form to this:

<form id="form2" name="form2" method="post" action="update_record.php">
    <p><label><input name="id" type="submit" id="CMD_LRC1140" value="CMD_LRC1140" /></label></p>
    <p><label><input name="id" type="submit" id="CMD_LRC1138" value="CMD_LRC1138" /></label></p>
    <p><label><input name="id" type="submit" id="CMD_LRC1115" value="CMD_LRC1115" /></label></p>
</form>

In update_record.php you can write:

$id = $_POST['id'];

# the query will become:
$query_Recordset1 = "SELECT * FROM conveyor_number WHERE conveyor_number.`Conveyor Number` = $id";

Hope is useful. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

In order to access from the virtual server you need to change a setting on the database config file. Search for my.cnf and change this line:

bind-address = 127.0.0.1

Set the ethernet IP of the host machine. By default MySQL listens only on localhost. When you done restart MySQL server and it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster

It's really hard to read this code. Next time use bbcode tags.

On update_record.php this query is not complete:

$query_Recordset1 = "SELECT * FROM conveyor_number WHERE conveyor_number.`Conveyor Number`";

It should be:

$query_Recordset1 = "SELECT * FROM conveyor_number WHERE conveyor_number.`Conveyor Number` = `id_to_search`";

Try to change this.

Now. Layout page is just used to open the edit form on update_record? Am I wrong? Why don't you just use links? Something like:

<a href="update_record.php?id=1">update record</a>

On the update page you just need to run a command like this:

if(ctype_digit($_GET['id']))
{
   $id = $_GET['id'];
   $query_Recordset1 = "SELECT * FROM conveyor_number WHERE conveyor_number.`Conveyor Number` = $id";
}
cereal 1,524 Nearly a Senior Poster Featured Poster

You should post your update query and the form used. Without code we can't tell you where mistakes are.

cereal 1,524 Nearly a Senior Poster Featured Poster

I see readDateJS not readDate on the PHP script. May be this?

cereal 1,524 Nearly a Senior Poster Featured Poster

Try this, is done with your arrays:

<?php
$instruments = array(
	array( 'ID' => '1', 'Name' => 'Guitar', 'Model' => 'Gibson Dark Fire'),
	array( 'ID' => '2', 'Name' => 'Guitar', 'Model' => 'Gibson Dusk Tiger'),
	array( 'ID' => '3', 'Name' => 'Banjo', 'Model' => 'Mad Moon'),
	array( 'ID' => '4', 'Name' => 'Ukulele', 'Model' => 'Koa'),
	array( 'ID' => '5', 'Name' => 'Guitar', 'Model' => 'Gibson Robot Guitar')
);
$stores= array(
	array('ID' => '1', 'Name' => 'Rock Store 1', 'Address' => 'another street n1'),
	array('ID' => '2', 'Name' => 'Bohemian Rhapsody Store', 'Address' => 'plaza n2'),
	array('ID' => '3', 'Name' => 'Indie Music Instruments', 'Address' => '3rd street n123'),
	array('ID' => '4', 'Name' => 'Blues Brothers', 'Address' => '1060 West Addison ')
);

$arrayInstrumentsStores = array(
	"relation1" =>array("instID"=>"1","storeID"=>"1"),
	"relation2" =>array("instID"=>"1","storeID"=>"2"),
	"relation3" =>array("instID"=>"4","storeID"=>"3"),
	"relation4" =>array("instID"=>"2","storeID"=>"1"),
	"relation5" =>array("instID"=>"3","storeID"=>"2"),
	"relation6" =>array("instID"=>"5","storeID"=>"4")
);

$string = 'Guitar';
$search = ucfirst(strtolower($string));
$result = '';

foreach($instruments as $key => $value)
{
	if($value['Name'] == $search)
	{
		$a = $value['ID'];
		foreach($arrayInstrumentsStores as $k => $v)
		{
			if($v['instID'] == $a)
			{
				$result[$v['storeID'].':'.$a]['storeID'] = $v['storeID'];
				$result[$v['storeID'].':'.$a]['instID'] = $a;
				$result[$v['storeID'].':'.$a]['instName'] = $value['Name'];
				$result[$v['storeID'].':'.$a]['instModel'] = $value['Model'];
			}
		}


	}
}
#print_r($result);
echo "\n";
$c = count($stores);
if(is_array($result))
{
	for($i = 0; $i < $c; $i++)
	{
		foreach($result as $key =>$value)
		{
			if($stores[$i]['ID'] == $value['storeID'])
			{
				echo $stores[$i]['Name'] . "\n";
				echo $stores[$i]['Address'] . "\n";
				echo $value['instName'] . "\n";
				echo $value['instModel'] . "\n\n";
			}
		}
	}
} else {
	echo 'not found' . "\n";
}

?>

The output will be:

Rock Store 1
another street …
cereal 1,524 Nearly a Senior Poster Featured Poster

I can't think any way to merge the first two arrays, there is no data that can tell where an instrument is. Also, more than a store can have an instrument, so I came up with an example. Array $a is where you save instrument names as keys and store_id as values. Array $b is the store array.

<?php
$a = array(
    'viola' => array('1','2','12','13'),
    'guitar' => array('2','3','8'),
    'trumpet' => array('5'),
    'banjo' => array('6','10'),
    'flute' => array('4'),
    'oboe' => array('5','11'),
    'ukulele' => array('23'),
    'tuba' => array('1','5'),
    'cello' => array('7')
);

$var = 'guitar'; # $_POST or $_GET
$result = $a[$var]; # retrieve stores id

$stores = array(
    '1' => array('name' => 'Rock Store 1','address' => 'another street n1'),
    '2' => array('name' => 'Rock Wave','address' => 'that plaza n2'),
    '3' => array('name' => 'Jazz Store 2','address' => 'avenue n1115'),
    '4' => array('name' => 'Bohemian Rhapsody Store','address' => 'plaza n2'),
    '5' => array('name' => 'Indie Music Instruments','address' => '3rd street n123'),
    '6' => array('name' => 'Whatever Music Co.','address' => 'avenue n222'),
    '7' => array('name' => 'Blues Brothers','address' => '1060 West Addison')
);

echo $var . "\n\n";
# display store names and addresses
foreach($result as $key => $value)
{
    echo $stores[$value]['name'] . "\n";
    echo $stores[$value]['address'] . "\n\n";
}

?>

The above will output:

guitar

Rock Store 1
another street n1

Indie Music Instruments
3rd street n123

Blues Brothers
1060 West Addison

Hopefully someone else will help you to find a better solution.
I'm almost sure array_keys() can be used to make something …

cereal 1,524 Nearly a Senior Poster Featured Poster

Remove center and font tag and write:

<a style="display: block; width: 100px; height: 30px; margin: 20px auto; color: white" href="../index.html" border=0>Back To Menu</a>

Otherwise use a div:

<div style="width: 800px; margin: 20px auto; text-align:center;">
<a style="color:left;" href="../index.html" border=0>Back To Menu</a>
</div>

You can use also float to do this.

cereal 1,524 Nearly a Senior Poster Featured Poster

<font color="white"> , which color is the background?

cereal 1,524 Nearly a Senior Poster Featured Poster

trim $preDoor[0] and the others, little example:

<?php
$a = 'hello';
$b = 'hello ';
echo ($a == $b) ? 'true':'false';
echo ' ';
echo ($a == trim($b)) ? 'true':'false';
?>
cereal 1,524 Nearly a Senior Poster Featured Poster

Instead of $p == $predor[1] have you tried in_array()? Returns TRUE if the item is found: http://php.net/manual/en/function.in-array.php

cereal 1,524 Nearly a Senior Poster Featured Poster

Did you tried this?

mysql -uCHRIS -pCHRISSEC
cereal 1,524 Nearly a Senior Poster Featured Poster

datetime column? Use strtotime():

<?php
$year = '2011';
$month = '9';
$day = '21';
echo date('Y-m-d',strtotime($year.'-'.$month.'-'.$day));
?>

In your case will be:

$sdate1 = date('Y-m-d',strtotime($_POST['sdate1year']."-".$_POST['sdate1month']."-".$_POST['sdate1day']));

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Read what Karthik suggested to you. This happens because you're sending the same name field for day, month and year. An example, change names of select fields with these:

sdate1day
sdate1month
sdate1year
ddate1day
ddate1month
ddate1year

Change also the lines n.16 and 17, so they will be:

$sdate1=$_POST['sdate1year']."-".$_POST['sdate1month']."-".$_POST['sdate1day'];
$ddate1=$_POST['ddate1year']."-".$_POST['ddate1month']."-".$_POST['ddate1day'];