Click to See Complete Forum and Search --> : What is parse error ???


edhan
09-10-2003, 09:57 AM
Hi

Got this error when executing php:

Parse error: parse error, unexpected $ in /data/web/mydomain/popdisplay.php on line 162


<?php
require "config.php";
$dbConnect = mysql_pconnect(null,$dbUserName ,$dbPassword);
if($flag=="1"){

if($MainArea!='SelectOne'){

if($AreaID!='SelectOne'){
?>
<script>
window.opener.top.main.location="display_details.php?area=<? echo urlencode($AreaID); ?>&mes=1";
window.close();
</script>
..................


The config.php is :

<?
$dbUserName = "mysql";
$dbPassword = "mypass";
$dbConnect =0;
//the next two setting items for upload picture
$PicturePath = "/mydomain/UploadPicture/";
$PicturePhysicalPath="/var/www/html/mydomain/UploadPicture/";
$HostIP="192.168.1.118";

function gotoURL($url)
{
echo "<script language='javascript'>" ;
echo "location.href='" . $url . "'";
echo "</script>";
}

function popupMsg($msg)
{
echo "<script language='javascript'>" ;
echo "alert('" . $msg . "')";
echo "</script>";
}

function gotoBack()
{
echo "<script language='javascript'>" ;
echo "history.back()";
echo "</script>";
}

function gotoFrameURL($index,$url)
{
echo "<script language='javascript'>" ;
echo "window.frames(" . $index . ").location.href='" . $url . "'";
echo "</script>";
}

?>

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

Any idea? When I execute other php codes, it simply shows the codes instead of the graphic mode.

Please advice!

Thank you.

Regards
Edward Han

mrBen
09-10-2003, 10:19 AM
Which line in line 162? And the few lines before that? Check for missing )

Parse error is basically the first check to make sure that the code at least looks correct.

edhan
09-10-2003, 11:05 AM
Hi

This is an existing codes that are working. I have tried it in other server, it is working fine. I am trying to setup my own server under RH8.0 but does not seem to work.

It is getting on my nerve! I am using Apache version 2.0.40 and the php version 4.2.2-8.0.5. I have installed php, php-server, webmin, vsftpd and apache. What else do I need to make it works?

Thanks!

Regards
Edward Han

mairving
09-10-2003, 02:16 PM
It doesn't have anything to do with the config.php file. The error is on line 162 of popdisplay.php. What is on this line? If the script was worked on another server and is not after you transferred it, the most probable cause would be corruption during ftp transfer. Upload the file again as ascii to see if this fixes it.

Also which version of Apache is running on the working server? There are a lot of problems with Apache 2.0 and Php.

theN
09-11-2003, 08:06 AM
Hi

Shouldn't mysql_pconnect have the hostname/hostIP as an argument?

mysql_pconnect(null,$dbUserName ,$dbPassword); .
Does it actually work with null?

regards
theN

edhan
09-11-2003, 08:25 AM
Hi Mairving

The popdisplay.php and the line 162 is </html>. Here is the last few lines before 162.

</tr>
</table>
</td>
</tr>
</table>
</form>

</body>
</html>

From what I see, the popdisplay.php runs through the entire line but gave error after that. I can't see the reason why it happens.

Hi theN

You mean I cannot test locally with mysql_pconnect? I mean that can my Server be tested with local testing for the database access?

Regards
Edward Han

mairving
09-11-2003, 08:58 AM
Originally posted by edhan
Hi Mairving

The popdisplay.php and the line 162 is </html>. Here is the last few lines before 162.

</tr>
</table>
</td>
</tr>
</table>
</form>

</body>
</html>

From what I see, the popdisplay.php runs through the entire line but gave error after that. I can't see the reason why it happens.

Is there a while statement in popdisplay.php. Oftentimes the last line is listed as a parse error if you have an open { without a closing }.
Originally posted by edhan

Hi theN

You mean I cannot test locally with mysql_pconnect? I mean that can my Server be tested with local testing for the database access?

Regards
Edward Han
Null may or may not work. Localhost would be better. I think that it assumes that but to make sure I would always use localhost.

edhan
09-20-2003, 10:00 AM
Hi

Thank you all for your help. I managed to resolve it by using the older version of mysql. It seems that the newer version does not interpret my current database. Maybe it is due to the new features implemented on the new version.

Regards
Edward Han