PDA

View Full Version : MySql PHP


Leabeater
4-6-05, 01:18 PM
:confused: Using Server: mysql06.powweb.com Database: cedatasys Table: inventory

Here is my connection php/MySQL

----------------------------------------

<?php require_once("config/include/utils.runtime6.php") ?>
<?php require_once("config/include/mysql.runtime6.php") ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 6">
<title>CeDataSys Inventory</title>
<?php // GoLive Content Source
$cedatasys = WrapMySQLDatabaseResults("cedatasys", "select * from inventory", "block=1","cedatasys");
?>
</head>


----------------------------------------

But when I try to access http://www.cedatasys.com/inventory.php I'm getting the following error:

Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting T_VARIABLE or '$' in /www/c/cedatasyscom/htdocs/inventory.php on line 32

I Google'd it and found it to be pretty common. Line 32 (as follows)...

<?php $->MoveFirst(); ?>

...is NOT the problem from what I have seen. I think it is the connection strings. But I've checked case sensitivity, am able to test the connection, and able to see the table using other code. For whatever reason the above connection string is a problem.

Ideas? Suggestions? Pontifications? :o

Pig
4-6-05, 05:40 PM
You are not getting database errors, you are getting parse errors. This means the code can't even run because it is not formed correctly. $ is meaningless by itself. It denotes a variable, which follows the $.

So $var -> movefirst(); is fine, but $ -> movefirst(); is not.

Leabeater
4-6-05, 06:33 PM
That got it.

<?php $cedatasys->MoveFirst(); ?>
<?php while (!$cedatasys->EOF()) { ?>

The bad line 32 (first post) was actually left in by GoLive after I referenced the database with the above code. I couldn't figure out why, when I referenced cedatasys, it was not making a change in the source code. A little checking revealed lines 34 and 35 were the above (correct) code while lines 32 and 33 were "garbage" code GoLive failed to remove after the change.

Dunno, might have been me all along - whatever.

Thanks Pig - that little pointer from you ended a full day of fiddling with it (give or take a couple hours). :(