Jump to content
xisto Community
Sign in to follow this  
Hamtaro

What Is A T_string? Please help Im new at PHP Programming

Recommended Posts

Parse error: syntax error, unexpected T_STRING in /home/fouwellb/ ... on line 20

 

What Is A T_string?

 

 

 

This is the contents of the referenced file. Line 20 is the one that begins with $noquery=" (the first one). Where do I err? (the variables, except "localhost", are substituted and exist)

 

<?

$hostname = "localhost";

$username = "username";

$passwordsc = "password";

$dbName = "database";

 

MYSQL_CONNECT($hostname, $username, $passwordsc) OR DIE("Unable to connect to database");

 

/* Select the database name to be used or else print error message if unsuccessful*/

 

@mysql_select_db( "$dbName") or die( "Unable to select database");

 

$noquery=" or die("SQL Error Occurred : ".Mysql_error().':'.$query)";

$noquery1=" or die("SQL Error Occurred : ".Mysql_error().':'.$query1)";

$noquery2=" or die("SQL Error Occurred : ".Mysql_error().':'.$query2)";

 

$ipaddress=getenv("remote_addr");

?>

 

-question by starcity

What about to remove all that $noqueries because you don't need them,MYSQL is very simple.I haven't time now to look good at the line,i have work,try to remove the @ and all that noqueries.Hope that will fix your code.

Share this post


Link to post
Share on other sites

I have this error: Parse error: syntax error, unexpected T_STRING in /home/a1943654/public_html/login.php on line 19

And this is the code:

<?php//Database Information$dbhost = "mysql8.000webhost.com";$dbname = "a1943654_test";$dbuser = "a1943654_test";$dbpass = "hounds123";//Connect to databasemysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());mysql_select_db($dbname) or die(mysql_error());session_start();$username = $_POST[username];$password = md5($_POST[password]);$query = select * from users where username=$username and password=$password);$result = mysql_query($query);if (mysql_num_rows($result) != 1) {$error = Bad Login;    include login.html;} else {    $_SESSION[username] = $username;    include memberspage.php;}?>

Can you please help?

Share this post


Link to post
Share on other sites

Getting the same problem.Parse error: Syntax error, unexpected T_STRING in /home/homeb780/public_html/adminpanel/sql.php on line 11.)$result = mysql_query("CREATE TABLE ".TABLE_PREFIX."area_mst (area_id int(11) NOT NULL auto_increment, area_name varchar(100) NOT NULL default '', PRIMARY KEY (area_id)) TYPE=MyISAM;")or die("<b><span style=\"red\">DB TABLE ERROR:</span></b><br /><b>Problem:</b><br />".mysql_error()."<br />");

Share this post


Link to post
Share on other sites

Same here.

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a2171553/public_html/PHP Lessons/8_Souvenir_Christian_Chapter 1_PHP/Lab1-2/Lab1-2.php on line 12

 

<?php

echo "<table class=\"table\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\">";

echo "<tr><td class=\"headingCell\" colspan=\"2\" valign=\"top\">Outputting Dynamic Content</td></tr>";

echo "<tr><td class=\"leftCell\" valign=\"top\">Date</td><td class=\"contentCell\" valign=\"top\">gmdate("F d y")</td></tr>";

echo "<tr><td class=\"leftCell\" valign=\"top\">Time Zone</td><td class=\"contentCell\" valign=\"top\">gmdate("T")</td></tr>";

echo "<tr><td class=\"leftCell\" valign=\"top\">Day of Year</td><td class=\"contentCell\" valign=\"top\">gmdate("z")</td></tr>";

echo "<tr><td class=\"leftCell\" valign=\"top\">Full Year</td><td class=\"contentCell\" valign=\"top\">gmdate("Y")</td></tr>";

echo "<tr><td class=\"leftCell\" valign=\"top\">Seconds since<br>midnight January 1, 1970 (epoch)</td><td class=\"contentCell\" valign=\"top\">gmdate("U")</td></tr>";

echo "<tr><td class=\"leftCell\" valign=\"top\">Time</td><td class=\"contentCell\" valign=\"top\">gmdate("h i")</td></tr>";

echo "</table>";

?>

 

Please help me.

Christian

Share this post


Link to post
Share on other sites

Here is my code for trying to provide a loop for squares. Can anybody help?

<?php
$startNum = $_POST['startNum'];
$endNum = $_POST['endNum'];
$increment = $_POST['increment'];

print ("<h1>SQUARES</h1>");

for ("$startNum = 0; $startnum <= 100; $startNum = 2 );
{
print ("The square of $startNum is ");
}
$end

?>

 

 

 

Parse error: syntax error, unexpected T_STRING, expecting ';' in G:xampplitehtdocsWebtechcourseworkChapter09C9Homeworksquares2.php on line 24

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.