English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have been racking my brain and searching for answers all f@*%'in day! Working with PHP 4.1.2 and MySQL 3.23.53 using Dreamweaver 8

Here is my code:

define('DBLOGIN_ID', 'db020024063');
define('DBPASSWORD', '20024063');
define('DBHOST', 'localhost');
define('DBNAME', 'db020024063');
$DBconn = mysql_connect(DBHOST, DBLOGIN_ID, DBPASSWORD);
$DBselect = mysql_select_db(DBNAME, $DBconn);
$runquery = "SELECT * FROM tbl_employees";
$result = mysql_query($runquery, $DBconn) or die("

Unable to execute the query.

"
. "

Error code: " . mysql_errno()
. "Error: " . mysql_error() . "

");
$row = mysql_fetch_assoc($result);

do {

// here is line 50:

echo " . " " . $row['lname'] . . " " . View . "

";


} while ($row = mysql_fetch_assoc($result));
?>

2006-07-30 12:30:43 · 2 answers · asked by NATALIE S 1 in Computers & Internet Programming & Design

2 answers

It must be an error in your concatenation. Unfortunately, Yahoo! chops off most of your code, but feel free to contact me if you need help.

I am afraid I could not reply as your email address does not appear to be confirmed. However, here is my reply:

==========================================
Indeed, the error is in that line. You quotes are conflicting with each other and sometimes missing altogether. Try this:

echo ''
. $row['lname'] . '


View

';

Note that each quote is ended with a finishing quote before each concatenation operator. And also notice that the single and double quotes do not conflict with each other.

It is an interesting tidbit to know that single quotes in these situations around the strings are just a shade faster than double quotes because double quotes needed to be checked by the PHP parser for variable interpolation.
==========================================

Please make sure to put the above code in one line. I split it up so it could be displayed in its entirety. Also note that the answerer below me also brings up a possibility, that if you want to use double quotes around the string, you can escape the inner double quote with the backslash character.

2006-07-30 12:32:56 · answer #1 · answered by tedjn 3 · 1 0

fedest.com, questions and answers