Jump to content

rarebit

Members
  • Posts

    1,002
  • Joined

  • Last visited

Posts posted by rarebit

  1. In reality I had another issue with that reference, they all came through as the same, so I did basically the same but to a temporary array then copied it (may have time to find a better method later), also as you said the trailing comma err'd on me, so here's a quick amendment.

     

    	$params2=substr($params2, 0, -1);
    	$param=array();	//	need to copy because need references!!! grrr
    	for($i=0;$i<count($aa);$i++){
    		$param[]=&$aa[$i];
    	}
    
    I generate the params and types on the fly so that any number of products may be added at once.

     

    I will be banging these (+others) into functions later, but / or how do you mean? (I saw some class examples on php.net but i'm in a rush so just moved on, but I do prefer to optimise wherever possible!)

     

    Cheers

  2. Hi, i'm getting the following error when executing the following code. The count should be right

     

    Warning: mysqli_stmt_bind_param(): Number of elements in type definition string doesn't match number of bind variables in ... line 43

    That line may now be 39 ( call_user_func_array() )

    I've tried hard coding the types too (so no extra comma)! And without array_values(), plus other things... and when I print each set of params out they are right

     

    if(isset($_POST['order'])){
    	print "Order<br />";
    	
    	$param=array();
    	$params="";
    	$params2="";
    	foreach($_POST as $k=>$v){
    		$pos = strpos($k, 'sku');
    		if($pos!==false&&$pos==0){
    			$param[]=$k;
    			$params.="s";
    			$params2.="?,";
    		}
    	}
    	
    	if(count($param)>0){
    		print "Selecting<br />";
    		if($stmt = $db->prepare("SELECT sku, title, info, quant, cost FROM ".$db_table_prefix."product WHERE sku IN (".$params2.")")) {
    			call_user_func_array('mysqli_stmt_bind_param', array($stmt, $params, array_values(&$param)));
    			
    			$stmt->execute();
    
    Many thanks!
  3. Hi,

     

    I wrote some code a fair while ago now and just trying to use it again. The code works fine on my Linux distro, but on Windows i'm getting an error...

     

     

     

    MYSQL ERROR: Incorrect integer value: '' for column 'id' at row 1

    USING: INSERT INTO log_rec VALUES('','127.0.0.1','1370900361','404','GET','xyz',xyz','xyz')

     

    Basically 'id' is an int not null autoincrement, and I pass it an empty string.

     

    Do you know what the issue is?

  4.  

    The unordered list (ul) below the list (li).

     

    <li class='liOpen'><span class='bullet' onmouseover='changeit(this, 1);' onmouseout='changeit(this, 0);' onclick='changeit(this, 2);'> <a  href='http://10.0.0.55/cmstmp/rawstar7/cmsmonkey.0.4.1/site/pro/c/basics/index.html'>Basics</a></span></li>
       <ul>
          ...
       </ul>
    

     

    At first glance on discovering the issue I also thought the 'li' block should have been wrapping the associated 'ul', but supposedly not, and the basic version I have doesn't either.

  5. Hi,

     

    I made a menu a while back and have now just realised it's not initialising properly and I can't see why. Basically some blocks are initialised to to 'display:none', and they show the correct icon and the js works as if initialised that way, but the block below displays whether or not it is set as 'none'.

     

    The JS code is probably not required to be shown here, but...

     

    The HTML code

    <ul class='rctree'>
    <li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/index.html'>Programming</a></span></li>
    <li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55site/pro/c/index.html'>C</a></span></li>
    <li class='liOpen'><span class='bullet' onmouseover='changeit(this, 1);' onmouseout='changeit(this, 0);' onclick='changeit(this, 2);'> <a  href='http://10.0.0.55/cmstmp/rawstar7/cmsmonkey.0.4.1/site/pro/c/basics/index.html'>Basics</a></span></li>
    
    <ul>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_hello.html'>Hello</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_input.html'>Console Input</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_text_01.html'>Text Formatting</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_logic.html'>Logic</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_funcs_01.html'>Functions</a></span></li>
    
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_file_01.html'>File IO</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_macros.html'>#define & Macro's</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_pointers.html'>Array's & Pointers</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_system_01.html'>System Calls</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/basics/tut_c_console_01.html'>Console Parse App</a></span></li>
    
    </ul>
    <li class='liClosed'><span class='bullet' onmouseover='changeit(this, 1);' onmouseout='changeit(this, 0);' onclick='changeit(this, 2);'> <a  href='http://10.0.0.55/cmstmp/rawstar7/cmsmonkey.0.4.1/site/pro/c/io/index.html'>IO</a></span></li>
    <ul>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/io/file_io_rand.html'>Basic Random Access</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/io/file_io_rdb.html'>Random Access DataBase</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/io/file_io_seq2.html'>Sequential Access</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/io/file_io_cat.html'>Cat</a></span></li>
    
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/io/file_io_popen.html'>Popen</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/io/file_io_hexdump.html'>Hexdump</a></span></li>
    	<li class='liBullet'><span class='bullet'> <a  href='http://10.0.0.55/site/pro/c/io/file_io_fcount.html'>FCount</a></span></li>
    </ul>
    </ul>
    

     

    The CSS code

    @media screen, print {
    
    ul.rctree  li { list-style: none; }
    
    ul.rctree { margin-left:0px; padding:0px; }
    ul.rctree ul { margin-left:10px; padding:0px; }
    ul.rctree li { margin-left:5px; padding:0px; }
    
    ul.rctree  li           .bullet { padding-left: 15px; }
    
    ul.rctree  li.liOpen    .bullet { cursor: pointer; background: url(../../res/icons/li_minus.gif)  center left no-repeat; }
    
    ul.rctree  li.liClosed  .bullet { cursor: pointer; background: url(../../res/icons/li_plus.gif)   center left no-repeat; }
    
    ul.rctree  li.liBullet  .bullet { cursor: default; background: url(../../res/icons/li_bullet.gif) center left no-repeat; }
    ul.rctree  li.liOpen    ul { display: none; }
    
    ul.rctree  li.liClosed  ul { display: none; }
    
    }
    
    

     

    The JS code

    var nodelast = null;
    var timeout_id = null;
    function changeit(node, state)
    {
    if ( (state==1) && (node.parentNode.className != 'liOpen') )
    {
    	//	NEW OVER
    	nodelast = node;
    	timeout_id = setTimeout('node_open(nodelast)', 1000);
    }
    else if (state==0)
    {
    	//	OUT
    	clearTimeout(timeout_id);
    }
    else if (state==2)
    {
    	//	CLICK
    	node_open(node);
    }
    }
    function node_open(node)
    {
    if(node.parentNode.className == 'liOpen')
    {
    	node.parentNode.className = 'liClosed';
    }
    else
    {
    	node.parentNode.className = 'liOpen';
    }
    }
    

     

     

    Help greatly appreciated!

  6. Hi,

     

    I've just noticed an issue on my site and am wondering if it's either because of or solvable by mod_rewrite.

     

    Basically the home page displays images fine if you go to something like:

     

    www.here.com/index

     

    but if you just go to the root:

     

    www.here.com/

     

    then no images display...

     

    I've tried using things like:

     

    RewriteRule ^$ index.phtml [QSA,L]

     

    but for some reason I think i'll have to use a redirect...

  7. er?

    The 'x/y/z' is representative of a domain and directories.

    A URL opener is http://. Remove that and your URL is /x/y/z/money/res/icons/user.gif.

    eh? The URL be...

    x/y/z/money/res/icons/user.gif
    

    Whilst the protocol was specified by 'http://'.

     

    The absolute locations specified work in all browsers but not Opera, i'll try removing the protocol, but can't see that it should make any difference.

     

    In the first place I didn't include code because the URL's all conform to all examples (of absolutes, including domain) i've found, and also pass W3Schools, and they work in FF, IE, and Chrome without issue.

    Either way, ignore this thread please Haku, you seem to be misunderstanding the issue, but thanks for the input?

  8. Right, the 'alt' bit is obvious, but why no image?

    <div class='login_user_i'>
    <a href='http://x/y/z/login/profile' style='background:transparent url(http://x/y/z/monkey/res/icons/user.gif) no-repeat left top;text-indent:27px;display:table-cell;width:auto;height:24px;text-align:left;' title='Profile' > </a>
    </div>
    

     

    and a typical link:

    <span class='menu_std' style='float:left;'><a href='http://x/y/z/site/info'>INFO</a></span>
    

  9. Sorry haku I don't understand your answer. I've shown no code (if you meant to write 'line' and not 'like'). I've also checked for erroneous semi-colons and can't find any for either issue.

  10. 1. This should be in the HTML forum I think...

    2. Using code tags to surround code make helping easier...

     

    Your checkbox code looks correct, so...

     

    Have you looked at the page source once it's generated to see if any of your variables have introduced any erroneous characters which are exiting quotes prematurely? (even though I see your using htmlspecialchars())

     

     

    p.s. it looks like you can dl the source code from the publishers site: http://www.sitepoint.com/books/phpmysql4/?historicredirect=phpmysql1

  11. Hi,

     

    I was just doing some testing and found two issues when using the Opera Browser:

     

    1. It seems to not want to display gif's, but also not display their alt's either?

     

    2. When hovering over links the first time, the cursor changes to a hand, but if I remove and re-hover then the cursor doesn't change.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.