I wrote my first php script just now. All it does is save some data to two different database tables. It tells me there's a parse error on line 48, which is the last line of the file. Could someone check over it and tell me what's wrong with the script. Here it is:
1
2 <head>
3 <title>Thanks</title>
4 </head>
5 <body>
6
7 <font size=5>Thank you for reviewing<br>
8 <?
9 echo $site_name
10 ?>
11 </font>
12 <br>
13 <br>
14
15 <!--insert validation code here--!>
16
17 <?
18
19 $site_name = addslashes($site_name);
20 $url = addslashes($url);
21 $reviewername = addslashes($reviewername);
22 $review = addslashes($review);
23 $site_name = addslashes($site_name);
24
25 //below logs onto mysql server with root as the usrname
26 @ $db = mysql_pconnect("localhost", "root");
27
28 if (!$db)
29 {
30 echo" Error accessing the mySQL database server. There's probably something wrong in the php code.";
31 exit;
32 }
33
34 mysql_select_db("urls");
35 $query = "insert into url_list values
36 ('null', '".$site_name."', '".$url."')";
37 "insert into reviews values
38 ('null', 'null', '".$reviewername."', '".$review."', '".$rating."')";
39 $result = mysql_query($query);
40
41 //say if anything happened
41 if ($result)
43 echo mysql_affected_rows()."row inserted into database.;
44
45 ?>
46
47 </body>
48
Maybe it's not so wierd (I hope) would this problem be a php or apache configuration error or did I type something wrong? Thanks.