Loading ...
Sorry, an error occurred while loading the content.

Echo function , data from MySQL

Expand Messages
  • philcrosoft
    So my overlib looks like this: onclick= overlib( Here is users Name , CAPTIONFONTCLASS, olcap , ... so instead of Here is users Name I need echo function
    Message 1 of 10 , Oct 26, 2010
    View Source
    • 0 Attachment
      So my overlib looks like this:

      onclick="overlib(\'Here is users Name\', CAPTIONFONTCLASS,\'olcap\', ...

      so instead of "Here is users Name" I need echo function to get data from MySQL, like this - Echo $info['user_name'];
    • Ben Johansen
      if your using php, it would be onclick= overlib( , CAPTIONFONTCLASS, olcap , ... ... Ben Johansen http://www.webspinr.com
      Message 2 of 10 , Oct 26, 2010
      View Source
      • 0 Attachment
        if your using php,

        it would be

        onclick="overlib(\'<?php echo $info['user_name']; ?>\', CAPTIONFONTCLASS,\'olcap\', ...

        On Oct 26, 2010, at 10:28 AM, philcrosoft wrote:

        > So my overlib looks like this:
        >
        > onclick="overlib(\'Here is users Name\', CAPTIONFONTCLASS,\'olcap\', ...
        >
        > so instead of "Here is users Name" I need echo function to get data from MySQL, like this - Echo $info['user_name'];
        >
        >
        >
        > ------------------------------------
        >
        > OLmws Support Pages:
        > http://www.macridesweb.com/oltest/
        > OLmws Group's Purpose:
        > http://groups.yahoo.com/group/overlibmws/message/1
        > Yahoo! Groups Links
        >
        >
        >
        >

        Ben Johansen
        http://www.webspinr.com
        benj@...
        Phone: 360-597-3372
        Mobile: 360-600-7775
      • philcrosoft
        ... well i do so:
        Message 3 of 10 , Oct 26, 2010
        View Source
        • 0 Attachment
          > onclick="overlib(\'<?php echo $info['user_name']; ?>\', CAPTIONFONTCLASS,\'olcap\', ...



          well i do so:
          <a href="#" onmouseover="var ovlb=(OLshowingsticky)?overlib2:overlib; return ovlb(\'<?php echo $info['user_name']; ?>\', BGCOLOR,\'red\', TEXTFONTCLASS,\'text12\', .....

          and i have an error:
          Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in K:\home\mytest\www\index.php on line 52
        • Ben Johansen
          hey, I need more info to answer this. like more code around this ... Ben Johansen http://www.webspinr.com benj@webspinr.com Phone: 360-597-3372 Mobile:
          Message 4 of 10 , Oct 26, 2010
          View Source
          • 0 Attachment
            hey, I need more info to answer this.
            like more code around this

            On Oct 26, 2010, at 12:09 PM, philcrosoft wrote:

            >
            >> onclick="overlib(\'<?php echo $info['user_name']; ?>\', CAPTIONFONTCLASS,\'olcap\', ...
            >
            >
            >
            > well i do so:
            > <a href="#" onmouseover="var ovlb=(OLshowingsticky)?overlib2:overlib; return ovlb(\'<?php echo $info['user_name']; ?>\', BGCOLOR,\'red\', TEXTFONTCLASS,\'text12\', .....
            >
            > and i have an error:
            > Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in K:\home\mytest\www\index.php on line 52
            >
            >
            >
            >
            > ------------------------------------
            >
            > OLmws Support Pages:
            > http://www.macridesweb.com/oltest/
            > OLmws Group's Purpose:
            > http://groups.yahoo.com/group/overlibmws/message/1
            > Yahoo! Groups Links
            >
            >
            >
            >

            Ben Johansen
            http://www.webspinr.com
            benj@...
            Phone: 360-597-3372
            Mobile: 360-600-7775
          • philcrosoft
            Message 5 of 10 , Oct 26, 2010
            View Source
            • 0 Attachment
              <?php

              // Connects to your Database

              mysql_connect("localhost", "root", "") or die(mysql_error()) ;
              mysql_select_db("users") or die(mysql_error()) ;

              //Retrieves data from MySQL

              $data = mysql_query("SELECT * FROM users") or die(mysql_error());

              //Puts it into an array

              while($info = mysql_fetch_array( $data )) {

              <a href="#" onmouseover="var ovlb=(OLshowingsticky)?overlib2:overlib; return ovlb(\'MySQL Data\', BGCOLOR,\'red\', TEXTFONTCLASS,\'text12\', TEXTPADDING,4, FGCOLOR,\'#fdffe1\', WRAP);" onmouseout="(OLshowingsticky)?nd2():nd();"
              onclick="overlib(\'MySQL DATA\', CAPTIONFONTCLASS,\'olcap\', OFFSETX,-150, OFFSETY,-130, HAUTO, VAUTO, CAPTION,\'MySQL Data\', STICKY, CLOSECLICK);
              event.returnValue=false; return false;"><font color="#000000">
              <img src="img/user_photo/' . $info['user_photo'] . '"style="border:none;"></span></a>';

              }

              ?>
              </td></tr></table>

              it looks like so ... so I need correct ech function where i have "MySQL Data"
            • Foteos Macrides
              Philip, What you posted is missing the echo statement, and appears to have an extraneous . Look at how the overlib first argument is constructed for a
              Message 6 of 10 , Oct 27, 2010
              View Source
              • 0 Attachment
                Philip,
                 
                What you posted is missing the echo statement, and appears to have an extraneous </span>.
                 
                Look at how the overlib first argument is constructed for a database fetch in the:
                support document and see if that helps.  If not, post your corrected markup / code with the line numbers indicated and the error message predicting the line that has the problem.
                 
                If it's a quoting problem, also take a look at the:
                support document.
                 
                Fote
                --
                 
                ----- Original Message -----
                Sent: Tuesday, October 26, 2010 3:25 PM
                Subject: Re: [OLmws] Echo function , data from MySQL

                <?php

                // Connects to your Database

                mysql_connect("localhost", "root", "") or die(mysql_error()) ;
                mysql_select_db("users") or die(mysql_error()) ;

                //Retrieves data from MySQL

                $data = mysql_query("SELECT * FROM users") or die(mysql_error());

                 //Puts it into an array

                 while($info = mysql_fetch_array( $data )) {

                <a href="#" onmouseover="var ovlb=(OLshowingsticky)?overlib2:overlib; return ovlb(\'MySQL Data\', BGCOLOR,\'red\', TEXTFONTCLASS,\'text12\', TEXTPADDING,4, FGCOLOR,\'#fdffe1\', WRAP);" onmouseout="(OLshowingsticky)?nd2():nd();"
                     onclick="overlib(\'MySQL DATA\', CAPTIONFONTCLASS,\'olcap\', OFFSETX,-150, OFFSETY,-130, HAUTO, VAUTO, CAPTION,\'MySQL Data\', STICKY, CLOSECLICK);
                     event.returnValue=false; return false;"><font color="#000000">
                     <img src="img/user_photo/' . $info['user_photo'] . '"style="border:none;"></span></a>';

                     }

                     ?>
                </td></tr></table>

                it looks like so ... so I need correct ech function where i have "MySQL Data"
              • philcrosoft
                Well I ve read it all, but I don t exactly how to combine my php with overlib ((( ... So I need help ... this is my full php code:
                Message 7 of 10 , Oct 27, 2010
                View Source
                • 0 Attachment
                  Well I've read it all, but I don't exactly how to combine my php with overlib ((( ... So I need help ... this is my full php code:

                  <html>
                  <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
                  <title>Test</title>
                  </head>
                  <script type="text/javascript" src="scripts/overlibmws.js"></script>
                  <script type="text/javascript" src="scripts/overlibmws_overtwo.js"></script>
                  <script type="text/javascript" src="scripts/overlibmws_filter.js"></script>
                  <script type="text/javascript" src="scripts/overlibmws_exclusive.js"></script>
                  <script type="text/javascript">
                  </script>

                  <p align="center">

                  <?php

                  // Connects to your Database

                  mysql_connect("localhost", "root", "") or die(mysql_error()) ;
                  mysql_select_db("users") or die(mysql_error()) ;

                  //Retrieves data from MySQL

                  $data = mysql_query("SELECT * FROM users") or die(mysql_error());

                  //Puts it into an array

                  while($info = mysql_fetch_array( $data )) {


                  //Outputs the image and other data

                  Echo '<a href="javascript:void(0);" onmouseover="return overlib(\'DATA from MySQL\',AUTOSTATUS,WRAP);" onmouseout="nd();">tooltip</a>';

                  }

                  ?>
                  </p>
                  _______________________________________________________

                  So instead of DATA from MySQL I need ech function which gets data from MySQL like that: Echo $info['users_name'];

                  Thank you for help!
                • Ben Johansen
                  ok, have you looked here for help http://us.php.net/manual/en/function.mysql-fetch-array.php notice how they used ASSOC flag while ($row =
                  Message 8 of 10 , Oct 27, 2010
                  View Source
                  • 0 Attachment
                    ok, have you looked here for help

                    notice how they used ASSOC flag

                    while ($row mysql_fetch_array($resultMYSQL_ASSOC)) {
                        
                    printf("ID: %s  Name: %s"$row["id"], $row["name"]);
                    }

                    This also notice that they then use assoc. extracting the data

                    you have SELECT * from user, that is returning an array, you have to pick out of the array what you need.
                    so lets say in the results returned you have a custom tooltip for each user and you have their name fields

                    so we do this

                    $data = mysql_query("SELECT * FROM users") or die(mysql_error());

                    //Puts it into an array

                    while($info = mysql_fetch_array( $dataMYSQL_ASSOC)) {

                    //Outputs the image and other data

                       
                        Echo '<a href="javascript:" onmouseover="return overlib("'.$info['tooltip'].'",AUTOSTATUS,WRAP);" onmouseout="nd();">'.$info['username'].' tooltip</a>';

                        }

                        ?>
                    </p>

                    I just notice you state it outputs image, are you storing the image data in the db or is this a reference?



                    On Oct 27, 2010, at 10:37 AM, philcrosoft wrote:

                    Well I've read it all, but I don't exactly how to combine my php with overlib ((( ... So I need help ... this is my full php code:

                    <html>
                    <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
                    <title>Test</title>
                    </head>
                    <script type="text/javascript" src="scripts/overlibmws.js"></script>
                    <script type="text/javascript" src="scripts/overlibmws_overtwo.js"></script>
                    <script type="text/javascript" src="scripts/overlibmws_filter.js"></script>
                    <script type="text/javascript" src="scripts/overlibmws_exclusive.js"></script>
                    <script type="text/javascript">
                    </script>

                    <p align="center">

                    <?php

                    // Connects to your Database

                    mysql_connect("localhost", "root", "") or die(mysql_error()) ;
                    mysql_select_db("users") or die(mysql_error()) ;

                    //Retrieves data from MySQL

                    $data = mysql_query("SELECT * FROM users") or die(mysql_error());

                    //Puts it into an array

                    while($info = mysql_fetch_array( $data )) {


                    //Outputs the image and other data

                        Echo '<a href="javascript:void(0);" onmouseover="return overlib(\'DATA from MySQL\',AUTOSTATUS,WRAP);" onmouseout="nd();">tooltip</a>';

                        }

                        ?>
                    </p>
                    _______________________________________________________

                    So instead of DATA from MySQL I need ech function which gets data from MySQL like that:  Echo $info['users_name'];

                    Thank you for help!



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

                    OLmws Support Pages:
                    http://www.macridesweb.com/oltest/
                    OLmws Group's Purpose:
                    http://groups.yahoo.com/group/overlibmws/message/1
                    Yahoo! Groups Links

                    <*> To visit your group on the web, go to:
                       http://groups.yahoo.com/group/overlibmws/

                    <*> Your email settings:
                       Individual Email | Traditional

                    <*> To change settings online go to:
                       http://groups.yahoo.com/group/overlibmws/join
                       (Yahoo! ID required)

                    <*> To change settings via email:
                       overlibmws-digest@yahoogroups.com
                       overlibmws-fullfeatured@yahoogroups.com

                    <*> To unsubscribe from this group, send an email to:
                       overlibmws-unsubscribe@yahoogroups.com

                    <*> Your use of Yahoo! Groups is subject to:
                       http://docs.yahoo.com/info/terms/



                    Ben Johansen
                    Phone: 360-597-3372
                    Mobile: 360-600-7775



                  • philcrosoft
                    ... It is just reference =) i tried your code but it doesn t work because in html output I have such result onmouseover= return overlib( Jane
                    Message 9 of 10 , Oct 28, 2010
                    View Source
                    • 0 Attachment
                      >
                      > I just notice you state it outputs image, are you storing the image data in the db or is this a reference?
                      >

                      It is just reference =) i tried your code but it doesn't work because in html output I have such result

                      onmouseover="return overlib("Jane Wilson",AUTOSTATUS,WRAP);" ... so it goes in "" but we need just only this '' for appropriate script =)
                    • philcrosoft
                      Seems to me I have found solution! Thanks for help!
                      Message 10 of 10 , Oct 28, 2010
                      View Source
                      • 0 Attachment
                        Seems to me I have found solution! Thanks for help!
                      Your message has been successfully submitted and would be delivered to recipients shortly.