-
October 17th, 2007, 07:56 PM
#1
Junior Member
php script error help?
Iv been following through a tutorial on making a news system with php and sql, after alof of noncing around iv managed to get most of the system to work except this error.
Parse error: syntax error, unexpected T_VARIABLE, expecting ']' in /home/welshywoo/www/read_more.php on line 5
Can anyone help me out with the syntax for this script?
<?php
include("config.php");
$newsid = $_GET['newsid];
$result = mysql_query("SELECT * FROM news WHERE newsid='$newsid' ",$connect);
while($myrow = mysql_Fetch_assoc($result))
{
echo "<b>";
echo $myrow['title'];
echo "</b><br>On: <i>";
echo $myrow['dtime'];
echo "</i><hr>";
echo $myrow['text1'];
echo " ";
echo $myrow['text2];
echo "<br><br><a href=\"javascript :Self.history.back();\"><--Go Back</a>";
}
?>
cheers,
-
October 17th, 2007, 09:08 PM
#2
Hi
line 5 ?
What about these?
Code:
$newsid = $_GET['newsid];
echo $myrow['text2];
You may add a '
Code:
$newsid = $_GET['newsid'];
echo $myrow['text2'];
The structure of the query looks fine to me. I assume config.php is well defined?
Cheers
If the only tool you have is a hammer, you tend to see every problem as a nail.
(Abraham Maslow, Psychologist, 1908-70)
-
October 18th, 2007, 09:39 AM
#3
Code:
<?php
include("config.php");
$newsid = $_GET[newsid];
$result = mysql_query("SELECT * FROM news WHERE newsid='".$newsid."'",$connect);
while($myrow = mysql_Fetch_assoc($result))
{
echo "<b>";
echo $myrow[title];
echo "</b><br>On: <i>";
echo $myrow[dtime];
echo "</i><hr>";
echo $myrow[text1];
echo " ";
echo $myrow[text2];
echo "<br><br><a href=\"javascript:Self.history.back();\"><--Go Back</a>";
}
?>
or
Code:
<?php
include("config.php");
$newsid = $_GET[newsid];
$result = mysql_query("SELECT * FROM news WHERE newsid='".$newsid."'",$connect);
while($myrow = mysql_Fetch_assoc($result))
{
echo "<b>".$myrow[title]."</b><br>On: <i>".$myrow[dtime]."</i><hr>".$myrow[text1]." ".$myrow[text2]."<br><br><a href=\"javascript:Self.history.back();\"><--Go Back</a>";
}
?>
-
October 18th, 2007, 02:35 PM
#4
Are you going to make this accessable from the Internet?
If so, you might want to plug that SQL-Injection hole...
Oliver's Law:
Experience is something you don't get until just after you need it.
-
October 18th, 2007, 08:47 PM
#5
Junior Member
got it working now, shoudlve checked my syntax better...
cheers everyone,
-
October 19th, 2007, 11:49 AM
#6
I'd say this is just a book he is following to learn php, not an actual script to be implemented.
-
October 23rd, 2007, 05:44 AM
#7
how about downloading php news system and from then on u may edit the system with your own style?
or perhaps look at how the system flow.
http://newsphp.sourceforge.net/downloads.php <---try this one.
Similar Threads
-
By grindcore in forum Web Security
Replies: 0
Last Post: August 30th, 2007, 04:33 AM
-
By nightcat in forum The Security Tutorials Forum
Replies: 9
Last Post: May 28th, 2005, 02:47 AM
-
By PuReExcTacy in forum Web Security
Replies: 11
Last Post: January 26th, 2005, 01:41 AM
-
By HDD in forum Other Tutorials Forum
Replies: 2
Last Post: February 1st, 2004, 08:05 PM
-
By CyberSpyder in forum AntiOnline's General Chit Chat
Replies: 0
Last Post: March 25th, 2003, 09:31 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|