sungpeng
-
Posts
290 -
Joined
-
Last visited
Posts posted by sungpeng
-
-
if($row[time] >5 of current date){ echo "is done"; } else { echo "is not done yet"; }
The "$row[time] >5 of current date" Can I know how to code?
-
hi I got a listdate field 2009-06-23 03:31:49.
In php echo "$row[time]";
if($row[time] more than 5 days){
cannot edit anymore
}
($row[time] more than 5 days), can I check with all of you how to code?
-
<?php echo date("l dS of F Y h:i:s A");
Hi good day, check with all of you how to display local singapore time instead of foreign time?
-
is a very long varchar 250 characters
-
sorry I got the "=" sign but the same problem still exist?
-
<table width"500"><tr><td width"500"> <?php $selectquerys = "SELECT * FROM users where llid='$llid'"; $results = mysql_query($selectquerys); $rows = mysql_fetch_array($results); echo "$rows[description]<br/>"; ?></td></tr></table>
Have some problem with table width. If like say my $rows[description] length is longer than table length width="500", I need it to go to the next row. Currently it will auto increase the table width to the $rows[description] length? why is that so? Can anyone help pls?
???
-
Name of the below save as header.php
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk"> <script type="text/javascript" src="dropdown.js"></script> <style type="text/css"> body { font-size: 0.7em; } h3 { font-size: 1.6em; margin: 0px; } a.sample_attach, a.sample_attach:visited, div.sample_attach { display: block; width: 100px; border: 1px solid black; padding: 2px 5px; background: #FFFFEE; text-decoration: none; font-family: Verdana, Sans-Sherif; font-weight: 900; font-size: 1.0em; color: #008000; } a.sample_attach, a.sample_attach:visited { border-bottom: none; } div#sample_attach_menu_child { border-bottom: 1px solid black; } form.sample_attach { position: absolute; visibility: hidden; border: 1px solid black; padding: 0px 5px 2px 5px; background: #FFFFEE; } form.sample_attach b { font-family: Verdana, Sans-Sherif; font-weight: 900; font-size: 1.1em; } input.sample_attach { margin: 1px 0px; width: 170px; } </style> </head> <body> <br /><br /> <div id="sample_attach_menu_parent" class="sample_attach">Main Menu</div> <div id="sample_attach_menu_child"> <a class="sample_attach" href="javascript:alert('Item 1');">Item 1</a> <a class="sample_attach" href="javascript:alert('Item 2');">Item 2</a> <a class="sample_attach" href="javascript:alert('Item 3');">Item 3</a> </div> <script type="text/javascript"> at_attach("sample_attach_menu_parent", "sample_attach_menu_child", "hover", "y", "pointer"); </script> </body> </html>
Save below as dropdown.js
function at_show_aux(parent, child) { var p = document.getElementById(parent); var c = document.getElementById(child ); var top = (c["at_position"] == "y") ? p.offsetHeight+2 : 0; var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0; for (; p; p = p.offsetParent) { top += p.offsetTop; left += p.offsetLeft; } c.style.position = "absolute"; c.style.top = top +'px'; c.style.left = left+'px'; c.style.visibility = "visible"; } // ***** at_show ***** function at_show() { var p = document.getElementById(this["at_parent"]); var c = document.getElementById(this["at_child" ]); at_show_aux(p.id, c.id); clearTimeout(c["at_timeout"]); } // ***** at_hide ***** function at_hide() { var p = document.getElementById(this["at_parent"]); var c = document.getElementById(this["at_child" ]); c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333); } // ***** at_click ***** function at_click() { var p = document.getElementById(this["at_parent"]); var c = document.getElementById(this["at_child" ]); if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden"; return false; } // ***** at_attach ***** // PARAMETERS: // parent - id of the parent html element // child - id of the child html element that should be droped down // showtype - "click" = drop down child html element on mouse click // "hover" = drop down child html element on mouse over // position - "x" = display the child html element to the right // "y" = display the child html element below // cursor - omit to use default cursor or specify CSS cursor name function at_attach(parent, child, showtype, position, cursor) { var p = document.getElementById(parent); var c = document.getElementById(child); p["at_parent"] = p.id; c["at_parent"] = p.id; p["at_child"] = c.id; c["at_child"] = c.id; p["at_position"] = position; c["at_position"] = position; c.style.position = "absolute"; c.style.visibility = "hidden"; if (cursor != undefined) p.style.cursor = cursor; switch (showtype) { case "click": p.onclick = at_click; p.onmouseout = at_hide; c.onmouseover = at_show; c.onmouseout = at_hide; break; case "hover": p.onmouseover = at_show; p.onmouseout = at_hide; c.onmouseover = at_show; c.onmouseout = at_hide; break; } }
When you just view the header.php page, the dropdown menu work nicely. Question is when you use
include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/header.php");
to call out the header, the javascript won't work anymore?
-
Hi check did anyone encounter this problem? I put javascript dropdown menu on php header. Then I use "include" to call out the header. PHP doesn't read the javascript in the header. When I just view the header page itself, there is no problem. Why is that so?
-
$sql = "SELECT * FROM listings WHERE address LIKE '%$address%' AND type LIKE '%$type%' AND price LIKE '%$price%' ORDER BY listdate LIMIT $offset, $rowsperpage";
sql = "SELECT * FROM users WHERE specialise1 LIKE '%$specialise1%' OR specialise2 LIKE '%$specialise1%' OR specialise3 LIKE '%$specialise1%' ORDER BY listdate LIMIT $offset, $rowsperpage" or die(mysql_error());
The above 2 codes is working fine. But once "or" "or" "and" conbined together, the "and" part is not working anymore?
-
$sql = "SELECT * FROM users WHERE specialise1 LIKE '%$specialise1%' OR specialise2 LIKE '%$specialise1%' OR specialise3 LIKE '%$specialise1%' AND status='on' ORDER BY listdate LIMIT $offset, $rowsperpage" or die(mysql_error());
Hi jack it still display the record although my status is 'off'. Not 'on'. By right it shouldn't display anything. It did not show any error.
-
$sql = "SELECT * FROM users WHERE specialise1 LIKE '%$specialise1%' OR specialise2 LIKE '%$specialise1%' OR specialise3 LIKE '%$specialise1%' AND status='on' ORDER BY listdate LIMIT $offset, $rowsperpage";
hi above the status='on' function is not working, status either "off" or "on" it will display, is there any mistake in the above query? pls help.. Thk
-
<?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('hello.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg('notebook.jpg'); $size = getimagesize('notebook.jpg'); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image, "hihi.jpg"); ?>
I need the hello.png to be the watermark for notebook.jpg. The code merge both photo together, but the hello.png appear to be total black. Can I know why is that so?
-
Check is it possible to have a transparent water mark at the center of uploaded photo using php? This is to prevent other from unauthorise use your photo.
-
-
while($index<=1000) { $arr =$_SESSION['hello'][$index]; echo count($arr); }
Check I need a function that will count the number of $arr that is not empty. If got 10 $arr that is not empty or = zero, display 10. The above code display 00000000100000010000. This is not I need.
-
ok Thank I will explore trigger again.
-
Can I have the statement? Is like mysql_query("DELETE FROM table WHERE something...."); rename field ID...
-
How? Triggers? I am inside mysql 5 now, no button for "triggers".
-
Check is it possible to auto delete all rows for table name "chess" when it reach 800 rows. The primary ID will start from "1" again instead of continue add to 801, 802, 803. Can I have the php mysql code?
-
<?php session_start(); include ("".$_SERVER['DOCUMENT_ROOT']."/config.php"); $query=mysql_query("select * from stats where id='1'" ); $row=mysql_fetch_array($query); $count="$row[counter]"; $_SESSION[$count]=$_GET[rid]; ?><html> <body><?php while($index<=10000) { $arr =$_SESSION[$index]; echo "$arr"; $index++; } ?></body> </html>
row[counter] is a counter that will add one once you click on this page, it is within 10000. I don't see any problem in above code but why it cannot work. It time to use database.
-
<?php session_start(); $indexnumber=$_GET[rid]; $arr1 = array("somearray" => array($indexnumber => $indexnumber)); $arr2=$_SESSION['views']; $arr=array_merge($arr2, $arr1); $_SESSION['views']=$arr; ?><html> <body><?php $arr=$_SESSION['views']; foreach ($arr['somearray'] as $key => $val) { echo "{$key} => {$val}<br />"; } ?></body> </html>
It's seen possible to use array merge?? I have seen people use session to store many id and later display all "shortlisted" in one page but I just cannot figure out how?
-
<?php session_start(); $indexnumber=$_GET[rid]; $arr1 = array("somearray" => array($indexnumber => $indexnumber)); $arr2=$_SESSION['views']; $arr=array_combine($arr2, $arr1); $_SESSION['views']=$arr; ?><html> <body><?php $arr=$_SESSION['views']; foreach ($arr['somearray'] as $key => $val) { echo "{$key} => {$val}<br />"; } ?></body> </html>
Just checking why about code cannot work? I still think is possible to use session array to store all indexnumber passed.
-
Is primary id for mysql be the IP address? I need to assign a temporary name to the user as the user is not log in. I still think is possible to use session array. Just the method of inputing into the array.
-
How to make it not overwrite the other ones.
intended result
$arr = array("somearray" => array(5 => 5, 9 => 9, 42 => 42));
It will store all variable passed.
Amend
Need to store many products in session array then check out, view all products without the person who is using it log in to the account.
[SOLVED] If date expire cannot edit
in PHP Coding Help
Posted
yes current field in mysql is 2009-06-23 03:31:49 format