monkeypaw201 Posted July 19, 2008 Share Posted July 19, 2008 Here is the exerpt causing issues: if($_GET['step'] == "4"){ require_once("data.php"); require_once("install.parse.class.php"); mysql_select_db($database_conn_abrv, $conn_abrv); $parseObj = new parsed(); $res = $parseObj->parse("install.sql"); echo "<br><b>Tables Inserted Successfully...</b><br><br><a href='install.php?step=5'>Continue...</a>"; } thats the only thing that throws errors when on install.php?step=4 the error is: Parse error: syntax error, unexpected T_VARIABLE in /home/sites/monkeypaw201.com/public_html/vabase/install.php on line 89 Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/ Share on other sites More sharing options...
MasterACE14 Posted July 20, 2008 Share Posted July 20, 2008 have you got any more code, before this and after? This code looks fine to me. Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594489 Share on other sites More sharing options...
pinacoladaxb Posted July 20, 2008 Share Posted July 20, 2008 Could you show us lines 88-92? Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594496 Share on other sites More sharing options...
monkeypaw201 Posted July 20, 2008 Author Share Posted July 20, 2008 Here is the entire page: <?php // VA Base Installation File // Created By Lorenzo Aiello // Do NOT Modify This File Unless you REALLY know what you are doing if(isset($_GET['step'])){ if($_GET['step'] == "2"){ ?> <form name="form1" method="post" action="install.php?step=3"> <table width="100%" border="0"> <tr> <td>Database Server (Usually Localhost</td> <td><label> <input type="text" name="server" id="server" value="localhost"> </label></td> </tr> <tr> <td>Database Name</td> <td><label> <input type="text" name="database" id="database"> </label></td> </tr> <tr> <td>Database Username</td> <td><label> <input type="text" name="user" id="user"> </label></td> </tr> <tr> <td>Database Password</td> <td><label> <input type="password" name="pass" id="pass"> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="button" id="button" value="Continue"> </label></td> </tr> </table> </form> <?php } if($_GET['step'] == "3"){ echo 'Now creating a configuration file....<br><br>'; $ourFileName = "data.php"; $ourFileHandle = fopen($ourFileName, 'w') or die("<font color='red'>Error creating file</font>"); fclose($ourFileHandle); $myFile = "data.php"; $fh = fopen($myFile, 'w') or die("<font color='red'>Error Writing to file</font>"); $stringData = '<?php ' . "\n" . '$SETTINGS = Array (' . "\n\n"; fwrite($fh, $stringData); $stringData = '$hostname_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['server'] . '"; //database hostname, usually always localhost' . "\n"; fwrite($fh, $stringData); $stringData = '$database_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['database'] . '"; //database name' . "\n"; fwrite($fh, $stringData); $stringData = '$username_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['user'] . '"; // database username' . "\n"; fwrite($fh, $stringData); $stringData = '$password_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['pass'] . '"; // database ' . "\n"; fwrite($fh, $stringData); $stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ' . "\n\n" . ' ); ' . "\n" . ' ?>'; fwrite($fh, $stringData); fclose($fh); echo "File created successfully, <a href='install.php?step=4'>Continue</a>"; } if($_GET['step'] == "4"){ require_once("data.php"); require_once("install.parse.class.php"); mysql_select_db($database_conn_abrv, $conn_abrv); $parseObj = new parsed(); $res = $parseObj->parse("install.sql"); echo "<br><b>Tables Inserted Successfully...</b><br><br><a href='install.php?step=5'>Continue...</a>"; } if($_GET['step'] == "5"){ $myFile = "data.php"; unlink($myFile); echo "Congradulations! You just installed VABase. If you have any issues please let us know. It is necessary for you to delete this file for security purposes."; } } else { echo "You are about to install VABase...<br><br>Are you sure you wish to continue? <a href='install.php?step=2'>Yes, thats what I'm here for...</a>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594499 Share on other sites More sharing options...
MasterACE14 Posted July 20, 2008 Share Posted July 20, 2008 this looks like the problem to me the way the Syntax is being highlighted. $stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ' . "\n\n" . ' ); ' . "\n" . ?>'; Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594502 Share on other sites More sharing options...
monkeypaw201 Posted July 20, 2008 Author Share Posted July 20, 2008 this looks like the problem to me the way the Syntax is being highlighted. $stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ' . "\n\n" . ' ); ' . "\n" . ?>'; The Data.php file saved just fine... Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594503 Share on other sites More sharing options...
monkeypaw201 Posted July 20, 2008 Author Share Posted July 20, 2008 bump Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594547 Share on other sites More sharing options...
JasonLewis Posted July 20, 2008 Share Posted July 20, 2008 Try this: <?php // VA Base Installation File // Created By Lorenzo Aiello // Do NOT Modify This File Unless you REALLY know what you are doing if(isset($_GET['step'])){ if($_GET['step'] == "2"){ ?> <form name="form1" method="post" action="install.php?step=3"> <table width="100%" border="0"> <tr> <td>Database Server (Usually Localhost</td> <td><label> <input type="text" name="server" id="server" value="localhost"> </label></td> </tr> <tr> <td>Database Name</td> <td><label> <input type="text" name="database" id="database"> </label></td> </tr> <tr> <td>Database Username</td> <td><label> <input type="text" name="user" id="user"> </label></td> </tr> <tr> <td>Database Password</td> <td><label> <input type="password" name="pass" id="pass"> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="button" id="button" value="Continue"> </label></td> </tr> </table> </form> <?php } if($_GET['step'] == "3"){ echo 'Now creating a configuration file....<br><br>'; $ourFileName = "data.php"; $ourFileHandle = fopen($ourFileName, 'w') or die("<font color='red'>Error creating file</font>"); fclose($ourFileHandle); $myFile = "data.php"; $fh = fopen($myFile, 'w') or die("<font color='red'>Error Writing to file</font>"); $stringData = '<?php ' . "\n" . '$SETTINGS = Array (' . "\n\n"; fwrite($fh, $stringData); $stringData = '$hostname_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['server'] . '"; //database hostname, usually always localhost' . "\n"; fwrite($fh, $stringData); $stringData = '$database_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['database'] . '"; //database name' . "\n"; fwrite($fh, $stringData); $stringData = '$username_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['user'] . '"; // database username' . "\n"; fwrite($fh, $stringData); $stringData = '$password_conn_abrv'; fwrite($fh, $stringData); $stringData = ' = "' . $_POST['pass'] . '"; // database ' . "\n"; fwrite($fh, $stringData); $stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ' . "\n\n" . ' ); ' . "\n" . '?>'; fwrite($fh, $stringData); fclose($fh); echo "File created successfully, <a href='install.php?step=4'>Continue</a>"; } if($_GET['step'] == "4"){ require_once("data.php"); require_once("install.parse.class.php"); mysql_select_db($database_conn_abrv, $conn_abrv); $parseObj = new parsed(); $res = $parseObj->parse("install.sql"); echo "<br><b>Tables Inserted Successfully...</b><br><br><a href='install.php?step=5'>Continue...</a>"; } if($_GET['step'] == "5"){ $myFile = "data.php"; unlink($myFile); echo "Congradulations! You just installed VABase. If you have any issues please let us know. It is necessary for you to delete this file for security purposes."; } } else { echo "You are about to install VABase...<br><br>Are you sure you wish to continue? <a href='install.php?step=2'>Yes, thats what I'm here for...</a>"; } ?> I noticed a missing ' Hopefully it fixes it. Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594553 Share on other sites More sharing options...
monkeypaw201 Posted July 20, 2008 Author Share Posted July 20, 2008 no change :'( Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594558 Share on other sites More sharing options...
JasonLewis Posted July 20, 2008 Share Posted July 20, 2008 Okay, what line is the error one? Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594563 Share on other sites More sharing options...
monkeypaw201 Posted July 20, 2008 Author Share Posted July 20, 2008 Okay, what line is the error one? Parse error: syntax error, unexpected ';', expecting ')' in /home/sites/monkeypaw201.com/public_html/vabase/data.php on line 4 It says 4 so i assume line 4 of active code which would be if u could lines mysql_select_db($database_conn_abrv, $conn_abrv); or this: if you could PHP lines $parseObj = new parsed(); Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594566 Share on other sites More sharing options...
JasonLewis Posted July 20, 2008 Share Posted July 20, 2008 Check data.php and install.parse.class.php, they may be throwing the error. Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594568 Share on other sites More sharing options...
monkeypaw201 Posted July 20, 2008 Author Share Posted July 20, 2008 data.php is throwing same error <?php $SETTINGS = Array ( $hostname_conn_abrv = "localhost"; //database hostname, usually always localhost $database_conn_abrv = "name"; //database name $username_conn_abrv = "user"; // database username $password_conn_abrv = "pass"; // database $conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ); ?> Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594575 Share on other sites More sharing options...
MadTechie Posted July 20, 2008 Share Posted July 20, 2008 <?php $SETTINGS = Array ( $hostname_conn_abrv = "localhost"; //database hostname, usually always localhost $database_conn_abrv = "name"; //database name $username_conn_abrv = "user"; // database username $password_conn_abrv = "pass"; // database ); //whats the above doing!!! thats not valid! //move it out of the array! $conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ?> Try this instead! <?php $SETTINGS = Array ( "hostname_conn_abrv" => "localhost", //database hostname, usually always localhost "database_conn_abrv" => "name", //database name "username_conn_abrv" => "user", // database username "password_conn_abrv" => "pass" // database ); $conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ?> Or more likly <?php $hostname_conn_abrv = "localhost"; //database hostname, usually always localhost $database_conn_abrv = "name"; //database name $username_conn_abrv = "user"; // database username $password_conn_abrv = "pass"; // database $conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594578 Share on other sites More sharing options...
JasonLewis Posted July 20, 2008 Share Posted July 20, 2008 Yeah, what Techie said. You were creating the array incorrectly. Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594582 Share on other sites More sharing options...
monkeypaw201 Posted July 20, 2008 Author Share Posted July 20, 2008 output: ?php $SETTINGS = Array ( "hostname_conn_abrv" => "localhost", //database hostname, usually always localhost "database_conn_abrv" => "name", //database name "username_conn_abrv" => "user", // database username "password_conn_abrv" => "pass" // database ); $conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ?> Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/sites/monkeypaw201.com/public_html/vabase/install.php on line 137 Tables Inserted Successfully... Continue... Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594583 Share on other sites More sharing options...
MadTechie Posted July 20, 2008 Share Posted July 20, 2008 Erm.. missing the starting < of <?php maybe..! Quote Link to comment https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/#findComment-594587 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.