Table sql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Goldenlamp
    New Member
    • Jul 2007
    • 6

    Table sql

    Can someone see by the PHP what Table in the SQL database I have to make??

    [PHP]<?
    require("databa se.inc.php");
    connectDatabase ();
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title><?=$_G ET['title']?></title>
    <script type="text/javascript">
    function playAudioClip(i d) {
    document.AudioB ox.playSoundtra ck("audio/"+id+".au") ;
    }
    </script>
    <link href="style.css " rel="stylesheet " type="text/css" />
    </head>

    <body class="dictate" >
    <form class="dictate" action="result. php" method="post">
    <input type="hidden" name="title" value="<?=$_POS T['title']?>" />
    <h1><?=$_POST['title']?></h1>
    <?
    $ids="";
    $word_start=0;
    $word_stop=0;
    $open=false;
    $words=array();
    $content=file(" text/".$_POST['title'].".txt");
    foreach($conten t as $line) {
    echo "<p>";
    for($i=0;$i<str len($line);$i++ ) {
    if(substr($line ,$i,1)=="<" && !$open) {
    $word_start=$i+ 1;
    $open=true;
    }
    elseif(substr($ line,$i,1)==">" && $open) {
    $word_stop=$i;
    $word=substr($l ine,$word_start ,$word_stop-$word_start);
    $result=mysql_q uery("SELECT id FROM repository WHERE word='".$word." ';");
    list($id)=mysql _fetch_array($r esult);
    $ids.="audio/".$id.".au# ";
    ?> <input type="text" name="word_<?=$ id?>" value="" size="<?=strlen ($word)?>" onclick="playAu dioClip(<?=$id? >)" onfocus="playAu dioClip(<?=$id? >)" /> <?
    $open=false;
    }
    elseif(!$open) {
    echo substr($line,$i ,1);
    }
    }
    echo "</p>";
    }
    ?>
    <input type="submit" value="Vis resultat" />
    </form>
    <applet code="AudioBox. class" name="AudioBox" width="0" height="0">
    <param name="ab0" value="<?=$ids? >">
    </applet>
    </body>
    </html>
    [/PHP]


    Here are the second PHP.....




    [PHP]<?
    require("databa se.inc.php");
    connectDatabase ();
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Gem diktat</title>
    <link href="style.css " rel="stylesheet " type="text/css" />
    </head>

    <body>
    <?
    $words=explode( ";",$_POST['words']);
    foreach($words as $word) {
    mysql_query("IN SERT INTO repository SET `word`='".$word ."';");
    move_uploaded_f ile($_FILES[$word]['tmp_name'],"audio/".mysql_insert_ id().".au");
    }
    $handle=fopen(" text/".$_POST['title'].".txt","w+" );
    fputs($handle,$ _POST['content'],strlen($_POST['content']));
    fclose($handle) ;
    ?>
    Diktatet er gemt!
    </body>
    </html>
    [/PHP]
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    What Do you want to do with this coding, I dont have any idea yet. Please, you may better to explain it more.
    -Thanks

    Comment

    • Goldenlamp
      New Member
      • Jul 2007
      • 6

      #3
      Dear Ajaxrand.

      It's for making dictations to people how can't read it's with audio and text..
      I'm getting an error like tihs:
      Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result resource in /customers/test-dig.dk/test-dig.dk/httpd.www/dik/show_dict.php on line 39. BY THE PHP CODE BELOW!!!
      And this is a dictation that is saved, an uploading to make the test.. But it is not functioning..
      If I send you all the php's. maby you can help me to complete the program.. I don't know anyone else.. sorry..

      PHP code is:

      [PHP]

      <?
      require("databa se.inc.php");
      connectDatabase ();
      ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title><?=$_G ET['title']?></title>
      <script type="text/javascript">
      function playAudioClip(i d) {
      document.AudioB ox.playSoundtra ck("audio/"+id+".au") ;
      }
      </script>
      <link href="style.css " rel="stylesheet " type="text/css" />
      </head>

      <body class="dictate" >
      <form class="dictate" action="result. php" method="post">
      <input type="hidden" name="title" value="<?=$_POS T['title']?>" />
      <h1><?=$_POST['title']?></h1>
      <?
      $ids="";
      $word_start=0;
      $word_stop=0;
      $open=false;
      $words=array();
      $content=file(" text/".$_POST['title'].".txt");
      foreach($conten t as $line) {
      echo "<p>";
      for($i=0;$i<str len($line);$i++ ) {
      if(substr($line ,$i,1)=="<" && !$open) {
      $word_start=$i+ 1;
      $open=true;
      }
      elseif(substr($ line,$i,1)==">" && $open) {
      $word_stop=$i;
      $word=substr($l ine,$word_start ,$word_stop-$word_start);
      $result=mysql_q uery("SELECT id FROM repository WHERE word='".$word." ';");
      list($id)=mysql _fetch_array($r esult);
      $ids.="audio/".$id.".au# ";
      ?> <input type="text" name="word_<?=$ id?>" value="" size="<?=strlen ($word)?>" onclick="playAu dioClip(<?=$id? >)" onfocus="playAu dioClip(<?=$id? >)" /> <?
      $open=false;
      }
      elseif(!$open) {
      echo substr($line,$i ,1);
      }
      }
      echo "</p>";
      }
      ?>
      <input type="submit" value="Vis resultat" />
      </form>
      <applet code="AudioBox. class" name="AudioBox" width="0" height="0">
      <param name="ab0" value="<?=$ids? >">
      </applet>
      </body>
      </html>
      [/PHP]

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        Originally posted by Goldenlamp
        Dear Ajaxrand.
        It's for making dictations to people how can't read it's with audio and text..
        I'm getting an error like tihs:
        Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result resource in /customers/test-dig.dk/test-dig.dk/httpd.www/dik/show_dict.php on line 39.
        Hi Goldenlamp,
        That Error is saying something like this;
        The SQL Query String that you are trying to execute is Not giving a result against your Table.
        to verify it, how about braking this line to this way. always I am doing such things.then It will help to easily trap the errors on our Query strings.
        Replace:
        [CODE=php]$result=mysql_q uery("SELECT id FROM repository WHERE word='".$word." ';");[/CODE]
        with this:
        [CODE=php] $queryString = "SELECT id FROM repository WHERE word='{$word}'" ;
        $result=mysql_q uery( $queryString);[/CODE]
        and Before you Execute the sql string with mysql_query Just try to echo it and get the Out Put to the browser window.
        You may get something like this:
        Code:
        SELECT id FROM repository WHERE word='some-word'
        If it is NOT working with your MySQL table(using phpmyadmin or command line execute it), You may better to check the WHERE clause Parameter.
        Last edited by ak1dnar; Aug 9 '07, 11:22 AM. Reason: Removed Some Invalid code contents

        Comment

        • Goldenlamp
          New Member
          • Jul 2007
          • 6

          #5
          I'm sorry.. it's not going to work like tihis..?? There are to many php's sites.. how are working together for making the dictation.
          I need some one, how I can upload all the php's to and pay him for doing the last job. It only going to take 1 hour. and if that some one is good at php's it can take lees time..
          --

          Comment

          • ak1dnar
            Recognized Expert Top Contributor
            • Jan 2007
            • 1584

            #6
            Originally posted by Goldenlamp
            I'm sorry.. it's not going to work like tihis..?? There are to many php's sites.. how are working together for making the dictation.
            I need some one, how I can upload all the php's to and pay him for doing the last job. It only going to take 1 hour. and if that some one is good at php's it can take lees time..
            --
            Thescripts.com is all about programming and software development.
            Ask questions, share resources, contribute knowledge and network with other programmers and software developers.ARE YOU?

            Comment

            • kovik
              Recognized Expert Top Contributor
              • Jun 2007
              • 1044

              #7
              Originally posted by Goldenlamp
              how I can upload all the php's to and pay him for doing the last job. It only going to take 1 hour. and if that some one is good at php's it can take lees time..
              That's under the assumption that your code is easy to read and your intention is easy to decipher.

              Here, we encourage that you do your own work and put for the effort necessary to make your scripts work.

              Comment

              Working...