Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
whats wrong with my coding????
Old 01-09-2003, 03:45 AM whats wrong with my coding????
Digital-SyntaX's Avatar
Average Talker

Posts: 15
Location: Perth, Australia
Trades: 0
<td bgcolor=\"899CB8\" class=\"size12vdarkblue\"


onMouseOver=\"this.style.backgroundColor='#6981A5' ;\"
onMouseOut=\"this.style.backgroundColor='#899CB8'; \" >

error message :

Parse error: parse error, unexpected '\"' in c:\program files\apache group\apache\htdocs\admin\pasta\nfl\draigh\update_ scripts.php on line 151


i know this is the coding that is wrong

could someone tell me what's wrong?
Digital-SyntaX is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-09-2003, 06:05 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Trades: 0
Should be:
echo('<td bgcolor="#899CB8" class="size12vdarkblue" onMouseOver="this.style.backgroundColor=\'#6981A5\ ';" onMouseOut="this.style.backgroundColor=\'#899CB8\' ;">');

I think that is the best way.
-dk
__________________
Did I help you? If so, be nice and throw me some
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
dk01 is offline
Reply With Quote
View Public Profile
 
Old 01-09-2003, 08:20 AM
Digital-SyntaX's Avatar
Average Talker

Posts: 15
Location: Perth, Australia
Trades: 0
i have it so that it is a variable

************
$updatingcode = '<td bgcolor="#899CB8" class="size12vdarkblue" onMouseOver="this.style.backgroundColor=\'#6981A5\ ';" onMouseOut="this.style.

backgroundColor=\'#899CB8\';">

<a href=\"scripts/$pagelink\" class=\"size12vdarkblue\">$name</a></td>
</tr> ';

************
because i want to write this to a text file which is read on another page. this creates a new row
************
does this help??? because it still doesn't work...
************
Digital-SyntaX is offline
Reply With Quote
View Public Profile
 
Old 01-09-2003, 08:34 AM
conkermaniac's Avatar
The Nutty Moderator

Posts: 1,012
Location: China
Trades: 0
Hi Digital,

Correct me if I'm wrong, but I really don't think that you are supposed to store HTML code within variables- at least it's not something that I have worked with.
__________________

Please login or register to view this content. Registration is FREE
- Affordable feature-packed remotely hosted message boards!
conkermaniac is offline
Reply With Quote
View Public Profile
 
Old 01-09-2003, 10:15 AM
Digital-SyntaX's Avatar
Average Talker

Posts: 15
Location: Perth, Australia
Trades: 0
soo... what do i do?
Digital-SyntaX is offline
Reply With Quote
View Public Profile
 
Old 01-09-2003, 10:19 AM
Digital-SyntaX's Avatar
Average Talker

Posts: 15
Location: Perth, Australia
Trades: 0
and what's wrong with it? is it written down somewhere not to do this??? huh! huh! i've got a careful script planned out and i don't need some "Nutty Moderator" coming and telling me what to do!

hehe j/k

i just want to add a row to a table in this .txt file and i thought it might be easier storing it as a variable and then

fwrite($updatesfile, "$updatingcode");

*******************

what is wrong?
Digital-SyntaX is offline
Reply With Quote
View Public Profile
 
Old 01-09-2003, 10:51 PM
Abhishek Reddy's Avatar
Average Talker

Posts: 28
Location: New Zealand
Trades: 0
You're escaping double-quotes in the <a href... line but not in the previous lines. Keep it consistent.

I ran this quick snippet on my local server and it prints without errors.


$pagelink = "bob";
$name = "vader";

$updatingcode = '<td bgcolor="#899CB8" class="size12vdarkblue" onMouseOver="this.style.backgroundColor=\\'#6981A5 \\';" onMouseOut="this.style.

backgroundColor=\\'#899CB8\\';">

<a href="scripts/' . $pagelink . '" class="size12vdarkblue">' . $name . '</a></td>
</tr> ';

echo $updatingcode;


Try it out, and if you still get an error, then post up the rest of your code too.
__________________

Please login or register to view this content. Registration is FREE

Moderator at
Please login or register to view this content. Registration is FREE

Last edited by Abhishek Reddy; 01-09-2003 at 10:58 PM..
Abhishek Reddy is offline
Reply With Quote
View Public Profile
 
Old 01-10-2003, 03:01 AM My option
kenli's Avatar
Novice Talker

Posts: 14
Trades: 0
If you set the piece of code as variable, so \" is right. But if you set it as html code, just use " . like this:

php code:
<?
$aaa = "<td onMouseMove=\"this.style.background=#ffff\"> something </td>"
?>

html code:
<td onMouseMove="this.style.background=#ffff"> something </td>
__________________
===============================
Folder Safe - Keep Your PC Files Safe

Please login or register to view this content. Registration is FREE
kenli is offline
Reply With Quote
View Public Profile
 
Old 01-11-2003, 09:41 AM
Digital-SyntaX's Avatar
Average Talker

Posts: 15
Location: Perth, Australia
Trades: 0
<?
include 'header.php';
include '.../.../.../.../.../awoemxcjfdyueycndueuejdlasfweoiociuoawenlskkcucose enselicusoien.txt';
echo "<link rel=\"stylesheet\" href=\".../.../.../.../font.css\" type=\"text/css\">";
?>
<?
$filename = ".../.../.../.../.../scripts.txt";

