[PHP] Sending output to audio device from PHP
Hi, I have written an MP3 Jukebox server with PHP and MySQL, that runs on Linux server with Apache. To play music, I use the external program plaympeg from the SDL package. It works fine, but I cannot have any control over the player. To play the next song, I have to wait for the player to complete its current task and can then start a new player. This creates some pause between the songs, and is a bit annoying. To make my app more suffisticated, I'd like to be able to have more control over the stream. So I was wondering, how can I send something to the audio device without using an external program? I think I need to convert the MP3 stream first. Is there someone out there who would be interested in joining me in this little project? (If I may compliment myself, it is a nice piece of work, but needs some more scripting) Contact me directly per email, if you want me to send the sources. Any input would be appreciated. Cheers, Edwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: save to file
Enough answers, I think? If you want EACH value of $_POST on a new line, then why not implode with \n instead of \t? Now you get only one big line, because you only WRITE one \n. Edwin Ryan Holowaychuk wrote: I am trying to save to a text file. And I have managed to do that part now, but what happens is when I save to the file, all the lines get put into one big line in the file. I am creating a roster input that I adding to our website: No, name grade . The roster will contain 15 players So right now the implode puts everything on one line in the text file!!! So I am no sure if anybody can shed some light on this one. Thanks again Ryan ? //create a new file $fp = fopen(/place/on/server/ . $HTTP_POST_VARS['team'] , w); $file_data = implode(\t\, $_POST); //this would return values spit by tabs //write to the open file handle fwrite($fp, $file_data . \r\n); //close the file fclose($fp); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable string names
John's solution is the better one. But if you really wish to stick to your own, try and use eval() to complile $where$i. Edwin John W. Holmes wrote: I have: if ($where1 != '') { $whereArray = array_push($whereArray, $where1); } and I want to repeat for $where1 up to $where8 but rather than write it out 8 times, I'd rather use a loop for ($i=1; $i=8 i++) { if ($where1 != '') { $whereArray = array_push($whereArray, $where1); } } but how can I change $where1 to $where2, $where3 etc using $i. nothing I try seems to work. Do I use eval? Yes, you can use variable variables, like others have suggested, but why not just use an array? Almost every implementation of variable-variables seems to be a work around that's used instead of arrays. Where are all of your $where variables coming from? If they are from a form, just name them as where[], then simply loop through them using foreach($_POST['where']) and check them all. This makes your code more dynamic as you can add/subtract where[] elements and your processing code doesn't change. With a variable-variable solution, you have to change the number of loops you run each time to change the number of where elements you have. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading CSV data into MySQL
Or add a insert_date column of type timestamp to the database. This will automatically store the time of insertion. Then use ORDER BY insert_date. Edwin Jason Sheets wrote: You could create a integer column with an autoincrement flag, then order the rows by this column, that should give you the data in the order it was inserted into the db. Depending on your database there are other ways to do it. Jason On Sat, 2003-02-01 at 18:07, John W. Holmes wrote: On Sat, 2003-02-01 at 17:25, John W. Holmes wrote: I'm loading a .csv file into MySQL, done it a million times but for some reason it is scrambling the row order. All the fields are making it in correctly but the order of the rows seems to end up totally random. I've done this a million times and never saw this.. So? Why does it matter to you what order the rows are in the database, as long as the right data is there? The order is irrelevant. Because in this instance I need it to come out in the order it is actually in. Then use an ORDER BY in your query. If you're relying on the database to spit out rows in the order they went in, then you're wrong. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using input tags with php
Are you absolutely sure that the query gives result? Try and add or die (mysql_error()) behind mysql_connect, mysql_select_db and mysql_query. For the rest, it looks pretty good to me Sunfire wrote: ok let me try this question thing again... i am having a problem using input tags by using current values kept in a mysql table. how do you get the values out of the table and into a form so they show as the value= part of the tag? i tried just aabout everything and it doesnt work even htmlspecialchars() doesnt work.. all i get for output on the page is the rest of the script printed on the screen after the value= part of the tag..is there any way to fix it? - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 8:01 PM Subject: Re: [PHP] using input tags with php On Sat, 1 Feb 2003, Sunfire wrote: hi.. i took your idea... i put the error reporting code at the top of the script and ran it as the problem was still there to see what would happen.. instead i get 0 messages from the reporting system and all i get is the last 7 chars of the print line and the }? at the end of the script... so for instance if i do: print(input type=\text\ name=\company\ value=$new['company']\n); or any variance of that statement changing around the \ and apostrophes around to try different things all i get is the rest of the script starting from the \n all the way to the rest of the script where it says }? at the end dont know if this is a bug or not but its getting hard to figure out what the problem with my echo or print statements are... here is the whole script: its supposed to get all fields and then display in input text boxes the current values in that certain record i know i missed some stuff in it with the query but at this point was supposed to be a test to see if i could even put it in the box in the first place... but here is the code: Please step back, slow down, and write your question in a short concise format. I have no clue what the above means. html head titleedit member/title /head form action=edit1.php method=post pick some of these:br ?php error_reporting(E_ALL); mysql_connect(192.4.5.6, root, ); mysql_select_db(wata); $result=mysql_query(select * from members where company like 'test'); while($row=mysql_fetch_array($result)){ print(input type=text name=company value=\$row[company\]\n\n); // Try this instead, see also: htmlspecialchars()* print input type='text' name='company' value='{$row['company']}'; Regards, Philip * http://www.php.net/manual/en/faq.html.php#faq.html.encoding } ? input type=submit value=send /form /html /*end*/ any changes to make it work would be appreciated...tnx - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Sunfire [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 6:48 PM Subject: Re: [PHP] using input tags with php (IMPORTANT READ) On Sat, 1 Feb 2003, Sunfire wrote: if i do this: /*all the mysql login stuff here*/ $query=mysql_query(select * from members); while($new=mysql_fetch_array($query)){ echo $new['company']; /*so on through the field list*/ } on output all i get is the title with a submit button.. otherwise blank.. There is a bug in PHP 4.3.0 regarding the use of arrays in strings. The following gave a parse error before PHP 4.3.0: print Do not do this: $arr['key']; Now it gives an E_NOTICE error due to changes to the string scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE and instead it will work (no parse error either). Surrounding the array with {braces} in the string works regardless, so: print You can do this: {$arr['key']}; Regarding this question, don't write it like that but instead do the following (no quotes needed): echo $new['company']; For those wondering about this bug, see: http://bugs.php.net/bug.php?id=21820 The string documentation has been updated to demonstrate the array in string phenomena (except the bug hasn't been mentioned as I'm waiting for it to be committed first). http://www.php.net/types.string Sunfire, you aren't seeing this E_NOTICE error because your error level is turned down (by default). Put this on top of your script to see them all: error_reporting(E_ALL); Regards, Philip same thing with fetch_object()...and i have 1 row in the members table..im sort of confused now that it doesnt work for a wierd reason any better ideas on how to get the stuff out of the table and into vars? maybe im doing it wrong - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 01, 2003 5:33 PM Subject: Re: [PHP] using input tags with php In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, [EMAIL PROTECTED] writes: i tried getting the values into vars using
Re: [PHP] any change to see php source?
See www.php.net. Qt wrote: Thank you chris, Help full Do you have any link for installation manual Chris Hayes [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... At 21:36 1-2-2003, you wrote: I am studying on php. And the book say, when the server see php extension it is running php file and giving results to the visiting browser. But as I see related directories are normal directory, doesn' t like cgi-bin directories. Is there any change to see php file source such as file open function or something else? I am not going to somebody else file. Just I want to be sure how secure the php? It's all in CVS, read the source: I think he does not mean the PHP program source, but his scripts' source. Normally people cannot see the script source, as long as you use .php as file extension. In some PHP/server setups people can see the source when they type filename.phps, see the installation instruction file in the php package for details. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help needed building query string based on which form fieldsthat are filled.
Don't get your question right, but you get all your vars in the querystring after submitting the form. There, you should check on whether or not the var is filled (i.e. $var or so). There's no other way :-( so your guess is pretty ok. BTW: use Javascript to modify the submitted values. Edwin Anders Thoresson wrote: Hi, I've got a html form where not all fields need to be filled by the users. How can I build a MySQL query based on which fields the user have filled? My guess is that I can do something like this: if(!empty($f_name)) { some_commands_to_add_$f_name_to_querystring } if(!empty($l_name)) { some_commands_to_add_$f_name_to_querystring } some_commands_to_build_querystring_based_on_if's $result = mysql_query($query) But what commands/functions should I use to build the query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Select box won't display in Netscape 4.xx
Hi, I'm developing a website for multiple browsers. In Netscape 4.xx (both Win98 and Linux versions), the php-scripts display the select boxes in my forms only as plain text. I cannot make any selections. In other browsers (NS 6 and IE5), it works fine. Anyone seen this behavior before? Regards, Edwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Need some Linux/Apache help
Hi Todd, Has Apache been restarted ton use the new libphp4.so? And if so, does it use the correct one (you might have another one on your system)? If Apache starts without probs, check the httpd.conf for php mime types. What does Apache respond if you load your test script? Regards, Edwin Todd Cary wrote: Coming from a Windows background, I am having difficulty understanding rpm's, compiling, and making packages. My hope is that someone will have the patience to take me through the steps, since the HowTo's are out of date and do not address my current Red Hat 7.2 environment. With Red Hat 7.2 installed, Apache is installed along with PHP 4.0.6, however, Interbase is not installed Here is what I have done so far: I did a rpm -qa | grep php and found the rpm that was installed.(php-4.0.6-7). When I tried rpm -e php-4.0.6-7, I received a list of php modules that were dependent on it. So, I erased each of those and finally did the rpm -e php-4.0.6-7. Then I put php-4.0.6-7.src.rpm into /tmp and did a rpm -i php-4.0.6-7.rpm which put a tar'd file into /usr/src/redhat/SOURCES. I did tar -xzvf /usr/src/redhat/SOURCES/php-4.0.6pl1.tar.gz which created a directory /tmp/php-4.0.6. I cd'd into that directory and did a ./configure --with-interbase=/opt/interbase --with-apache=/usr/include/apache After quite a period, I received a Thank you for using PHP message. I followed this with a make and a make install. Now Apache does not respond to a testphp.php script that contains phoinfo() and it use to. What have I missed. Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]