PHP Retrieve data from DB Table
I'd like to retrieve player results from a table in my vbulletin database table called _vbullthread. The results would ultimately print to the players own page.
I'm using this script (below) to retrieve the info but the script breaks after I try to run it. There is only one field in the table which has the info the script needs. It is the "Title" field. All values in said field within the database are entered like this....... Bob Smith vs John Doe May 2, 2001 Sports team vs Sports team
PHP Code:
<html>
<head>
<title>Player Info</title>
</head>
<body>
<?php
//connect to the database
mysql_connect ("10.x.x.x","username","pw") or die ('Cannot connect to MySQL: ' . mysql_error());
mysql_select_db ("database_name") or die ('Cannot connect to the database: ' . mysql_error());
//query
$query = mysql_query("select name_Bob, name_smith from _vbullthread") or die ('Query is invalid: ' . mysql_error());
//write the results
while ($row = mysql_fetch_array($query)) {
echo $row['name_first'] . " " . $row['name_last'] . "
";
// close the loop
}
?>
</body>
</html>
This script isn't working. I keep getting this message:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/x/o/v/owner/html/bob_smith.php(47) : eval()'d code on line 21