$content = mysql_query("SELECT * FROM 'content' WHERE 'purl' = "$purl"", $DBCNX);
I am getting this error for the above line. Parse error: syntax error, unexpected T_VARIABLE
I have been trying to figure it out and can't any ideas? I'm new a this.
I can post more if it will help
PHP & mySQL Query
Moderator: General Moderators
Re: PHP & mySQL Query
Column/table names in MySQL are surrounded with the ` symbol, not like the MS SQL - the ' symbol.
Also string concatenation is done this way:
Also string concatenation is done this way:
Code: Select all
$string2 = "You are looking at " . $string1 . " - the first string value concatenated"There are 10 types of people in this world, those who understand binary and those who don't
Re: PHP & mySQL Query
It seems like everyone has a different syntax. Some people say to put periods before variables ... does that do anything besides cause more errors. Some of the simplest things there are about 5 different ways people write it varying ) ' . " ] all in different places. (I'm speaking of people not on this forum)
So the above post helped get rid of the errors but I still can't get anything to show up from the data base.
Is their any issues with any of this?
cnx.php
So the above post helped get rid of the errors but I still can't get anything to show up from the data base.
Is their any issues with any of this?
Code: Select all
<?php require_once("cnx.php");
mysql_select_db("DBname", $DBCNX);
$content = mysql_query("SELECT * FROM 'content' WHERE 'purl' = '$purl'", $DBCNX);
mysql_close($DBCNX);
?>
<title>
<?php if ($purl == "index") {
echo $content[title]; echo "Static Title Home Page.";
} else {
echo $content[title]; echo "Static Title";
}
?>
</title>Code: Select all
<?php
$DB_HOST = 'localhost';
$DB_USER = 'hpread';
$DB_PW = 'sdfsdfsdfsdf';
$DBCNX = mysql_connect($DB_HOST, $DB_USER, $DB_PW);
if (!$DBCNX)
{
die('Could not connect: ' . mysql_error());
}
?>Re: PHP & mySQL Query
VladSun wrote:Column/table names in MySQL are surrounded with the ` symbol, not like the MS SQL - the ' symbol.
There are 10 types of people in this world, those who understand binary and those who don't