Jump to content

gongpex

Members
  • Posts

    360
  • Joined

  • Last visited

Everything posted by gongpex

  1. Allright , sorry for long reply, my question is according on : http://www.html5box.com <div class="image_tn"><a href="images/Big_Buck_Bunny_1.m4v" data-webm="images/Big_Buck_Bunny_1.webm" class="html5lightbox" title="Big Buck Bunny Copyright Blender Foundation"><img src="images/Big_Buck_Bunny_3_96.jpg"></a></div><div class="clr"></div> code on above they use : data-webm as 'src' so that if the browser is firefox file will be accessed from data-webm not from src, I had test this code and it run well. Q : so how to create own src attribute using own text like data-webm? note : on my question before I just use img src as example to make you all understand with my question, but on this section I use real example. please answer Thanks
  2. Hello everyone, usually to display image we use : <img src="link of image" width=".." height="..." /> but how to create own src attribute using own text so that the function is same when we use 'src': for example: <img ourtext="link of image" width=".." height="..." /> C : In short 'ourtext' have same function with 'src' please someone help me Thanks
  3. Hello everyone if using php I can change the value of element like this : <div class="<?php if(x==1) echo tes1; else echo tes2; ?>">some text....</div> Q : but how about in javascript? when I put some tes code like this it won't work : <script type="text/javascript">if(screen.width < 1281) { x = 'r'; } else { x = 'b'; } function disp() { document.write(x);}</script><style type="text/css"> .r {color: red;} .b {color : blue;}</style><body> <div class="javascript:disp()">TES</div></body> this my expectation : when debug on browser it will display: <div class="r">TES</div> when screen less than 1280px and the color of TES is red and <div class="b">TES</div> when screen greater than 1280px and the color of TES is blue please someone help me Thanks
  4. Hello everyone, well, I think embarrassing to ask about this, but because my project almost deadline so I think need to talk about this I had look on search engine about 'jquery responsive video lightbox with caption' but after I look, very-very little site that provide about it. If their available there is no caption, if their have caption the responsive not work well. Can all of you help me to find lightbox video like criteria on above? please help me Thanks
  5. so, I need to put the date like on example? OFFQ : I think this question is rather fool, but this is my first time use safari browser, if on firefox, chrome and IE press F12 to display debugger, how about on safari? please help thanks
  6. Hello everyone, Today I tried to learn about js cookie on this page : cookie on this tutorial there is only example about how to : set, get, and check cookie, but there is no example to delete cookie. I had try to create code to delete cookie like this : function delCookie() { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires=" + d.toGMTString(); document.cookie = "username=;expires"; } this code didn't work and this my full code : <!DOCTYPE html><html><head><script>function setCookie(cname,cvalue,exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires=" + d.toGMTString(); document.cookie = cname+"="+cvalue+"; "+expires;}function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1); if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return "";}function checkCookie() { var user=getCookie("username"); if (user != "") { alert("Welcome again " + user); } else { user = prompt("Please enter your name:",""); if (user != "" && user != null) { setCookie("username", user, 30); } }}function delCookie() { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires=" + d.toGMTString(); document.cookie = "username=;expires"; }</script></head><body onload="checkCookie()"><button onclick="delCookie()">Delete cookie</button></body></html> Q : what's mistake on my code? OFFQ : I think this question is rather fool, but this is my first time use safari browser, if on firefox, chrome and IE press F12 to display debugger, how about on safari? please someone help me Thanks
  7. sorry for long reply, because I'm very busy, ok here : <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=windows-1252"> <title>jScrollPane mwheelIntent demo</title> <!-- styles needed by jScrollPane --> <link rel="stylesheet" href="style/jquery.jscrollpane.css" type="text/css" media="all" /> <style type="text/css"> /* Styles specific to this particular page */ .scroll-pane { width: 100%; height: 200px; overflow: auto; } .horizontal-only { height: auto; max-height: 200px; } </style> <!-- latest jQuery direct from google's CDN --> <!---<script type="text/javascript" src="C:/Users/wong/Desktop/jscrollpane/jquery-min.js"></script>---> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!-- the mousewheel plugin - optional to provide mousewheel support --> <script type="text/javascript" src="script/jquery.mousewheel.js"></script> <!-- the jScrollPane script --> <script type="text/javascript" src="script/jquery.jscrollpane.min.js"></script> <script type="text/javascript"> $(function() { $('.scroll-pane').jScrollPane(); }); </script> </head> <body> <div id="container"> <h2>Horizontal only</h2> <div tabindex="0" style="overflow: hidden; padding: 0px; width: 760px;" class="scroll-pane"> <div style="width: 760px; height: 99px;" class="jspContainer"><div style="padding: 0px; width: 760px; left: 0px;" class="jspPane"> <p style="width: 1000px;"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec in ligula id sem tristique ultrices eget id neque. Duis enim turpis, tempus at accumsan vitae, lobortis id sapien. Pellentesque nec orci mi, in pharetra ligula. Nulla facilisi. Nulla facilisi. Mauris convallis venenatis massa, quis consectetur felis ornare quis. Sed aliquet nunc ac ante molestie ultricies. Nam pulvinar ultricies bibendum. Vivamus diam leo, faucibus et vehicula eu, molestie sit amet dui. Proin nec orci et elit semper ultrices. ###### sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed quis urna mi, ac dignissim mauris. Quisque mollis ornare mauris, sed laoreet diam malesuada quis. Proin vel elementum ante. Donec hendrerit arcu ac odio tincidunt posuere. Vestibulum nec risus eu lacus semper viverra. </p></div><div class="jspHorizontalBar"><div class="jspCap jspCapLeft"></div><div style="width: 760px;" class="jspTrack"><div style="width: 578px; left: 0px;" class="jspDrag"><div class="jspDragLeft"></div><div class="jspDragRight"></div></div></div><div class="jspCap jspCapRight"></div></div></div></div> </div> </body></html> note : please all of the .css and javascript / jquery file download it from : jscrollpane A : my expectation only so that the code will be run. Thanks
  8. Hello everyone A few month ago I had tried to take jscrollpane (jquery for to change iframe scrollbar) from this site : jscrollpane I had followed some instruction on there, but the code didn't work, so I think there is some mistake or incomplete instruction there. A : please someone help me to check this Thanks.
  9. Q : So, what I must do so that it can be pass the value? this code work well on mysql tags, but after I change on mysqli this code didn't work. please help me Thanks
  10. C : Hmm.... I think rule on this forum prohibit to talk or ask about offtopic, but this different..............but congratulation to my mentor, hope you become more success here.
  11. Hello everyone,I had plan to learn both PHP and ASP,I have already install apache and PHP on my computer, and now I want to install IIS also for learn ASP.A : Can you guide me to install IIS after apache installation?please help meThanks
  12. Hello everyone, allright I think I need to post my true problem about this topic: product.php : <?php include("includes/db.php"); include("includes/functions.php"); if($_REQUEST['command']=='add' && $_REQUEST['productid']>0){ $pid=$_REQUEST['productid']; addtocart($pid,1); header("location:shoppingcart.php"); exit(); } /* $result=mysqli_query($connect,"select name from products where serial='2'"); $row=mysqli_fetch_array($result); echo $row['name']; */?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Products</title><script language="javascript"> function addtocart(pid){ document.form1.productid.value=pid; document.form1.command.value='add'; document.form1.submit(); }</script></head><body><form name="form1"> <input type="hidden" name="productid" /> <input type="hidden" name="command" /></form><div align="center"> <h1 align="center">Products</h1> <table border="0" cellpadding="2px" width="600px"> <?php $result=mysqli_query($connect,"select * from products"); while($row=mysqli_fetch_array($result)){ ?> <tr> <td><img src="<?php echo $row['picture'];?>" /></td> <td> <b><?php echo $row['name'];?></b><br /> <?php echo $row['description'];?><br /> Price:<big style="color:green"> $<?php echo $row['price'];?></big><br /><br /> <input type="button" value="Add to Cart" onclick="addtocart(<?php echo $row['serial'];?>)" /> </td> </tr> <tr><td colspan="2"><hr size="1" /></td> <?php } ?> </table></div></body></html> function.php <?php function get_product_name($pid){ global $connect; global $pid; $result=mysqli_query($connect,"select name from products where serial=$pid"); $row=mysqli_fetch_array($result); echo $row['name']; } function get_price($pid){ global $connect; global $pid; $result=mysqli_query($connect,"select price from products where serial=$pid"); $row=mysqli_fetch_array($result); echo $row['price']; } function remove_product($pid){ $pid=intval($pid); $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ if($pid==$_SESSION['cart'][$i]['productid']){ unset($_SESSION['cart'][$i]); break; } } $_SESSION['cart']=array_values($_SESSION['cart']); } function get_order_total(){ $max=count($_SESSION['cart']); $sum=0; for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=$_SESSION['cart'][$i]['qty']; $price=get_price($pid); $sum+=$price*$q; } return $sum; } function addtocart($pid,$q){ if($pid<1 or $q<1) return; if(is_array($_SESSION['cart'])){ if(product_exists($pid)) return; $max=count($_SESSION['cart']); $_SESSION['cart'][$max]['productid']=$pid; $_SESSION['cart'][$max]['qty']=$q; } else{ $_SESSION['cart']=array(); $_SESSION['cart'][0]['productid']=$pid; $_SESSION['cart'][0]['qty']=$q; } } function product_exists($pid){ $pid=intval($pid); $max=count($_SESSION['cart']); $flag=0; for($i=0;$i<$max;$i++){ if($pid==$_SESSION['cart'][$i]['productid']){ $flag=1; break; } } return $flag; } function test() { $result=mysqli_query($connect,"select name from products where serial='1'"); $row=mysqli_fetch_array($connect,$result); echo $row['name']; }?> shoppingcart.php <?php include("includes/db.php"); include("includes/functions.php"); if($_REQUEST['command']=='delete' && $_REQUEST['pid']>0){ remove_product($_REQUEST['pid']); } else if($_REQUEST['command']=='clear'){ unset($_SESSION['cart']); } else if($_REQUEST['command']=='update'){ $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=intval($_REQUEST['product'.$pid]); if($q>0 && $q<=999){ $_SESSION['cart'][$i]['qty']=$q; } else{ $msg='Some proudcts not updated!, quantity must be a number between 1 and 999'; } } } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Shopping Cart</title><script language="javascript"> function del(pid){ if(confirm('Do you really mean to delete this item')){ document.form1.pid.value=pid; document.form1.command.value='delete'; document.form1.submit(); } } function clear_cart(){ if(confirm('This will empty your shopping cart, continue?')){ document.form1.command.value='clear'; document.form1.submit(); } } function update_cart(){ document.form1.command.value='update'; document.form1.submit(); }</script></head><body><form name="form1" method="post"><input type="hidden" name="pid" /><input type="hidden" name="command" /> <div style="margin:0px auto; width:600px;" > <div style="padding-bottom:10px"> <h1 align="center">Your Shopping Cart</h1> <input type="button" value="Continue Shopping" onclick="window.location='products.php'" /> </div> <div style="color:#F00"><?php echo $msg;?></div> <table border="0" cellpadding="5px" cellspacing="1px" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; background-color:#E1E1E1" width="100%"> <?php if(is_array($_SESSION['cart'])){ echo '<tr bgcolor="#FFFFFF" style="font-weight:bold"><td>Serial</td><td>Name</td><td>Price</td><td>Qty</td><td>Amount</td><td>Options</td></tr>'; $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=$_SESSION['cart'][$i]['qty']; //$pname=get_product_name($pid); if($q==0) continue; ?> <tr bgcolor="#FFFFFF"><td><?php echo $i+1;?></td><td><?php get_product_name($pid) ;?></td> <td>$ <?php get_price($pid);?></td> <td><input type="text" name="product<?php echo $pid;?>" value="<?php echo $q;?>" maxlength="3" size="2" /></td> <td>$ <?php get_price($pid)*$q ?></td> <td><a href="javascript:del(<?php echo $pid;?>)">Remove</a></td></tr> <?php } ?> <tr><td><b>Order Total: $<?php get_order_total();?></b></td><td colspan="5" align="right"><input type="button" value="Clear Cart" onclick="clear_cart()"><input type="button" value="Update Cart" onclick="update_cart()"><input type="button" value="Place Order" onclick="window.location='billing.php'"></td></tr> <?php } else{ echo "<tr bgColor='#FFFFFF'><td>There are no items in your shopping cart!</td>"; } ?> </table> </div></form></body></html> and this db.php <?php $connect = mysqli_connect("localhost","root","abcdefghi") or die("Demo is not available, please try again later"); @mysqli_select_db($connect,"cart_test") or die("Demo is not available, please try again later"); session_start();?> please see on function.php code: I had add : global $connect;global $pid; on function get_product_name($pid) and on function get_price($pid) it can generate session but product name and price not display please see image on attachment : This code is about shopping cart and actually I got this code from : http://www.qualitycodes.com/tutorial.php?articleid=25&title=Tutorial-Building-a-shopping-cart-in-PHP please someone help me Thanks
  13. gongpex

    CSS responsive

    Hello everyone, Today I tried to create own responsive using this code: <!DOCTYPE><style type="text/css">.test { margin : 0px auto; width:500px; height: 250px; border : 1px solid green; float:left; } .ftest { margin : 0px auto; width:500px; height: 250px; float: left; } @media screen (max-width: 630px){ .test { width:500px; border : 1px solid green; } .ftest { margin : 0px; width:30%; } } @media (min-width:733px) { .test { width:500px; border : 1px solid green; } .ftest { margin : 0px; width:38%; } } @media (max-width:860px) { .test { width:500px; border : 1px solid green; } .ftest { margin : 0px; width:30%; } } @media (max-width:650px) { .test { width:500px; border : 1px solid green; } .ftest { margin : 0px; width:0%; } } @media (min-width:1024px) { .test { width:500px; border : 1px solid green; } .ftest { margin : 0px; width:46%; } } @media (min-width: 1100px){ .test { width:500px; border : 1px solid green; margin : 0px auto; } .ftest { margin : 0px; width:500px; }} </style><body><div class="ftest"></div><div class="test">Responsive test!</div></body></html> When I test this code, It can be run but the result are not soft (maybe you will understand after try my code) and @media screen (max-width: 630px) (not detect on my browser when I debug it using chrome) Q : What's mistake with my code? please help me Thanks
  14. I had told before about this, please see on post #3If I use :function test() {$result=mysqli_query($connect,"select name from products where id='1'");$row=mysqli_fetch_array($result);echo $row['name']; }test();it won't show anything,but if I delete the function like this :$result=mysqli_query($connect,"select name from products where id='1'");$row=mysqli_fetch_array($result);echo $row['name']; it will show value of product pid '1',So, please help me at least if I use function it can be display the value of pidThanks
  15. Hello I had do your advice but the result it display 'blank' page instead. please help Thanks
  16. I had try using 'GET[]' to take value from $pid but the result still same, Even I test my code like this : function test() {$result=mysqli_query($connect,"select name from products where id='1'");$row=mysqli_fetch_array($result);echo $row['name']; }test(); I deliberately change $pid using value ='1' but the result still same it's didn't show anything. Except I delete function code. please someone help me Thanks
  17. Hello everyone Since I use mysqli I often found a problem, one of them is about php function I think I need to show example code on you: <?php $result=mysqli_query($connect,"select name from products where id='$pid'"); $row=mysqli_fetch_array($result); echo $row['name'];?> this will show value of $row['name'] but when I put this code on function like this : <?php function test($pid) { $result=mysqli_query($connect,"select name from products where id='$pid'"); $row=mysqli_fetch_array($result); echo $row['name']; } test($pid);?> This didn't show anything Q : what's mistake on my function code? please someone help me Thanks
  18. Hello everyone I don't know from where I must start to told my problem, but this my problem : - First time when I install php 5.3.1 32 bit on apache 2.4.7 64 bit it was successful and I can use php well, - But because I want to upgrade my php 5.3.1 32 bit to php 5.5.18 VC11 32 bit. I uninstall my apache and then reinstall it, after reinstall apache I install php 5.5.18 on apache server I tried to turn on my apache but there is message like on this image : after I check on httpd.conf : it will happen if I put this code on httpd.conf : PHPIniDir "C:/Program Files (x86)/php" LoadModule php5_module "C:/Program Files (x86)/php/php5apache2_4.dll" Q : What I must do to fix this problem? Q2 : Should I uninstall mysql too? because since I uninstall apache and php I have not uninstall mysql please someone help me Thanks
  19. Hello everyone, since I learn code ignitier I became know something about web page content url, using code ignitier I can use url link like this : localhost/folder/index.php/page and it can display web content well. Usually I create code to display web content on index.php manually (without php framework) like this : <?php $page = $_GET["p"]; $avl = "application_$page.php"; if(!file_exists($avl)|| $page=="" || $page=="application_home.php"){ include("application_home.php"); }else{ include("application_$page.php"); }?> and this code when I open on browser address like : localhost/folder/index.php?p=example can be displayed well. but when I tried use code like this : <?php $page = $_SERVER['PHP_SELF']; $avl = basename($page); if(!file_exists($avl)|| $avl=="" || $avl=="application_home.php"){ include("application_home.php"); }else{ include("application_$avl.php"); } ?> and I type on browser address like this : localhost/folder/index.php/example it will shown the page but page without CSS style. Q : how to create web content that display on index.php, can be displayed well without using url localhost/folder/index.php?p=example (in short if I using localhost/folder/index.php/example can be displayed well)? please help Thanks
  20. Hello everyone, If user forgot their password , they usually asked to give their email and then their password sent from web service into their email automatically, Q : Can somebody give me tutorial about this? please help Thanks
  21. I had try using var_dump() like this : <h1> PRODUCT PAGE </h1> <h2><b>Product List</b></h2> <?php foreach(var_dump($product_list) as $product) { echo "<li>".$product->id ." "; echo $product->name ." "; echo $product->price; echo " -- <a href=" /exp/index.php/cart/add/".$product->id."">Buy</a>"; } ?> but it's result : Function name must be a string in /srv/disk2/602761/www/ciportofolio.atwebpages.com/application/views/product.php on line 8 Q : so, what I must do? please help Thanks
  22. Hello everyone, My site able to display well when I open it on localhost, but if I open it after I upload it on server it shown : "Fatal error: Call to a member function row() on a non object in /srv/disk2/602761/www/ciportofolio.atwebpages.com/application/views/product.php on line 8" this is my controller file : <?php if(! defined('BASEPATH')) exit('no direct script access allowed'); class Product extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->library('cart'); } function index() { $this->load->library('template'); $query = $this->db->get('ci_item'); $data['product_list'] = $query; $this->template->show('product',$data); } } and this is my views file (product.php): <h1> PRODUCT PAGE </h1> <h2><b>Product List</b></h2> <?php foreach($product_list->row() as $product) { echo "<li>".$product->id ." "; echo $product->name ." "; echo $product->price; echo " -- <a href=" /exp/index.php/cart/add/".$product->id."">Buy</a>"; } ?> Q : What mistake on my code? note : I had try using var_dump on $product_list->row() but the result still same please someone help me Thanks
  23. Hello everyone, I think I need to ask about this because many people disturb my learning process, Case1 : many people suggest me to learn java, because using java I can build mobile application for android phone and another application. Case2 : other side people said if I better learn C or C++ to develop driver for hardware, game, security system and etc Case3 : both of side people suggest me to reduce learn PHP because they said to me if PHP unable to build any application except for web. And web can be builded easily using CMS or etc, so this is are their reason giving suggestion to me. So, I need all of your advice, because I think moderator here are expert and understand about this. Q : in short, which program or programmer that can be get result big salary / earning and still able to use for the future?? programmer for : - mobile application -> using java - device, game,security system -> using C++ - web -> using PHP or ASP please help me, so that I can give them answer or I can determine which program that have prospect that I must learn. many thanks
  24. I don't know about the problem, because when I use another internet connection that provided by another ISP I can login and compose thread here like this now, so I ask on this forum maybe there is solution to solve the problem if I use ISP A (ISP that provided fast internet connection) that was I mentioned before?? please answer thanks. . . . . . . . . . . . .
  25. Hello everyone, Today just I able to access on this forum after long time I can't login, I don't know why when I use internet connection that provided from ISP A (for example) when I sign in into this forum it cause sign out automatically. But after I use new provider I can sign in into this forum without problem. But the connection slow. Q : Can I configure something (change proxy or etc) so that when I use internet connection from ISP A, I still can access this forum without sign out automatically? R : I ask this because internet speed connection that provided by ISP A is fast. please someone help me about this thanks
×
×
  • Create New...