pwesthead Posted July 13, 2009 Share Posted July 13, 2009 Hi iam trying to play swf files from mysql database, iam using javscript to randomly pull numbers from 1-90 then i use ajax to write to php file and then insert the numbers into the database, this works fine. then i use another php script to get the numbers from the database. here is the php file $calledNumber=$_GET['calledNumber']; $numb = mysql_query("SELECT * FROM number WHERE called= 1 "); if (!$numb) { exit('<p>Error retrieving number from database!<br />'. 'Error: ' . mysql_error(). '</p>'); } while ($called = mysql_fetch_array($numb)) { $id = $called['id']; $calledNumber = htmlspecialchars($called['calledNumber']); echo "$calledNumber "; } ?> <object type="application/x-shockwave-flash" data="movie<?=$calledNumber?>.swf" width="300" height="40"> <param name="movie" value="movie<?=$calledNumber?>.swf" /> </object> i can echo the movie but it wont play the swf file Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/ Share on other sites More sharing options...
ignace Posted July 13, 2009 Share Posted July 13, 2009 Instead of just storing the available numbers, should you better store the path to the swf file and use a query like: SELECT * FROM movies ORDER BY RAND() LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874522 Share on other sites More sharing options...
nbarone Posted July 13, 2009 Share Posted July 13, 2009 using <?=$var ?> is bad practice. you should always use <?php over <? and use <?php echo $var; ?> over <?=$var ?> Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874524 Share on other sites More sharing options...
pwesthead Posted July 13, 2009 Author Share Posted July 13, 2009 Hi ignace i have change the code. now the ajax.php post's the full url plus the number into the database but still no joy can't seem to solve this no matter what i do here is the html code <object type="application/x-shockwave-flash" data="<?=$sitePath?>/movie<?=$calledNumber?>.swf" width="300" height="40"> <param name="movie" value="<?=$sitePath?>/movie<?=$calledNumber?>.swf" /> </object> Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874594 Share on other sites More sharing options...
nbarone Posted July 13, 2009 Share Posted July 13, 2009 There is a good chance there is an error in your object/embed syntax. what's the source look like? Also, as I said before and you completely ignored, <? tags NEED to be replaced with <?php because when you update your PHP version they WILL NOT WORK - if you can't correct your code and use good coding manors don't expect people to sift thru shitty code and try to help you. Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874697 Share on other sites More sharing options...
pwesthead Posted July 13, 2009 Author Share Posted July 13, 2009 Hi iv changed the code like you said, but still no joy <object type="application/x-shockwave-flash" data="<?=$sitePath?>/movie<?=$calledNumber?>.swf" width="300" height="40"> <param name="movie" value="<?php echo $sitePath?>/movie<?php echo $calledNumber?>.swf" /> </object> here is a test page you will see what I'm trying to do http://www.easynet4u.com/bingo/bingo1.php if i use a simple php random script it loads the swf files no problem, so when i use the same pr incable getting a varable from the database why wont it load. here is a basic php script loading swf file <? $r=rand(1,3); ?> <object type="application/x-shockwave-flash" data="movie<?=$r?>.swf" width="300" height="40"> <param name="movie" value="movie<?=$r?>.swf" /> </object> Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874725 Share on other sites More sharing options...
nbarone Posted July 13, 2009 Share Posted July 13, 2009 <?php echo $calledNumber?> should be <?php echo $calledNumber; ?> I'm surprised that doesn't throw a syntax error for you. Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874746 Share on other sites More sharing options...
pwesthead Posted July 13, 2009 Author Share Posted July 13, 2009 Hi haven't got any sintax errors, but still can't get this script to load swf files, i'm baffled Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874767 Share on other sites More sharing options...
nbarone Posted July 13, 2009 Share Posted July 13, 2009 now that we got the BS out of the way does the $calledNumber variable have a value? Like I asked before, please include a copy of the source code (preferably where the flash is) and I'll take a look. The quicker the better...I'm outa here in 30 minutes. Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874776 Share on other sites More sharing options...
pwesthead Posted July 13, 2009 Author Share Posted July 13, 2009 Hi i will try to explain what iam doing , im trying to do a bingo caller script, iam using javascript to get random number then post to php then to the database, this part works fine , then iam selecting the number from the database, and this is the problem, /movie<?php echo $calledNumber?>.swf where $callednumber will be number pulled from the database so it should be move1.swf and so on here is the php code and java iam using. swf.phpfile $numb = mysql_query("SELECT * FROM number WHERE called= 1 "); if (!$numb) { exit('<p>Error retrieving number from database!<br />'. 'Error: ' . mysql_error(). '</p>'); } while ($called = mysql_fetch_array($numb)) { $id = $called['id']; $sitePath= htmlspecialchars($called['sitePath']); $calledNumber= htmlspecialchars($called['calledNumber']); echo "$calledNumber</a>"; } ?> <object type="application/x-shockwave-flash" data="<?php echo $sitePath;?>/movie<?php echo $calledNumber;?>.swf" width="300" height="40"> <param name="movie" value="<?php echo $sitePath;?>/movie<?php echo $calledNumber;?>.swf" /> </object> and the java code var seconds = 2; var divid = "timediv"; var url = "swf.php"; function refreshdiv(){ var xmlHttp; try{ xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support AJAX."); return false; } } } fetch_unix_timestamp = function() { return parseInt(new Date().getTime().toString().substring(0, 10)) } var timestamp = fetch_unix_timestamp(); var nocacheurl = url+"?t="+timestamp; xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById(divid).innerHTML=xmlHttp.responseText; setTimeout('refreshdiv()',seconds*1000); } } xmlHttp.open("GET",nocacheurl,true); xmlHttp.send(null); } var seconds; window.onload = function startrefresh(){ setTimeout('refreshdiv()',seconds*1000); } Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874785 Share on other sites More sharing options...
nbarone Posted July 13, 2009 Share Posted July 13, 2009 please post the code your browser is giving you (right click> view source) I am trying to determine wether the variable is getting passed or not Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874789 Share on other sites More sharing options...
pwesthead Posted July 13, 2009 Author Share Posted July 13, 2009 here is the code after right click <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <HTML><HEAD> <TITLE>JavaScript bingo caller - evilstreak</TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <LINK href="bingo.css" type=text/css rel=stylesheet> <SCRIPT src="bingo.js" type=text/javascript></SCRIPT> <SCRIPT src="number.js" type=text/javascript></SCRIPT> <META content="MSHTML 6.00.6001.18248" name=GENERATOR> <style type="text/css"> <!-- body { background-color: #0033CC; } --> </style> </HEAD> <body onLoad="callNewNumber('main','ajax.php','swf.php')"> <DIV id=controlPanel> <DIV id=latestNumber>00</DIV> <UL id=calledNumbers> <script type="text/javascript"> refreshdiv(); </script> <div name="timediv" id="timediv"></div> <LI class=uncalled id=calledNumber_1>1</LI> <LI class=uncalled id=calledNumber_2>2 </LI> <LI class=uncalled id=calledNumber_3>3 </LI> <LI class=uncalled id=calledNumber_4>4 </LI> <LI class=uncalled id=calledNumber_5>5 </LI> <LI class=uncalled id=calledNumber_6>6 </LI> <LI class=uncalled id=calledNumber_7>7 </LI> <LI class=uncalled id=calledNumber_8>8 </LI> <LI class=uncalled id=calledNumber_9>9 </LI> <LI class=uncalled id=calledNumber_10>10 </LI> <LI class=uncalled id=calledNumber_11>11 </LI> <LI class=uncalled id=calledNumber_12>12 </LI> <LI class=uncalled id=calledNumber_13>13 </LI> <LI class=uncalled id=calledNumber_14>14 </LI> <LI class=uncalled id=calledNumber_15>15 </LI> <LI class=uncalled id=calledNumber_16>16 </LI> <LI class=uncalled id=calledNumber_17>17 </LI> <LI class=uncalled id=calledNumber_18>18 </LI> <LI class=uncalled id=calledNumber_19>19 </LI> <LI class=uncalled id=calledNumber_20>20 </LI> <LI class=uncalled id=calledNumber_21>21 </LI> <LI class=uncalled id=calledNumber_22>22 </LI> <LI class=uncalled id=calledNumber_23>23 </LI> <LI class=uncalled id=calledNumber_24>24 </LI> <LI class=uncalled id=calledNumber_25>25 </LI> <LI class=uncalled id=calledNumber_26>26 </LI> <LI class=uncalled id=calledNumber_27>27 </LI> <LI class=uncalled id=calledNumber_28>28 </LI> <LI class=uncalled id=calledNumber_29>29 </LI> <LI class=uncalled id=calledNumber_30>30 </LI> <LI class=uncalled id=calledNumber_31>31 </LI> <LI class=uncalled id=calledNumber_32>32 </LI> <LI class=uncalled id=calledNumber_33>33 </LI> <LI class=uncalled id=calledNumber_34>34 </LI> <LI class=uncalled id=calledNumber_35>35 </LI> <LI class=uncalled id=calledNumber_36>36 </LI> <LI class=uncalled id=calledNumber_37>37 </LI> <LI class=uncalled id=calledNumber_38>38 </LI> <LI class=uncalled id=calledNumber_39>39 </LI> <LI class=uncalled id=calledNumber_40>40 </LI> <LI class=uncalled id=calledNumber_41>41 </LI> <LI class=uncalled id=calledNumber_42>42 </LI> <LI class=uncalled id=calledNumber_43>43 </LI> <LI class=uncalled id=calledNumber_44>44 </LI> <LI class=uncalled id=calledNumber_45>45 </LI> <LI class=uncalled id=calledNumber_46>46 </LI> <LI class=uncalled id=calledNumber_47>47 </LI> <LI class=uncalled id=calledNumber_48>48 </LI> <LI class=uncalled id=calledNumber_49>49 </LI> <LI class=uncalled id=calledNumber_50>50 </LI> <LI class=uncalled id=calledNumber_51>51 </LI> <LI class=uncalled id=calledNumber_52>52 </LI> <LI class=uncalled id=calledNumber_53>53 </LI> <LI class=uncalled id=calledNumber_54>54 </LI> <LI class=uncalled id=calledNumber_55>55 </LI> <LI class=uncalled id=calledNumber_56>56 </LI> <LI class=uncalled id=calledNumber_57>57 </LI> <LI class=uncalled id=calledNumber_58>58 </LI> <LI class=uncalled id=calledNumber_59>59 </LI> <LI class=uncalled id=calledNumber_60>60 </LI> <LI class=uncalled id=calledNumber_61>61 </LI> <LI class=uncalled id=calledNumber_62>62 </LI> <LI class=uncalled id=calledNumber_63>63 </LI> <LI class=uncalled id=calledNumber_64>64 </LI> <LI class=uncalled id=calledNumber_65>65 </LI> <LI class=uncalled id=calledNumber_66>66 </LI> <LI class=uncalled id=calledNumber_67>67 </LI> <LI class=uncalled id=calledNumber_68>68 </LI> <LI class=uncalled id=calledNumber_69>69 </LI> <LI class=uncalled id=calledNumber_70>70 </LI> <LI class=uncalled id=calledNumber_71>71 </LI> <LI class=uncalled id=calledNumber_72>72 </LI> <LI class=uncalled id=calledNumber_73>73 </LI> <LI class=uncalled id=calledNumber_74>74 </LI> <LI class=uncalled id=calledNumber_75>75 </LI> <LI class=uncalled id=calledNumber_76>76 </LI> <LI class=uncalled id=calledNumber_77>77 </LI> <LI class=uncalled id=calledNumber_78>78 </LI> <LI class=uncalled id=calledNumber_79>79 </LI> <LI class=uncalled id=calledNumber_80>80 </LI> <LI class=uncalled id=calledNumber_81>81 </LI> <LI class=uncalled id=calledNumber_82>82 </LI> <LI class=uncalled id=calledNumber_83>83 </LI> <LI class=uncalled id=calledNumber_84>84 </LI> <LI class=uncalled id=calledNumber_85>85 </LI> <LI class=uncalled id=calledNumber_86>86 </LI> <LI class=uncalled id=calledNumber_87>87 </LI> <LI class=uncalled id=quotetext_88>88 </LI> <LI class=uncalled id=$quotetext_89>89 </LI> <LI class=uncalled id=$quotetext_90>90 </LI></UL> <div id="Layer1" style="position:absolute; width:935px; height:115px; z-index:1; left: 158px; top: 164px;"></div> <table width="943" height="148" align="center" background="head.jpg" bgcolor="#CC99CC"> <tr> </td> </tr> </table> </DIV> </BODY></HTML> Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874797 Share on other sites More sharing options...
nbarone Posted July 13, 2009 Share Posted July 13, 2009 ok, so your code is never getting to the flash video because of an error in your php somewhere. Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874798 Share on other sites More sharing options...
pwesthead Posted July 13, 2009 Author Share Posted July 13, 2009 i have checked the php files and no error's if i print $calledNumer that works, really new to playing flash on websites, its driving me insane. Quote Link to comment https://forums.phpfreaks.com/topic/165794-php-echo-command-in-flash/#findComment-874804 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.