Jump to content

Php error - Parse error


Mythiel

Recommended Posts

Ive posted a problem last week on the first part of this project I'm working on in the sql forum page, and first off would like to say thanks for the help from those who helped me solved that problem, but now into the second part ive run into another snag. This is part of a Php web form that works with MySQL through PhpMyAdmin, where the first part is the actual form and the second part is a web page to display the info collected from the form in the database. However, the 'Form Viewer' as i call it is showing this error:

"Parse error: syntax error, unexpected ',', expecting T_PAAMAYIM_NEKUDOTAYIM in /smarthosting/content/f/fslj0004/.website4166/FormViewer.php on line 35"

Now i assume this is a php code error hence why i have posted here now rather than in the sql section, but let me know if i am wrong.

 

Here is the code (keep in mind this is just a template to just get things working, graphics and proper styling will come later):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>


<?php

if( $_GET['id'] )
{
$query = 'SELECT contactss_first,
		contactss_last,
		contactss_company,
		contactss_adress,
		contactss_city,
		contactss_province,
		contactss_country,
		contactss_postal,
		contactss_phone,
		contactss_fax,
		contactss_email,
		contactss_cme,
		contactss_info,
		contactss_date
	FROM contactss
	WHERE contactss_id = "'.$_GET['id'].'"
	LIMIT 1';
$result = mysql_query( $query, $connect ) 
	or die( mysql_error() );

list( contactss_first,contactss_last,contactss_company,contactss_adress,contactss_city,contactss_province,contactss_country,contactss_postal,contactss_phone,contactss_fax,contactss_email,contactss_cme,contactss_info,contactss_date ) = mysql_fetch_row( $result );		



echo '    <table width="1024" height="277" border="0">';
echo '  <tr>';
echo '    <td width="104" height="20">Contact #</td>';
echo '    <td width="143">'.$contactss_id.'</td>';
echo '    <td width="59"> </td>';
echo '    <td width="132"> </td>';
echo '    <td width="89"> </td>';
echo '    <td width="202"> </td>';
echo '    <td width="78"> </td>';
echo '    <td width="183"> </td>';
echo '  </tr>';
echo '  <tr>';
echo '    <td height="20">First Name</td>';
echo '    <td>'.$contactss_first.'</td>';
echo '    <td>City</td>';
echo '    <td>'.$contactss_city.'</td>';
echo '    <td>Adress</td>';
echo '    <td>'.$contactss_adress.'</td>';
echo '    <td>Phone #</td>';
echo '    <td>'.$contactss_phone.'</td>';
echo '  </tr>';
echo '  <tr>';
echo '    <td height="20">Last Name</td>';
echo '    <td>'.$contactss_last.'</td>';
echo '    <td>Province</td>';
echo '    <td>'.$contactss_province.'</td>';
echo '    <td>Postal Code</td>';
echo '    <td>'.$contactss_postal.'</td>';
echo '    <td>Fax #</td>';
echo '    <td>'.$contactss_fax.'</td>';
echo '  </tr>';
echo '  <tr>';
echo '    <td height="20">Company Name</td>';
echo '    <td>'.$contactss_company.'</td>';
echo '    <td>Country</td>';
echo '    <td>'.$contactss_country.'</td>';
echo '    <td>Email</td>';
echo '    <td>'.$contactss_email.'</td>';
echo '    <td>Contact by</td>';
echo '    <td>'.$contactss_cme.'</td>';
echo '  </tr>';
echo '  <tr>';
echo '    <td height="9"> </td>';
echo '    <td height="20" colspan="7" rowspan="2"> </td>';
echo '    </tr>';
echo '  <tr>';
echo '    <td height="9">Message</td>';
echo '  </tr>';
echo '  <tr>';
echo '    <td height="141" colspan="8">'.$contactss_info.'</td>';
echo '  </tr>';
echo '</table><br /><br />';
    
    	

}
else
{
$query = 'SELECT contactss_id,
		contactss_first,
		contactss_last
	FROM contactss 
	ORDER BY contactss_id';
$result = mysql_query( $query, $connect ) 
	or die( mysql_error() );

$rows = mysql_num_rows( $result );

for( $i = 0; $i < $rows; $i ++ )
{
	list( $contactss_id,$contactss_first,
		$contactss_last ) = mysql_fetch_row( $result );

	echo '<a href="FormViewer.php?id='.$contactss_id.'">'.$contactss_first.'_'.$contactss_last.'</a>';
	echo ' - '.$contactss_date;
	echo '<hr />';
}
}

?>




</body>
</html>

 

Link to comment
Share on other sites

list( contactss_first,contactss_last,contactss_company,contactss_adress,contactss_city,contactss_province,contactss_country,contactss_postal,contactss_phone,contactss_fax,contactss_email,contactss_cme,contactss_info,contactss_date ) = mysql_fetch_row( $result );

 

None of the list vars have a $, so the parser was expecting a T_PAAMAYIM_NEKUDOTAYIM which is :: as in a static class var like contactss_first::$somevar.

Link to comment
Share on other sites

Awsome, that did the trick (can't believe i forgot to put in those '$' marks) but now that ive taken care of that error ive gotten a new one stating:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /smarthosting/content/f/fslj0004/.website4166/FormViewer.php on line 103

 

I did some searching around and found that the most common problem causing this is a incorrect/missmatched field value or something. Now this doesn't seem like a Php error but a mysql error. Either way can anyone see what i am missing (i tend to overlook these small mistakes but im learning to find them  :D)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.