Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #15146

Re: Why do I get error when same code works elsewhere?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Why do I get error when same code works elsewhere?
Date 2015-03-30 08:21 -0400
Organization A noiseless patient Spider
Message-ID <mfbf24$bvj$1@dont-email.me> (permalink)
References <18bbb34ftm658$.1tgigatbgo67j$.dlg@40tude.net> <20hhha9eugacoteq09tmr3mu9tr7fknu5h@4ax.com>

Show all headers | View raw


On 3/29/2015 11:35 PM, Richard Yates wrote:
> On Sun, 29 Mar 2015 21:47:09 -0400, richard <noreply@example.com>
> wrote:
> 
>> 																																																
>> $num=count($numone);
>> 																																																
>> shuffle($numone);
>> $x=0; $y=0;
>> while($x<$num){
>>
>> $mp=$numone[$x];
>> $mp=substr($mp,0,6);
>> $sql = "SELECT * FROM sixty where sid='$mp'";
>> $result = $mysqli->query($sql);<<<<<<<<<<< error here
>> $row = $result->fetch_assoc(); 
>>
>> echo$mp;
>> echo "<div style='width:300px; height:60px; border:solid 1px #00f;
>> overflow:hidden;';>";
>> $y=$x+1;
>> echo $y.") ".$row['title'];
>> echo "<br>";
>> $x++;
>>
>> echo "</div>";
>> }
>>
>> Fatal error: Call to a member function query() on a non-object
> 
> 
> $result=mysqli_query($sql);
> $row=mysqli_fetch_assoc($connection, $result);
> 

No, the code he posted is correct.  He is using the OO interface, not
the functional interface.  But his problem is before this.

Denis has the correct clue to where richard's problem is.  Doug's
response is also correct, although I'm not sure about richard's ability
to understand the results of the search.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why do I get error when same code works elsewhere? richard <noreply@example.com> - 2015-03-29 21:47 -0400
  Re: Why do I get error when same code works elsewhere? Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-03-30 02:14 +0000
  Re: Why do I get error when same code works elsewhere? Denis McMahon <denismfmcmahon@gmail.com> - 2015-03-30 03:21 +0000
  Re: Why do I get error when same code works elsewhere? Richard Yates <richard@yatesguitar.com> - 2015-03-29 20:35 -0700
    Re: Why do I get error when same code works elsewhere? richard <noreply@example.com> - 2015-03-29 23:53 -0400
      Re: Why do I get error when same code works elsewhere? Richard Yates <richard@yatesguitar.com> - 2015-03-29 21:12 -0700
        Re: Why do I get error when same code works elsewhere? richard <noreply@example.com> - 2015-03-31 12:01 -0400
    Re: Why do I get error when same code works elsewhere? Jerry Stuckle <jstucklex@attglobal.net> - 2015-03-30 08:21 -0400
      Re: Why do I get error when same code works elsewhere? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2015-03-30 13:17 +0000
      Re: Why do I get error when same code works elsewhere? Denis McMahon <denismfmcmahon@gmail.com> - 2015-03-30 17:06 +0000
      Re: Why do I get error when same code works elsewhere? richard <noreply@example.com> - 2015-03-31 12:02 -0400
  Re: Why do I get error when same code works elsewhere? bill <william@TechServSys.com> - 2015-03-31 08:11 -0400
    Re: Why do I get error when same code works elsewhere? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-31 14:24 +0200
      Re: Why do I get error when same code works elsewhere? bill <william@TechServSys.com> - 2015-04-01 08:27 -0400
        Re: Why do I get error when same code works elsewhere? ꧁꧂ <vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvva@hotmail.com> - 2023-05-14 08:53 -0700
    Re: Why do I get error when same code works elsewhere? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-03-31 22:38 +0200
      Re: Why do I get error when same code works elsewhere? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-31 22:55 +0200
        Re: Why do I get error when same code works elsewhere? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-03-31 23:23 +0200

csiph-web