Hello Jim,

The problem isn't with the query.  It's in the last two printf
statements:

printf("%s %s $s<br>", $row->name, $row->room_num, $row->update_time);
printf("%s %s $s<br>", $row->name, $row->update_time, $row->room_num);

In each line you have two occurrences of '%s' in the format string,
while there are three arguments.  Since there are only two conversion
specifiers in the format string, only the first two arguments will be
processed and printed.  The '$s' is an undefined variable so nothing
gets outputted for that.

Regards,
James Chin
OpenLink Software Inc.

On Wed, 31 Oct 2001 14:42:36 +0800, [EMAIL PROTECTED] (Jim) wrote:

>hi,
>i found very strange problem on mysql query. here is my code and result...
>very strange!
>pls help ...! thanks,....
>
>* code *******************
><?
>$link=mysql_pconnect("192.168.0.101", "chaze", "apple") or die ("failed");
>mysql_select_db("stjohn");
>$query="select * from user a, data b where a.room_num = b.room_num and
>a.room_num = " . $room_num;
>$result=mysql_query($query);
>//$row=mysql_num_rows($result);
>$row=mysql_fetch_object($result);
>if ($row->id != $id)
>{
> printf("wrong id!");
> header("location:http://www.php.net";);
> mysql_close($link);
> exit();
>}
>printf("update: %s, room no.: %s<br>", $row->update_time, $row->room_num );
>printf("update: %s, room no.: %s<br>", $row->update_time, $row->room_num );
>printf("%s %s $s<br>", $row->name, $row->room_num, $row->update_time);
>printf("%s %s $s<br>", $row->name, $row->update_time, $row->room_num);
>mysql_close($link);
>?>
>
>* result *******************
>
>update: 20011029120609, room no.: 9001
>update: 20011029120609, room no.: 9001
>jim lo 9001
>jim lo 20011029120609
>
>
>
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to