473,394 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Simple db query errors in: 'unexpected T_WHILE...'

Colloid Snake
144 100+
Hello-

I'm trying my hand at php, and seem to be stuck at a pretty basic point.

I'm attempting to create a database driven menu list (such as if the Forums list on theScripts was to have a sub-list that was populated by a db query), and as such was using this page to guide me in trying to fetch the array of possible choices.

This is my code so far (starting basic and working my way up)

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. // connects to local db with uname nisuser
  4. mysql_connect("localhost", "user", "passswd") or
  5.     die("Could not connect: " . mysql_error());
  6.  
  7. // selects nisinventory db
  8. mysql_select_db("nisinventory");
  9.  
  10. // selects
  11. $result = mysql_query("SELECT Criticality FROM hardwaresorted");
  12.  
  13. // test to see what is in hwarray
  14. echo $result
  15.  
  16. // loop for rows
  17. while ($row = mysql_fetch_array($result) )
  18. {
  19.         echo $row;
  20. }
  21.  
  22. ?>
  23.  
And when I run it, I get this error:

Expand|Select|Wrap|Line Numbers
  1. PHP Parse error:  syntax error, unexpected ',' /home/user/bin/php/list.php on line 5
  2.  
Can anyone help resolve this error?
Sep 26 '07 #1
2 2863
ronverdonk
4,258 Expert 4TB
Line 14 (echo $result) needs a semi colon.

Ronald
Sep 27 '07 #2
Colloid Snake
144 100+
Line 14 (echo $result) needs a semi colon.

Ronald
Dang, that would do it, wouldn't it? Thanks!
Oct 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Robert Rozman | last post by:
Hi, I'm total php newbie and probably have trivial problem. I have following two scripts. First creates web form and should run second script with two arguments. But those two arguments don't...
38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
6
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
15
by: Richard Hollenbeck | last post by:
For example, one college course has only 24 students in it, but the following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs. When it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and...
2
by: Don Isgitt | last post by:
Environment: Server running Redhat 3.2.3-20 on quad Xeon 2.4 Postgresql 7.4 compiled from source (gcc 3.2.3) Application written in Perl (5.8.0) using Tk, DBI and DBD Client accessing DB using...
9
by: Andrew | last post by:
Hi, I implemented a simple WMI Provider in C#. It is a service which expose 10 instances of a simple WMI Class. The WMI class pnly expose 4 public properties (Value,Min,Max,StdValue) which...
1
by: Ty | last post by:
SELECT PERS_ROLE_HIST.ASGN_TS AS , Trim(Pers.lst_nm) +" ,"+Trim(pers.fst_nm) AS Name, DIV.DIV_NM AS Division, PERS_ROLE_HIST.AUTH_REQ_ID AS , ROLE.ROLE_CD, PERS_ROLE_HIST.ASGN_TS,...
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" &...
12
by: Soumen | last post by:
I've a templatized class member function calling templatized member function of another class. //A.h template <class T> class A { public: static T* create(); };
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.