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

Re: [OLmws] Echo function , data from MySQL

Expand Messages
  • 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 1 of 10 , Oct 27, 2010
    • 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 2 of 10 , Oct 28, 2010
      • 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 3 of 10 , Oct 28, 2010
        • 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.