futurewii Posted June 24, 2008 Share Posted June 24, 2008 Hey, I get this message.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /mounted-storage/home36c/sub005/sc28991-YIVP/futurewii.com/pages/videos/view.php on line 10 With this script.. <div id="content"><br /> <br /> <?php include "includes/conn.php"; $result = mysql_query("SELECT * FROM videos WHERE id = '".$_GET['id']."'") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo "<h2><span lang="en-gb">$row['title']</span></h2>"; echo "<br />"; echo $row['script']; echo "<br />"; echo "<h7>$row['download']</h7>"; echo "<br />"; echo "<br />"; echo "<p><span lang="en-gb">$row['description']</span></p>"; echo "<br />"; echo "<br />"; echo "<br />"; echo "<br />"; echo "<br />"; echo "<br />"; $page_id = "$row['id']"; // for example include("comments/comments_show.php"); include("comments/comments_form.php"); ?> Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/ Share on other sites More sharing options...
vbnullchar Posted June 24, 2008 Share Posted June 24, 2008 do it like this.. echo "<h2><span lang='en-gb'>$row[title]</span></h2>"; Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572749 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 ok thanks a lot Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572753 Share on other sites More sharing options...
DarkWater Posted June 24, 2008 Share Posted June 24, 2008 Wow. So many people code so sloppily these days. When using arrays, the keys should be enclosed in ' ' or " " (for variable keys). Then, when echo'd in a string, they must be enclosed in { }. echo "{$row['title']}"; As an example. The only reason that it works the way you have it is because PHP doesn't WANT to through errors at you, so it tries to "fix" it. First, it looks for a constant named title, and if it doesn't find one, it ASSUMES you wanted 'title'. You should really clean that up. Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572754 Share on other sites More sharing options...
whizard Posted June 24, 2008 Share Posted June 24, 2008 and... there's no such thing as an <h7> tag... Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572766 Share on other sites More sharing options...
DarkWater Posted June 24, 2008 Share Posted June 24, 2008 Ahaha, I just noticed that. This line: echo "<h7>$row['download']</h7>"; There's no such thing as an h7 tag. =) What did you mean to put there? xD Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572767 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 The h7 tag refers to a CSS tag because the page is actually an include Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572781 Share on other sites More sharing options...
whizard Posted June 24, 2008 Share Posted June 24, 2008 It doesn't matter if its an include page or line one of index.html in root. It doesn't matter if its HTML, XHTML, CSS, XML, or anything else. There's still no such thing as an <h7> tag. Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572827 Share on other sites More sharing options...
kenrbnsn Posted June 24, 2008 Share Posted June 24, 2008 Just because there isn't a <h7> tag defined in the standards, doesn't mean you can't use it and define the style via CSS. See: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <style type="text/css" media="screen"> h7 { color: red; font-size: 150%; } </style> </head> <body> <h7>This is a h7 area</h7> </body> </html> True, it won't validate, but it does work (at least in Firefox3). Ken Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572855 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 Thanks Just one more thing and i'm finished bugging you for tonight <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='wii'"; print "<p><tr><a href='?page=video&id=".$row['id']."'>".$row['title'] . "</a></tr>"; print "<td>".$row['type']."</td>"; print "</tr>"; print "</tr>"; print "</table>"; ?> I'm wanting the table to only show entries which have their 'CONSOLE' value as 'wii' but nothing shows up in the table ??? any suggestions? Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572863 Share on other sites More sharing options...
kenrbnsn Posted June 24, 2008 Share Posted June 24, 2008 You need to fetch the results from the query: <?php $query_count = "SELECT * FROM videos WHERE console='wii'"; $row = mysql_fetch_assoc($query_count)); print "<p><tr><a href='?page=video&id=".$row['id']."'>".$row['title'] . "</a></tr>"; print "<td>".$row['type']."</td>"; print "</tr>"; print "</tr>"; print "</table>"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572866 Share on other sites More sharing options...
peranha Posted June 24, 2008 Share Posted June 24, 2008 EDIT : Beat to it by ken Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572869 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 Hey, Thanks a lot for your help. The entry is called wii not 'wii' and when I try your code Ken i get this error.. Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /mounted-storage/home36c/sub005/sc28991-YIVP/futurewii.com/pages/videos/index.php on line 15 Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572870 Share on other sites More sharing options...
kenrbnsn Posted June 24, 2008 Share Posted June 24, 2008 Sorry, forgot to put the query in: <?php $query_count = "SELECT * FROM videos WHERE console='wii'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); print "<p><tr><a href='?page=video&id=".$row['id']."'>".$row['title'] . "</a></tr>"; print "<td>".$row['type']."</td>"; print "</tr>"; print "</tr>"; print "</table>"; ?> You need to enclose strings in single quotes for mysql. Ken Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572872 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 Now I get this ??? Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /mounted-storage/home36c/sub005/sc28991-YIVP/futurewii.com/pages/videos/index.php on line 15 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /mounted-storage/home36c/sub005/sc28991-YIVP/futurewii.com/pages/videos/index.php on line 15 Problem with the query: SELECT * FROM videos WHERE console=wii Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Im really sorry for the constant questions, everyone here is extremely helpful and its the only way i'll learn Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572873 Share on other sites More sharing options...
kenrbnsn Posted June 24, 2008 Share Posted June 24, 2008 Those errors are saying you're having problem connecting to your MySQL database. Ken Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572874 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 Oh dear.. All my other databases seem to still be active though, but as long as there's no scripting errors By the way can i just check that WHERE console='wii'"; Is the correct phrase to make the table only show fields which have wii as the entry under 'console'? Thanks muchly Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572876 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 Servage has a bad reputation of randomly cutting off my MySql databases anyway for about 20 seconds on end, but its still not right ??? Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-572885 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 Ok its working now But how do I get it to show all the entries in the database? at the moment it is just showing one.. http://futurewii.com/?page=videos/index Thanks Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-573162 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 Its also skipping the tables down by one too :-\ Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-573174 Share on other sites More sharing options...
kenrbnsn Posted June 24, 2008 Share Posted June 24, 2008 Please repost the code you have now. Ken Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-573176 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 <div id="content"> <h2><span lang="en-gb">Video Database..</span></h2> <br /><br /> <h2>Nintendo Wii</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='wii'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /><br /> <h2>Gamecube</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='ngc'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /><br /> <h2>Virtual Console</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='vcg'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /><br /> <h2>Other Videos</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='oth'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /> Thanks Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-573179 Share on other sites More sharing options...
futurewii Posted June 24, 2008 Author Share Posted June 24, 2008 There it is ^ http://www.futurewii.com/?page=videos/index Link to comment https://forums.phpfreaks.com/topic/111582-its-expecting-a/#findComment-573195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.