Sorry, my fault, I forgot ) before {,
This line is right:
if( $res->numRows() ) {

Gary wrote:

> Doesn't work, get unexpected { for if( $res->numRows() {. If I remove 
> braces or rearrange them it fall apart piece by piece.
>
> Thanks for the try
> Gary
>
> Marek Kilimajer wrote:
>
>> what about
>>
>> if( $res->numRows() {
>>    while( $row = $res->fetchRows() ){
>>    ... do what you've got to do
>>    }
>> } else {
>>    ... no rows
>> }
>>
>> Gary wrote:
>>
>>> John W. Holmes wrote:
>>>
>>>>> John W. Holmes wrote:
>>>>>  
>>>>>
>>>>>>> Can someone tell where I messed up on this code snippit?
>>>>>>>       
>>>>>>
>>>>>>
>>>>>>
>>>>>> Your first mistake is not giving us the full error and the line
>>>>>> number...
>>>>>>
>>>>>>
>>>>>>   
>>>>>>
>>>>>>> if ($res->numRows() > 0){
>>>>>>>                 list($id, $question, $responce1,
>>>>>>>       
>>>>>>
>>>>>>
>>>>>>
>>>>>> $responce2,
>>>>>>
>>>>>>   
>>>>>>
>>>>>>> $responce3) =  $res->fetchRows()
>>>>>>>       
>>>>>>
>>>>>>
>>>>>>
>>>>>> and you're missing a ; here... ^^
>>>>>>
>>>>>>
>>>>>>   
>>>>>>
>>>>>>>                $id = $row[0];
>>>>>>>             $question = $row[1];
>>>>>>>             $responce1 = $row[2];
>>>>>>>             $responce2 = $row[3];
>>>>>>>             $responce3 = $row[4];
>>>>>>>         }
>>>>>>>       
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---John Holmes...
>>>>>>
>>>>>>
>>>>>>     
>>>>>
>>>>>
>>>>>
>>>>> that fixed the unexpected t_variable but now it is Fatal error: Call
>>>>>   
>>>>
>>>>
>>>>
>>>> to
>>>>  
>>>>
>>>>> undefined function: fetchrows()
>>>>>
>>>>> list($id, $question, $responce1, $responce2,$responce3) =  $res-
>>>>>  
>>>>>
>>>>>> fetchRows()
>>>>>>     
>>>>>
>>>>>
>>>>>
>>>>
>>>> That means there is no function fetchrows() associated with whatever
>>>> class $res comes from...
>>>>  
>>>>
>>>
>>> I think it is time to call it a day. It is 11pm and I am getting so 
>>> punchy from this long day, I forgot to say it is a db call using 
>>> pearDB. If I remove the code and replace it with  while ($row  = 
>>> $res->fetchRows()) along the row array it work but then I can't 
>>> check for > 0
>>>
>>>
>>> Sorry
>>> Gary
>>>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to