$whattoread = @fopen($filename, "r") or die("There has been an error processing our contact script, please email the administrator

email@digital-syntax.com.au");

$old_contents = fread($whattoread, filesize($filename));

fclose($whattoread);

// writes $newstring to text file erasing any data that is already in that file

$filename = ".../.../.../.../.../scripts.txt";

$name = $_POST['name'];
$pagelink = $_POST['pagelink'];
$size = $_POST['size'];
$completed = $_POST['completed'];
$function = $_POST['function'];
$description = $_POST['description'];
$file = $_POST['file'];
$pw = $_POST['pw'];
$overall = "
<br><span class=\"size2darkblue\"><table width=\"80%\" style=\"border-collapse: collapse\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\"

align=\"center\" bordercolor=\"313d4f\" class=\"size2darkblue\">
<tr>
<td width=\"40%\"><b>Name:</b></td>
<td width=\"60%\">$name</td>
</tr>
<tr>
<td width=\"40%\"><b>Function:</b></td>
<td width=\"60%\">$function</td>
</tr>
<tr>
<td width=\"40%\"><b>Completed:</b></td>
<td width=\"60%\">$completed</td>
</tr>
<tr>
<td width=\"40%\"><b>Size:</b></td>
<td width=\"60%\">$size</td>
</tr>
<tr>
<td width=\"40%\" valign=\"top\"><b>Description:</b></td>
<td width=\"60%\">$description</td>
</tr>
</table>
<table border=\"0\" cellpadding=\"1\" align=\"center\" width=\"100%\">
<tr>
<td width=\"50%\" class=\"size2darkblue\" align=\"right\"><b><u>Download:</u></b></td>
<td width=\"50%\" align=\"left\">&nbsp;&nbsp;<a href=\"scripts/$file\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage(

'$file','','images/download_down.gif',1)\"><img name=\"$file\" border=\"0\" class=\"images\" src=\"images/download.gif\" width=\"20\" height=

\"22\" ></a></td>
</tr>
</table></span>";



if ($pw == "$password") {

$newfile = fopen($filename, "w+");
@fwrite($newfile, "$overall"."<img src=\"images/line.gif\"><br>");
fclose($newfile);


// adds the variable $old_contents to contact.txt after the new news update


$filename = ".../.../.../.../.../scripts.txt";

$newfile2 = @fopen($filename, "a");
@fwrite($newfile2, $old_contents);
fclose($newfile2);
echo "<p>The following was added to the scripts page:</p>";
echo "<span class=\"size2darkblue\"><table width=\"80%\" style=\"border-collapse: collapse\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\"

align=\"center\" bordercolor=\"313d4f\" class=\"size2darkblue\">
<tr>
<td width=\"40%\"><b>Name:</b></td>
<td width=\"60%\">$name</td>
</tr>
<tr>
<td width=\"40%\"><b>Function:</b></td>
<td width=\"60%\">$function</td>
</tr>
<tr>
<td width=\"40%\"><b>Completed:</b></td>
<td width=\"60%\">$completed</td>
</tr><tr>
<td width=\"44%\"><b>Size:</b></td>
<td width=\"56%\">
$size
</td>
</tr>
<tr>
<td width=\"40%\" valign=\"top\"><b>Description:</b></td>
<td width=\"60%\">$description</td>
</tr>
<tr>
<td width=\"40%\"><b>Download:</b></td>
<td width=\"60%\"><a href=\"download.localhost/$file\" class=\"size2darkblue\" target=\"_blank\">$file</a></td>
</tr>
</table></span>";
echo "<p align=\"center\"><a href=\"add_script.php\" class=\"size2darkblue\">Add another one</a>";

$blue = "1";

//increments the $count by 1


$log="../../../../../script-count.txt";

$open=@fopen($log,'r+');

$counter=@fread($open,filesize($log));

@fclose($open);

if ($counter == "5") {

$fh = fopen($log, "w");
fwrite($fh, $blue);

fclose($fh);

}

else

{

$counter++;
$write=fopen($log,'w');
fputs($write,$counter);
fclose($write);

}

$updatesfilename = "../../../../../update"."$count".".txt";

$updatingcode = '

<a href="scripts/' . $pagelink . '" class="size12vdarkblue">' . $name . '</a>';



$updatesfile = fopen($updatesfilename, "w");
fwrite($updatesfile, "$updatingcode");
fclose($updatesfile);

} else {
echo "Sorry but you are not authorized to do that.";
}
?>
<?
include 'footer.php';
?>

*********************
this is the whole coding, it ads to a file name depending on the count. what's wrong with it?
*********************
Digital-SyntaX is offline
Reply With Quote
View Public Profile
 
Old 01-11-2003, 10:11 AM
Abhishek Reddy's Avatar
Average Talker

Posts: 28
Location: New Zealand
Trades: 0
Scanned the code briefly. Would I be wrong to think that

$updatesfilename = "../../../../../update"."$count".".txt";

should be

$updatesfilename = "../../../../../update" . $counter . ".txt";

?
__________________

Please login or register to view this content. Registration is FREE

Moderator at
Please login or register to view this content. Registration is FREE
Abhishek Reddy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to whats wrong with my coding????
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31749 seconds with 12 queries