Jump to content


Photo

Parse Error


  • Please log in to reply
10 replies to this topic

#1 NoMansLand

NoMansLand
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 23 May 2006 - 06:10 AM

Yes i am new to PHP and SQL but im incorporation PHP, SQL and HTML all together about 2 minutes ago the site worked now it comes up with:

Parse error: parse error, unexpected $end in C:\wamp\www\Test\test2.php on line 59


but their is no line 59, im using Notepad and PHP editor 2.22 the lines are
(top)
<?php
$date = $_POST["date"];
$manager = $_POST["manager"];
$Category = $_POST["Category"];
$quote = $_POST["quote"];
if (!isset($_POST['submit']))
?>

(bottom)
</select>
</option>
<form>
<textarea rows="10" cols="90" name="quote" wrap="physical">Please insert decision inside here.</textarea><br />
<input type="submit" value="submit" name="submit"> </input>
</form>
</body>
</html>

chears

Kris

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 23 May 2006 - 06:40 AM

My guess is your if() is missing either a { or }. Bit hard to tell without seeing the actual code. Is that all of it?

#3 NoMansLand

NoMansLand
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 23 May 2006 - 06:47 AM

[!--quoteo(post=376248:date=May 23 2006, 02:40 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 23 2006, 02:40 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
My guess is your if() is missing either a { or }. Bit hard to tell without seeing the actual code. Is that all of it?
[/quote]
Nope... i fixed it but :)

now i gotta do the SQL and the view.php?Date=ddmmyy *wonders*

just how do i make it connect to the database??

i have (this is not mine, i just re-wrote it so i can learn it..)

<td><?php include 'caseswitch.php'; ?></td> (index.php)

<?PHP
$conn=mysql_connect(localhost, ****, ******) (caseswitch.php)
$query = "SELECT tac, date ";
$query .= "FROM tac";
$query .= "WHERE date=". $_GET['date'];

mysql_query($query);
?>

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 23 May 2006 - 07:43 PM

You'll want to use mysql_select_db() after mysql_connect().

Info: PHP Manual


#5 NoMansLand

NoMansLand
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 30 May 2006 - 02:46 AM

[img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

well i just put in

<?PHP
$conn=mysql_connect(localhost, ****, ******) //(caseswitch.php)
$query = mysql_select_db(tac)
$query = "SELECT tac, date ";
$query .= "FROM tac";
$query .= "WHERE date=". $_GET['date'];

mysql_query($query);
?>

i had: $conn=mysql_select_db(tac) but they have both come up with

Parse error: parse error, unexpected T_VARIABLE in [a href=\"http://localhost/test/caseswitch.php\" target=\"_blank\"]http://localhost/test/caseswitch.php[/a] on line 3


#6 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 30 May 2006 - 04:05 AM

You're missing the terminating semi-colon on two of your lines. All complete statements [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]MUST[!--colorc--][/span][!--/colorc--] end with a semi-colon (almost) -- the only exception is if the statement is the last one before the closing "?>" tag.

Add the semi-colon on these two lines:
<?PHP
$conn=mysql_connect(localhost, ****, ******); //<-- semi-colon added
$query = mysql_select_db(tac);  // <-- semi-colon added
?>

Ken


#7 NoMansLand

NoMansLand
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 30 May 2006 - 04:57 AM

ok last idiotic question..

is there any tutorials on PHP to make it go

www.mysite.com/view.php?Date=Date


Thanks Kris [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

#8 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 05:05 AM

I don't know exactly what you mean, but if you want to retrieve the value in the URL, use:

$date = $_GET['Date'];
~ D Kuang

#9 NoMansLand

NoMansLand
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 20 June 2006 - 12:11 AM

i got another error on a search page but heres the whole script

This is the error im constantly getting

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\search.php on line 8
Can\t use TAC :

<?php
$host = "localhost";
$user = "****";
$pass = "******";
$dbname = "TAC";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");

$db_selected = mysql_select_db('TAC', $link);
$date = $_GET["date"];
$manager = $_GET["manager"];
$Category = $_GET["Category"];
$quote = $_GET["quote"];
if (!isset($_POST['submit']))
if (!$db_selected) {
die ('Can\t use TAC : ' . mysql_error());
}
?>

#10 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 20 June 2006 - 12:13 AM

Change this:
$db_selected = mysql_select_db('TAC', $link);
To
$db_selected = mysql_select_db('TAC', $connection);

~ D Kuang

#11 NoMansLand

NoMansLand
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 20 June 2006 - 12:21 AM

Last thing is their any tutorials/forums on search pages?

if so can u show the link please (im also checking google!)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users