Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parse error

Status
Not open for further replies.

csniffer

Programmer
Apr 30, 2003
161
GB
i am getting parse error from this code can anyone see a prob with it. the code is meant to return the number of rows then i can loop down and get all data.

Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\Apache Group\Apache2\Personal\datastu.php on line 26.
this is datastu.php which is include() from another page

Code:
<?php
session_start();
/********datastu.php*****/
/***Connect to database*/
/**By asmtony***********/
/***********************/
/*this file contains the*
**database conection for* 
**********SES***********/
//database specific
DEFINE (DB_HOST, &quot;JSTTECH&quot;);
DEFINE (DB_NAME, &quot;students&quot;);
//get session vars
$DB_USER = $_SESSION['user'];
$DB_PASSWORD = $_SESSION[password];
//connect to MySQL
$dbcon = mysql_connect(DB_HOST, $DB_USER, $DB_PASSWORD);

//select the database
mysql_select_db(DB_NAME,$dbcon);
Print&quot;Connected to Student Database &quot;;

//create the sql statement
$sql =  &quot;SELECT * FROM studentdetails&quot;;
print &quot;$sql&quot;
//execute the sql
$result = mysql_query($sql, $dbcon);
//get the number of rows in the result
$numrows = mysql_numrows($result);
echo&quot;<br>The number of records in the database is $numrows<br>\n&quot;;
mysql_close();
?>

i have put code on here because it is a parse error hope that correct.
the user name & password are correct.
thx



To err is human, to completely mess up takes a computer. [morning]
 
you need a space on your print &quot;Connected to Database&quot;
line.

Spout out.
 


Can u help me with my if statements now....please...

I just want a bit of code so that the user can only select one of 3 checkboxes....

oh, and don't do drugs..... without sharing..

S
 
Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\Apache Group\Apache2\Personal\datastu.php on line 27
new error

put ur if in a new subject and i will help if i can

To err is human, to completely mess up takes a computer. [morning]
 
don't forget your semi colons (;) at the end of u'r code... I know it's Monday morning Coke, but that's just a school boy error....

U'r print commands need ;'s at the end.

Spout out.
 
thx sorry been up since 7 and didnt go to bed till 3.30

To err is human, to completely mess up takes a computer. [morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top