Login to TechLifeForum X
Board Index Go to Reboot.Pro
  • Account Login
  • Register
TechLifeForum
  • Home
  • Members
  • Awards
  • Rules
  • Help
  • Donate
  • Live IRC
TechLifeForum / Programming and Development / Web Development & Web Graphics v
« Previous 1 2 3 4 5 6 ... 10 Next »
/  document write?[Advanced Search]
Reply to thread
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[SOLVED] document write?

06-28-2012, 10:22 AM (This post was last modified: 06-29-2012 06:17 AM by 1912Dummy.)
Post: #1
1912Dummy Offline
Senior Member
***
Posts: 481
Joined: Feb 2012
Reputation: 3
document write?
Hello,

this is a little hard to fix in 1,2,3 :)

please any help.

Code: (SELECT ALL CODE)
$id = $_GET["id"];
$count = $_GET["count"];
            
            $sql = "SELECT * FROM ti WHERE id='$id'";
            $result = mysql_query($sql);
            while ($row = mysql_fetch_array($result))
            {
            $id = $row['id'];
            $count = $row['count'];
                         
            echo "it_link['$id']='$count'";
            }            
mysql_close();            
echo '
function it_display($id) {
    document.write(it_link[$id]);
}
';

i add this into a html to get the result
Code: (SELECT ALL CODE)
Current count: <script type="text/javascript">it_display('1')</script>

but i get as result:

Current count:
function it_display($id) {
document.write(it_link[$id]);
}

instead of:
Current count: 963
Find
Reply
06-28-2012, 02:17 PM
Post: #2
1912Dummy Offline
Senior Member
***
Posts: 481
Joined: Feb 2012
Reputation: 3
RE: document write?
seems i have fix it :)
but still don't work 100%

i have now in the html as text:
current count: undefined

anyone?
Find
Reply
06-28-2012, 03:49 PM
Post: #3
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
RE: document write?
There are a lot of different things that could be improved in this, however I'll try to stick to the to the original topic.

Have you tried this:
Code: (SELECT ALL CODE)
mysql_close();            
echo '
function it_display($id) {
    document.write("<script type=\"text/javascript\">" + it_link[$id]) + "</script>";
}
';

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
06-28-2012, 04:12 PM (This post was last modified: 06-28-2012 04:15 PM by 1912Dummy.)
Post: #4
1912Dummy Offline
Senior Member
***
Posts: 481
Joined: Feb 2012
Reputation: 3
RE: document write?
hey kobe,

please i love when you can improve it
i don't mind :)

so let me know.

:( no data displayed.
Find
Reply
06-28-2012, 08:54 PM
Post: #5
AceInfinity Offline
∞ IҊϜIɴITϵ ☭
*****
Microsoft MVP
Posts: 8,696
Joined: Jun 2011
Reputation: 61
RE: document write?
Please, get into the habit of telling others what language this is that you're having issues with, as it would definitely help. Before even trying to see what your issue with this code was, I had to review to analyze and determine whether this was Javascript or PHP or something else. To others unfamiliar with both, they may not even have a clue even if they wish to help you by doing some personal research.

Could it be because you're not echoing the values here, you're echoing the actual function:
Code: (SELECT ALL CODE)
echo '
function it_display($id) {
    document.write(it_link[$id]);
}
';

Instead of using the function and calling it to return a value inside an echo?

I'm not a perfect PHP programmer, but here that is definitely not the way you use a function lol



Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer


Development Site: aceinfinity.net
WWW Find
Reply
06-29-2012, 04:19 AM (This post was last modified: 06-29-2012 04:22 AM by 1912Dummy.)
Post: #6
1912Dummy Offline
Senior Member
***
Posts: 481
Joined: Feb 2012
Reputation: 3
RE: document write?
its just php.
and can't say because i have tried almost everything
i even changed and changed it but nothing works.

i even used:
Code: (SELECT ALL CODE)
echo function it_display($id) {

    document.write("<script type=\"text/javascript\">" + it_link[$id]) + "</script>";
but don't do anything
even just

Code: (SELECT ALL CODE)
echo it_display($id)

or even

echo it_link($id)
nothing works :(

i only want to get it displayed in the html
when i call this function:

Code: (SELECT ALL CODE)
Current count: <script type="text/javascript">it_display('1')</script>
Find
Reply
06-29-2012, 07:52 PM
Post: #7
AceInfinity Offline
∞ IҊϜIɴITϵ ☭
*****
Microsoft MVP
Posts: 8,696
Joined: Jun 2011
Reputation: 61
RE: document write?
You're trying to echo a document.write function though? Why? Just calling the function will call document.write, so why would you need to 'echo' it?



Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer


Development Site: aceinfinity.net
WWW Find
Reply
06-30-2012, 04:29 AM (This post was last modified: 06-30-2012 04:38 AM by 1912Dummy.)
Post: #8
1912Dummy Offline
Senior Member
***
Posts: 481
Joined: Feb 2012
Reputation: 3
RE: document write?
without the echo
i don't work then i got a error

Code: (SELECT ALL CODE)
document.write(ccount_link[id]);

Parse error: syntax error, unexpected '['
Find
Reply
06-30-2012, 01:24 PM (This post was last modified: 06-30-2012 01:24 PM by AceInfinity.)
Post: #9
AceInfinity Offline
∞ IҊϜIɴITϵ ☭
*****
Microsoft MVP
Posts: 8,696
Joined: Jun 2011
Reputation: 61
RE: document write?
it's not an error for that line, but where's your '$' in there?

ccount_link is not another function is it? I think you should be reviewing PHP basics on your own first before requesting help here as it would benefit you even more to do so.



Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer


Development Site: aceinfinity.net
WWW Find
Reply
Reply to thread


Possibly Related Threads...

Thread: Author Replies: Views: Last Post
  Javascript Bookmarklet - Get Document Charset AceInfinity 0 522 03-25-2012 03:42 AM
Last Post: AceInfinity

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


Users browsing this thread
1 Guest(s)
Youtube Facebook Twitter Digg
Return to Top
All content © copyright TechLifeForum
Powered By MyBB, © 2002-2013 MyBB Group
Designed by ThemeFreak
Mobile Version