The Coder Posted July 18, 2012 Posted July 18, 2012 Hi all, I've tried to access someones profile through usersonline, however after clicking on there username from usersonline.php, it strangely opens up in a new tab, can anyone help me out on this one? I just get the feeling the issue is somewhere in here, please correct me if I am wrong, thanks. :) $user=$r['userid']; ?> <tr class='hover' onClick="window.location='viewuser.php?u=<?php echo $user; ?>'"><td><a href="viewuser.php?u=<?php print $user; ?>" target="_blank"><?php print $r['username']; ?> [<?php echo $r['userid']; ?>]</a></td> <td><?php echo $la; ?> <?php print $unit; ?></td></tr> <?php } Quote
Seker Posted July 18, 2012 Posted July 18, 2012 Hi all, I've tried to access someones profile through usersonline, however after clicking on there username from usersonline.php, it strangely opens up in a new tab, can anyone help me out on this one? I just get the feeling the issue is somewhere in here, please correct me if I am wrong, thanks. :) $user=$r['userid']; ?> <tr class='hover' onClick="window.location='viewuser.php?u=<?php echo $user; ?>'"><td><a href="viewuser.php?u=<?php print $user; ?>" target="_blank"><?php print $r['username']; ?> [<?php echo $r['userid']; ?>]</a></td> <td><?php echo $la; ?> <?php print $unit; ?></td></tr> <?php } Take this out: target="_blank" Quote
The Coder Posted July 18, 2012 Author Posted July 18, 2012 Thank you so much! :) And, sorry to bother everyone with such a minor matter. :) Quote
The Coder Posted July 18, 2012 Author Posted July 18, 2012 (edited) Hey also, I keep getting this error:- Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/public_html/staffapps.php on line 10 This is line ten:- ><a href="index.php" >Go Home</a>"; Anyone know the issue? Many thanks! :) Edited July 18, 2012 by The Coder Took away "Blank" thingy and "Https" :P Quote
Seker Posted July 18, 2012 Posted July 18, 2012 Hey also, I keep getting this error:- Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/public_html/staffapps.php on line 10 This is line ten:- ><a href="index.php" >Go Home</a>"; Anyone know the issue? Many thanks! :) It looks like it's because you're using double quotes to wrap both your string and your echo/print. For example, it should be either this: print "<a href='index.php'>Go Home</a>"; Or this: print '<a href="index.php">Go Home</a>'; But neither of these two: print "<a href="index.php">Go Home</a>"; print '<a href='index.php'>Go Home</a>'; See the differences? Quote
KyleMassacre Posted July 19, 2012 Posted July 19, 2012 Yeah you should probably post a line or two above the line giving the so called error as most of the time its not that line with that kind of error Quote
The Coder Posted July 19, 2012 Author Posted July 19, 2012 Hey Seker, unfortunately I get the same error with both codes you have supplied for me. :( Also, sorry about that Kyle here is some of the code before and after line 10. :) require "globals.php"; if($set['stafflock'] == 'Locked') { echo "Staff Applications are locked at the moment, please try again later. ><a href="index.php" >Go Home</a>"; $h->endpage(); exit; } echo "<h3>Staff Applications</h3>"; $_POST['ID'] = abs((int) $_POST['ID']); if($_POST['ID']) Quote
Uridium Posted July 19, 2012 Posted July 19, 2012 to solve your T_STRING error as mentioned by SEKER whos Edits were correct you can do this one of 2 ways to fix it... require "globals.php"; if($set['stafflock'] == 'Locked'){ echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>"; $h->endpage();exit;}echo "<h3>Staff Applications</h3>"; $_POST['ID'] = abs((int) $_POST['ID']); if($_POST['ID']) or require "globals.php"; if($set['stafflock'] == 'Locked'){ echo "Staff Applications are locked at the moment, please try again later.><a href='index.php' >Go Home</a>"; $h->endpage();exit;}echo "<h3>Staff Applications</h3>"; $_POST['ID'] = abs((int) $_POST['ID']); if($_POST['ID']) Remember at all times if your echo or print starts with a " or a ' when you end out your echo or print you need to use the same method as you did to start with. example THIS WILL CREATE AN ERROR print " how are you world '; echo " how are you world '; the reason for this is because you started both statements with a " and ended it with a ' However you can use more than 1 " in a statement but you need to block the next " so the script doesnt think its finished ecample echo "we are here <a href="index.php">HERE</a>"; <<<<< will cause an error cos you have 4 " statements and it thinks the second " is the closing out statement so to cure this you can simply do this echo "we are here <a href=\"index.php\">HERE</a>"; <<<< the use of the \ tells the script you havent quite finished yet so carry on... Quote
Seker Posted July 19, 2012 Posted July 19, 2012 However you can use more than 1 " in a statement but you need to block the next " so the script doesnt think its finished ecample echo "we are here <a href="index.php">HERE</a>"; <<<<< will cause an error cos you have 4 " statements and it thinks the second " is the closing out statement so to cure this you can simply do this echo "we are here <a href=\"index.php\">HERE</a>"; <<<< the use of the \ tells the script you havent quite finished yet so carry on... I actually didn't know you can do it this way. Though, I don't know why anyone would want to. It's a lot messier, in my opinion. Quote
Uridium Posted July 19, 2012 Posted July 19, 2012 the use of the \ comes in handy sometimes when achieving mass editing especially where links are concerned Quote
The Coder Posted July 19, 2012 Author Posted July 19, 2012 (edited) to solve your T_STRING error as mentioned by SEKER whos Edits were correct you can do this one of 2 ways to fix it... require "globals.php"; if($set['stafflock'] == 'Locked'){ echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>"; $h->endpage();exit;}echo "<h3>Staff Applications</h3>"; $_POST['ID'] = abs((int) $_POST['ID']); if($_POST['ID']) or require "globals.php"; if($set['stafflock'] == 'Locked'){ echo "Staff Applications are locked at the moment, please try again later.><a href='index.php' >Go Home</a>"; $h->endpage();exit;}echo "<h3>Staff Applications</h3>"; $_POST['ID'] = abs((int) $_POST['ID']); if($_POST['ID']) Remember at all times if your echo or print starts with a " or a ' when you end out your echo or print you need to use the same method as you did to start with. example THIS WILL CREATE AN ERROR print " how are you world '; echo " how are you world '; the reason for this is because you started both statements with a " and ended it with a ' However you can use more than 1 " in a statement but you need to block the next " so the script doesnt think its finished ecample echo "we are here <a href="index.php">HERE</a>"; <<<<< will cause an error cos you have 4 " statements and it thinks the second " is the closing out statement so to cure this you can simply do this echo "we are here <a href=\"index.php\">HERE</a>"; <<<< the use of the \ tells the script you havent quite finished yet so carry on... Thanks but after doing this, I get this error:- Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/gothcent/public_html/staffapps.php on line 25 With these codes:- require "globals.php"; if($set['stafflock'] == 'Locked'){ echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>"; $h->endpage();exit;}echo "<h3>Staff Applications</h3>"; $_POST['ID'] = abs((int) $_POST['ID']); if($_POST['ID']) { $sql = sprintf('SELECT COUNT(ID) AS `count` FROM `staffaps` WHERE ID = %u', $userid); $sql = $db->query($sql); $gaps = $db->fetch_row($sql); if($gaps['count']) { echo "Invalid Command. You already have submitted a application. ><a href="index.php" >Go Home</a>"; [LINE 25] $h->endpage(); exit; } else if(!$gaps['count']) { $_POST['staff'] = abs((int) $_POST['staff']); $_POST['about'] = mysql_real_escape_string(htmlentities($_POST['about'])); $_POST['exp'] = mysql_real_escape_string(htmlentities($_POST['exp'])); if(strlen($_POST['about']) > 75 OR strlen($_POST['exp']) > 75) { :( Btw I stated where line 25 is in the codes. Edited July 19, 2012 by The Coder Quote
Seker Posted July 19, 2012 Posted July 19, 2012 Thanks but after doing this, I get this error:- Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/gothcent/public_html/staffapps.php on line 25 With these codes:- require "globals.php"; if($set['stafflock'] == 'Locked'){ echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>"; $h->endpage();exit;}echo "<h3>Staff Applications</h3>"; $_POST['ID'] = abs((int) $_POST['ID']); if($_POST['ID']) { $sql = sprintf('SELECT COUNT(ID) AS `count` FROM `staffaps` WHERE ID = %u', $userid); $sql = $db->query($sql); $gaps = $db->fetch_row($sql); if($gaps['count']) { echo "Invalid Command. You already have submitted a application. ><a href="index.php" >Go Home</a>"; [LINE 25] $h->endpage(); exit; } else if(!$gaps['count']) { $_POST['staff'] = abs((int) $_POST['staff']); $_POST['about'] = mysql_real_escape_string(htmlentities($_POST['about'])); $_POST['exp'] = mysql_real_escape_string(htmlentities($_POST['exp'])); if(strlen($_POST['about']) > 75 OR strlen($_POST['exp']) > 75) { :( Btw I stated where line 25 is in the codes. You still haven't even fixed it. Change this: <a href="index.php" >Go Home</a>"; To this: <a href='index.php' >Go Home</a>"; Quote
The Coder Posted July 19, 2012 Author Posted July 19, 2012 Hey thanks, it works now, but another two issues, and also I'm so sorry to bother you all, but I really need mod working for the game. :) I get an error for both of these SQL's:- CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` int(11) NOT NULL default '0', `about` text NOT NULL, `exp` text NOT NULL, `position` int(11) NOT NULL default '0' ); Error with the above SQL:- #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`ID` int(11) NOT NULL default '0', Â Â `about` text NOT NULL, Â Â `exp` text NOT' at line 2 And 2nd SQL - INSERT INTO `settings` ( `conf_id` , `conf_name` , `conf_value` ) VALUES ( '17', 'stafflock', 'Locked' ); Error with 2nd SQL - #1062 - Duplicate entry '17' for key 'PRIMARY' Thanks to all who help me. :) Quote
Seker Posted July 19, 2012 Posted July 19, 2012 Maybe for the first SQL: CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` int(11) NOT NULL default '0', `about` varchar(max) NOT NULL, `exp` varchar(max) NOT NULL, `position` int(11) NOT NULL default '0' ); Though, I do not know why text wouldn't work. For the second SQL: INSERT INTO `settings` ( `conf_id` , `conf_name` , `conf_value` ) VALUES ( 'NULL', 'stafflock', 'Locked' ); Quote
The Coder Posted July 19, 2012 Author Posted July 19, 2012 Didn't work mate. :( Errors received - SQL 1 error - #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`ID` int(11) NOT NULL default '0', Â Â `about` varchar(max) NOT NULL, Â Â `exp` ' at line 2 SQL 2 error - #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`conf_id` , Â Â Â Â Â Â Â Â `conf_name` , Â Â Â Â Â Â Â Â `conf_value` ) VALUES ' at line 3 Anyone have a clue whats wrong lol? Thanks Seker for trying. :) Quote
Djkanna Posted July 19, 2012 Posted July 19, 2012 Didn't work mate. :( Errors received - SQL 1 error - #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`ID` int(11) NOT NULL default '0', Â Â `about` varchar(max) NOT NULL, Â Â `exp` ' at line 2 SQL 2 error - #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`conf_id` , Â Â Â Â Â Â Â Â `conf_name` , Â Â Â Â Â Â Â Â `conf_value` ) VALUES ' at line 3 Anyone have a clue whats wrong lol? Thanks Seker for trying. :) Try; CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` INT(11) NOT NULL DEFAULT 0, `about` TEXT NOT NULL, `exp` TEXT NOT NULL, `position` INT(11) NOT NULL DEFAULT 0, #Probably don't need int(11) but hey. ); INSERT INTO `settings` ( `conf_id`, `conf_name`, `conf_value`) VALUES (null, 'stafflock', 'Locked'); Quote
The Coder Posted July 19, 2012 Author Posted July 19, 2012 Try; CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` INT(11) NOT NULL DEFAULT 0, `about` TEXT NOT NULL, `exp` TEXT NOT NULL, `position` INT(11) NOT NULL DEFAULT 0, #Probably don't need int(11) but hey. ); INSERT INTO `settings` ( `conf_id`, `conf_name`, `conf_value`) VALUES (null, 'stafflock', 'Locked'); Thanks for trying, but I get another sort of error this time:- "SQL query: CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` INT( 11 ) NOT NULL DEFAULT 0, `about` TEXT NOT NULL , `exp` TEXT NOT NULL , `position` INT( 11 ) NOT NULL DEFAULT 0, #Probably don't need int(11) but hey. ); MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`ID` INT(11) NOT NULL DEFAULT 0, Â Â Â Â `about` TEXT NOT NULL, Â Â Â Â `exp` TE' at line 2" Once again, thanks for trying, and this seems to be a picky one eh all? :/ Quote
Seker Posted July 19, 2012 Posted July 19, 2012 Thanks for trying, but I get another sort of error this time:- "SQL query: CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` INT( 11 ) NOT NULL DEFAULT 0, `about` TEXT NOT NULL , `exp` TEXT NOT NULL , `position` INT( 11 ) NOT NULL DEFAULT 0, #Probably don't need int(11) but hey. ); MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`ID` INT(11) NOT NULL DEFAULT 0, Â Â Â Â `about` TEXT NOT NULL, Â Â Â Â `exp` TE' at line 2" Once again, thanks for trying, and this seems to be a picky one eh all? :/ After NOT NULL on the `about` and `exp` lines, you have a space before the comma. Could be messing with it, maybe. Quote
The Coder Posted July 19, 2012 Author Posted July 19, 2012 After NOT NULL on the `about` and `exp` lines, you have a space before the comma. Could be messing with it, maybe. Thanks, but nothing. :( Quote
newttster Posted July 19, 2012 Posted July 19, 2012 Maybe try changing ID to staffaps ID. Perhaps there is a conflict with the field name ID??? Have you set an increment for the ID? Or a key? Quote
Djkanna Posted July 19, 2012 Posted July 19, 2012 Thanks for trying, but I get another sort of error this time:- "SQL query: CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` INT( 11 ) NOT NULL DEFAULT 0, `about` TEXT NOT NULL , `exp` TEXT NOT NULL , `position` INT( 11 ) NOT NULL DEFAULT 0, #Probably don't need int(11) but hey. ); MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`ID` INT(11) NOT NULL DEFAULT 0, Â Â Â Â `about` TEXT NOT NULL, Â Â Â Â `exp` TE' at line 2" Once again, thanks for trying, and this seems to be a picky one eh all? :/ CREATE TABLE IF NOT EXISTS `staffaps` ( `ID` INT(11) NOT NULL DEFAULT 0, `about` TEXT NOT NULL, `exp` TEXT NOT NULL, `position` INT(11) NOT NULL DEFAULT 0 #Probably don't need int(11) but hey. ); Seems to work fine. Quote
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.