473,395 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

select_audio.php on line 43

Hey.. I'm getting an error.: Warning: in_array() [function.in-array]: Wrong datatype for second argument in select_audio.php on line 43

I'm uploading a audio-file (au).

The Database has a id int auto_increment
word varchar(255)

The ID should give the audio an id with link to the word.
I'm making a dictation..

Expand|Select|Wrap|Line Numbers
  1. <?
  2.     require("database.inc.php");
  3.     connectDatabase();
  4. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  8. <title>V&aelig;lg lyd til <?=$_POST['title']?></title>
  9. <link href="style.css" rel="stylesheet" type="text/css" />
  10. </head>
  11.  
  12. <body>
  13. <? if(file_exists("text/".$_POST['title'].".txt")) {
  14. ?>
  15. <h1>choose sound</h1>
  16. <h3 style="color:#CC3333">Pas p&aring;! there are allready a dictation with that word.<br />
  17. Hvis du er ved at lave et nyt diktat, burde du g&aring; <a href="javascript:history.back()">tilbage</a> og v&aelig;lge en anden titel.
  18. G&oslash;r du ikke det, bliver diktatet med titelen &quot;<?=$_POST['title']?>&quot; erstattet med dette diktat her!</h3>
  19. <?
  20. }
  21. ?>
  22. <form enctype="multipart/form-data" action="save_dict.php" method="post">
  23. <input type="hidden" name="MAX_FILE_SIZE" value="500000" />
  24. <table border="0">
  25. <?
  26.     $result=mysql_query("SELECT word FROM repository;");
  27.     while($entry=mysql_fetch_array($result)) {
  28.         $repository[]=$entry[0];
  29.     }
  30.     $word_start=0;
  31.     $word_stop=0;
  32.     $open=false;
  33.     $words=array();
  34.     $content=$_POST['content'];
  35.     for($i=0;$i<strlen($content);$i++) {
  36.         if(substr($content,$i,1)=="<" && !$open) {
  37.             $word_start=$i+1;
  38.             $open=true;
  39.         }
  40.         elseif(substr($content,$i,1)==">" && $open) {
  41.             $word_stop=$i;
  42.             $word=substr($content,$word_start,$word_stop-$word_start);
  43.             if(!in_array($word,$repository)) {
  44.                 $words[]=$word;
  45.                 ?>
  46.                 <tr>
  47.                     <td><?=$word?></td>
  48.                     <td><input type="file" name="<?=$word?>" /></td>
  49.                 </tr>
  50.                 <?
  51.             }
  52.             $open=false;
  53.         }
  54.     }
  55. ?>
  56. </table>
  57. <input type="hidden" name="words" value="<? echo implode(";",$words); ?>" />
  58. <input type="hidden" name="content" value="<?=$_POST['content']?>" />
  59. <input type="hidden" name="title" value="<?=$_POST['title']?>" />
  60. <input type="submit" value="Upload &amp; gem" />
  61. </form>
  62. </body>
  63. </html>
  64.  
Nov 23 '07 #1
1 1127
coffear
20
Try echoing out $word and print_r() $repository

1 possible reason for the error is that the database is not returning any rows so $repository is not getting set.
Nov 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: les_ander | last post by:
Hi, suppose I am reading lines from a file or stdin. I want to just "peek" in to the next line, and if it starts with a special character I want to break out of a for loop, other wise I want to...
7
by: jamait | last post by:
Hi all, I m trying to read in a text file into a datatable... Not sure on how to split up the information though, regex or substrings...? sample: Col1 Col2 ...
6
by: mary | last post by:
When we use string line; while (getline(in,line)) { out.write(line.c_str(),line.size()); out.put('\n'); } in.close();
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
3
by: Double Echo | last post by:
Hi all, I'm using PHP 4.4.2, and use PHP on both the command-line and the web. I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. ...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
6
by: Jacob Rael | last post by:
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to...
11
by: xdevel | last post by:
Hi, I don't understand option. if I write: #line 100 "file" I change file numeration to start to line 100 but what "file" ? any example?
19
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
This is an example of the data; 2007/07/27 11:00:03 ARES_INDICATION 010.050.016.002 404.2.01 (6511) RX 74 bytes 2007/07/27 11:00:03 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.