|
Posted by Tim Streater on 10/13/05 11:27
In article <433287e7@news.rivernet.com.au>,
"plato" <platoTAKETHISOUT@telpacific.com.au> wrote:
[trillions of copies of unnecessary stuff deleted]
> I followed your advice and have created the table :courses and inserted 2
> fields course and places and populated them with course 1 and 11 places
> (integer) and course 2 and 15 places (integer) running this script:
>
> <?PHP
>
> //alter you variables here
> $host = "localhost";
> $username="";
> $password="";
> $database="paul";
>
> // create link to database
> $link = mysql_connect($host, $username, $password)
> or die("Cannot connect to database");
>
> mysql_select_db($database)
> or die("Cannot select database");
>
> //now we make the query which will ask the database for the course
> information
> //change the my_table to your course table name
>
> $query = "SELECT course,places FROM courses";
> $result = mysql_query($query)
> or die("Query cannot be executed");
>
> //now we are going to print the information to your screen
> while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
> printf ("course: %s places: %s<br>", $row['course'],
> $row['places']);
> }
> ?>
>
> Still getting this error:
>
> Parse error: syntax error, unexpected T_VARIABLE in c:\wamp\www\Untitled.php
> on line 20
>
> but I can't see anything wrong with that line??
There's nothing wrong syntactically with line 20. Its line 17 that's the
problem. What's PHP supposed to do with the word "information" sitting
there all by itself?
-- tim
Navigation:
[Reply to this message]
|