Jump to content

parse error unexpected t_string


Digitry Designs

Recommended Posts

Hello,

    I am struggling with this. I am trying to create a list box that is populated by a mysql data base. I am running this script alone to figure it out before I add it to my working form.

 

I keep getting this error:

 

Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\list\list.php on line 10

 

I believe it has something to do with $result but why?

<?php

mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("time_sheets") or die(mysql_error());

$result = @mysql_query("SELECT jobs FROM job");

print "<p>Select a Job:\n";
print "<select name="jobs">\n";
while ($row = mysql_fetch_assoc($result))
{
$jobs = $row['jobs'];
print "<option value=$jobs>\n";
}
print "</select>\n";
print "</p>\n";

?>

 

can anyone help me with this. I am complete newb so explinations as simple as possible are extremely welcome, however, all help is very appreciated. Thank you in advance.

 

Link to comment
https://forums.phpfreaks.com/topic/189668-parse-error-unexpected-t_string/
Share on other sites

okay

if i do this

echo "Hello World";

PHP echos the string between the quotes,

 

BUT

echo "Hello "world"";

doesn't make sense! so i need to tell PHP that some of the quotes i wish to echo, to do this i "escape them" with the slash

echo "Hello \"world\"";

you could also use single quotes

ie

echo 'Hello "world" ';

okay

if i do this

echo "Hello World";

PHP echos the string between the quotes,

 

BUT

echo "Hello "world"";

doesn't make sense! so i need to tell PHP that some of the quotes i wish to echo, to do this i "escape them" with the slash

echo "Hello \"world\"";

you could also use single quotes

ie

echo 'Hello "world" ';

 

Thank you very much!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.