473,396 Members | 1,860 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,396 software developers and data experts.

Table sql

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

[PHP]<?
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><?=$_GET['title']?></title>
<script type="text/javascript">
function playAudioClip(id) {
document.AudioBox.playSoundtrack("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="<?=$_POST['title']?>" />
<h1><?=$_POST['title']?></h1>
<?
$ids="";
$word_start=0;
$word_stop=0;
$open=false;
$words=array();
$content=file("text/".$_POST['title'].".txt");
foreach($content as $line) {
echo "<p>";
for($i=0;$i<strlen($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($line,$word_start,$word_stop-$word_start);
$result=mysql_query("SELECT id FROM repository WHERE word='".$word."';");
list($id)=mysql_fetch_array($result);
$ids.="audio/".$id.".au#";
?> <input type="text" name="word_<?=$id?>" value="" size="<?=strlen($word)?>" onclick="playAudioClip(<?=$id?>)" onfocus="playAudioClip(<?=$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("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>Gem diktat</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?
$words=explode(";",$_POST['words']);
foreach($words as $word) {
mysql_query("INSERT INTO repository SET `word`='".$word."';");
move_uploaded_file($_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]
Aug 8 '07 #1
6 1178
ak1dnar
1,584 Expert 1GB
What Do you want to do with this coding, I dont have any idea yet. Please, you may better to explain it more.
-Thanks
Aug 8 '07 #2
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_array(): 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("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><?=$_GET['title']?></title>
<script type="text/javascript">
function playAudioClip(id) {
document.AudioBox.playSoundtrack("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="<?=$_POST['title']?>" />
<h1><?=$_POST['title']?></h1>
<?
$ids="";
$word_start=0;
$word_stop=0;
$open=false;
$words=array();
$content=file("text/".$_POST['title'].".txt");
foreach($content as $line) {
echo "<p>";
for($i=0;$i<strlen($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($line,$word_start,$word_stop-$word_start);
$result=mysql_query("SELECT id FROM repository WHERE word='".$word."';");
list($id)=mysql_fetch_array($result);
$ids.="audio/".$id.".au#";
?> <input type="text" name="word_<?=$id?>" value="" size="<?=strlen($word)?>" onclick="playAudioClip(<?=$id?>)" onfocus="playAudioClip(<?=$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]
Aug 8 '07 #3
ak1dnar
1,584 Expert 1GB
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_array(): 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:
Expand|Select|Wrap|Line Numbers
  1. $result=mysql_query("SELECT id FROM repository WHERE word='".$word."';");
with this:
Expand|Select|Wrap|Line Numbers
  1.  $queryString = "SELECT id FROM repository WHERE word='{$word}'";
  2.  $result=mysql_query( $queryString);
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:
Expand|Select|Wrap|Line Numbers
  1. 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.
Aug 9 '07 #4
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..
--
Aug 9 '07 #5
ak1dnar
1,584 Expert 1GB
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?
Aug 9 '07 #6
kovik
1,044 Expert 1GB
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.
Aug 10 '07 #7

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

Similar topics

4
by: Gaz | last post by:
Hi, I need to have a table nested within another table. The tables are alongside each other visually speaking, and the nested table (on the right) can vary in size. My problem is that when the...
61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
3
by: Terrence Brannon | last post by:
I don't know what Postgres considers a relation and had no intention of creating one when piping my schema to it... I always DROP TABLE before CREATE TABLE, so here are the ERRORS emitted when...
4
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
4
by: Simone Battagliero | last post by:
I wrote a program which inserts and finds elements in an hash table. Each element of the table is a dinamic list, which holds all elements having the same hash value (calculated by an int...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
76
MMcCarthy
by: MMcCarthy | last post by:
Normalisation is the term used to describe how you break a file down into tables to create a database. There are 3 or 4 major steps involved known as 1NF (First Normal Form), 2NF (Second Normal...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
5
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

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.