Hey.. I'm getting an error.: Warning: in_array() [function.in-array]: Wrong datatype for second argument in select_audio.ph p 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.. -
<?
-
require("database.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>Vælg lyd til <?=$_POST['title']?></title>
-
<link href="style.css" rel="stylesheet" type="text/css" />
-
</head>
-
-
<body>
-
<? if(file_exists("text/".$_POST['title'].".txt")) {
-
?>
-
<h1>choose sound</h1>
-
<h3 style="color:#CC3333">Pas på! there are allready a dictation with that word.<br />
-
Hvis du er ved at lave et nyt diktat, burde du gå <a href="javascript:history.back()">tilbage</a> og vælge en anden titel.
-
Gør du ikke det, bliver diktatet med titelen "<?=$_POST['title']?>" erstattet med dette diktat her!</h3>
-
<?
-
}
-
?>
-
<form enctype="multipart/form-data" action="save_dict.php" method="post">
-
<input type="hidden" name="MAX_FILE_SIZE" value="500000" />
-
<table border="0">
-
<?
-
$result=mysql_query("SELECT word FROM repository;");
-
while($entry=mysql_fetch_array($result)) {
-
$repository[]=$entry[0];
-
}
-
$word_start=0;
-
$word_stop=0;
-
$open=false;
-
$words=array();
-
$content=$_POST['content'];
-
for($i=0;$i<strlen($content);$i++) {
-
if(substr($content,$i,1)=="<" && !$open) {
-
$word_start=$i+1;
-
$open=true;
-
}
-
elseif(substr($content,$i,1)==">" && $open) {
-
$word_stop=$i;
-
$word=substr($content,$word_start,$word_stop-$word_start);
-
if(!in_array($word,$repository)) {
-
$words[]=$word;
-
?>
-
<tr>
-
<td><?=$word?></td>
-
<td><input type="file" name="<?=$word?>" /></td>
-
</tr>
-
<?
-
}
-
$open=false;
-
}
-
}
-
?>
-
</table>
-
<input type="hidden" name="words" value="<? echo implode(";",$words); ?>" />
-
<input type="hidden" name="content" value="<?=$_POST['content']?>" />
-
<input type="hidden" name="title" value="<?=$_POST['title']?>" />
-
<input type="submit" value="Upload & gem" />
-
</form>
-
</body>
-
</html>
-
1 1137
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 do readline().
Is there a way to do this?
for example:
while 1:
line=stdin.peek_nextline()
|
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 Col3
Col4
A0012430 REKAL TVÄTTMEDEL EKOMAX 0,5L ST 75.9000
|
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();
|
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 method was a piece of C code
which turned out to be incorrect and incomplete but by modifieing it would
still be usuable.
The first method was this piece of text:
|
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. Everything has been running flawlessly
without problems. Very amazing to use VMware, it has worked beautifully.
uname -a
| |
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 facing problems:
Assume that
FILE* filePointer;
unsigned char lineBuffer;
|
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 learn/try a full blown
parsing module. My simple script works well until it runs into
functions that straddle multiple lines. For example:
Call mass_write(&H0, &HF, &H4, &H0, &H5, &H0, &H6, &H0, &H7, &H0,
&H8, &H0, _
|
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?
|
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
2007/07/27 11:00:03 52 00 52 02 02 C7 83 D7 07 07 1B 0B 00 00 00
00
2007/07/27 11:00:03 28 0A 06 06 06 06 06 06 06 06 06 06 06 0A 06
06
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |