Jump to content

straygrey

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by straygrey

  1. I have two tables as follows mysql> desc Accounts; +---------------+-----------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+-----------------+------+-----+---------+----------------+ | id | int(6) unsigned | NO | PRI | NULL | auto_increment | | Name | varchar(30) | NO | | NULL | | | Type | tinyint(1) | YES | | 0 | | | Balance | decimal(10,2) | YES | | 0.00 | | | Taxes | tinyint(1) | YES | | 0 | | | Investment | tinyint(1) | YES | | 0 | | | AccountNumber | int(11) | YES | | 0 | | +---------------+-----------------+------+-----+---------+----------------+ and the other mysql> desc Transactions; +-------------+-----------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-----------------+------+-----+-------------------+----------------+ | id | int(6) unsigned | NO | PRI | NULL | auto_increment | | Datum | timestamp | NO | | CURRENT_TIMESTAMP | | | ChequeNo | varchar(12) | YES | | NULL | | | Description | varchar(30) | NO | | NULL | | | Notes | varchar(30) | YES | | NULL | | | Value | decimal(10,2) | NO | | NULL | | | ToAccount | varchar(30) | NO | | NULL | | | FromAccount | varchar(30) | NO | | NULL | | | Cleared | tinyint(1) | YES | | 0 | | +-------------+-----------------+------+-----+-------------------+----------------+ I want to retrieve all Transaction based on the ID in the Accounts table. I have tried the following without success. mysql> select * from Transactions join Accounts on Transactions.FromAccount="Account.Name" where Accounts.ID="30"; Empty set (0.01 sec) mysql> select * from Transactions left join Accounts on Transactions.FromAccount="Account.Name" where Accounts.ID="30"; Empty set (0.00 sec) mysql> select * from Transactions left join Accounts on Accounts.ID="30" where Transactions.FromAccount="Account.Name"; Empty set (0.00 sec) this despite a select * from Transactions where FromAccount="Standard Bank"; returning 130 rows. In other words what I want is on retrieving the Account row based on its ID I want to use that Accounts Name to retrieve all pertanent records. Please make suggestions.
  2. I specifically asked this in the Windows area because I need a Windows solution. I already have Linux solutions.
  3. Is there a method whereby I can find out who is connected to the intranet I am currently connected to. Possibly interrogate the local router?
  4. In PHP what would be the best method of counting how many rows are contained in the following:- object(stdClass)#5 (1) { ["GetMediaListResult"] => object(stdClass)#6 (1) { ["string"] => array(3) { [0] => string(5) "1.mp4" [1] => string(5) "2.mp4" [2] => string(5) "3.jpg" } } } obviously the answer is 3 but how to get this in a PHP program?
  5. Please tell me how to extract the last data item, namely "3.jpg" from the following object. BTW The last item will not necessarily only ever be the third entry. There could be more or for that matter less. object(stdClass)#5 (1) { ["GetMediaListResult"]=> object(stdClass)#6 (1) { ["string"]=> array(3) { [0]=> string(5) "1.mp4" [1]=> string(5) "2.mp4" [2]=> string(5) "3.jpg" } } }
  6. BTW Part of the problem may be to overwrite the file if the Server file size is different to that of the Client.
  7. I need to move a media file from a Server to Client via PHP limiting the amount of bandwidth used. Both Client and Server on a local intranet. Possibly by moving chunks at a time, thereby allowing other operations on the intranet to get a slice of the bandwidth. An example of size is 1596875bytes for the 1st one. Can someone please suggest a preferred method for me to use to achieve this?
  8. Please tell me how I would extract the data line by line from the following which was returned from a call to a webservice. object(stdClass)#7 (1) { ["GetMediaListResult"]=> object(stdClass)#8 (1) { ["string"]=> array(2) { [0]=> string(5) "1.mp4" [1]=> string(5) "2.mp4" } } } What I require is to get the string "1.mp4" into a variable followed by "2.mp4" into another variable.
  9. I have written the following code as a client on Linux in an attempt to understand how a webservice running on a Windows 7 PC works. <?php $client = new SoapClient("http://192.168.0.10/CISWebService/Mediamanager.asmx?WSDL"); $result = $client->GetSequenceNo(array()); $response_arr = objectToArray($result); // print_r($response_arr); var_dump($response_arr); // $arrlength=count($response_arr); // echo $arrlength; function objectToArray($d) { // var_dump($d); if (is_object($d)) { $d = get_object_vars($d); } var_dump($d); if (is_array($d)) { return array_map(__FUNCTION__, $d); } else { return $d; } } ?> I get the following returned and displayed via the two var_dump() calls. array(6) { ["iServerNo"]=> int(0) ["iClientNo"]=> int(0) ["bNoLimitDownload"]=> bool(false) ["dtStartDate"]=> string(19) "0001-01-01T00:00:00" ["dtEndDate"]=> string(19) "0001-01-01T00:00:00" ["dtServerTime"]=> string(19) "0001-01-01T00:00:00" } int(0) int(0) bool(false) string(19) "0001-01-01T00:00:00" string(19) "0001-01-01T00:00:00" string(19) "0001-01-01T00:00:00" array(1) { ["GetSequenceNoResult"]=> array(6) { ["iServerNo"]=> int(0) ["iClientNo"]=> int(0) ["bNoLimitDownload"]=> bool(false) ["dtStartDate"]=> string(19) "0001-01-01T00:00:00" ["dtEndDate"]=> string(19) "0001-01-01T00:00:00" ["dtServerTime"]=> string(19) "0001-01-01T00:00:00" } } I suspect that I need to extract the value of iServerNo and iClientNo from either the returned object or the array created by my copied code. My question is how do I get these values into individual variables? In other words I would like to populate $iServerNo and $iClientNo but do not understand how.
  10. Please tell me why the following html does not call the javascript submit_click() function. <!DOCTYPE html> <html> <head> <title>Page Title</title> <meta name="[url=""]viewport[/url]" content="[url=""]width=device-width,initial-scale=1[/url]"> <link rel="[url=""]stylesheet[/url]" type="[url=""]text/css[/url]" href="[url="view-source:http://localhost/prince/style/style.css"]style/style.css[/url]"/> <script language="[url=""]Javascript[/url]" type="[url=""]text/javascript[/url]" src="[url="view-source:http://localhost/prince/js/Diva.js"]js/Diva.js[/url]"></script> <style type="[url=""]text/css[/url]">a {text-decoration: none}</style> <script language=[url=""]javascript[/url]> function submit_click() { alert("Button Pressed"); progExe("logon.php?"uname="+uname+"&Passwrd="+passwrd); } </script> </head> <body> <!--- <form name="logon" ID="logon" action="logon.php" method="post"> --> <table align="[url=""]center[/url]" border="[url=""]3[/url]" cellspacing="[url=""]0[/url]" cellpadding="[url=""]3[/url]"> <tr><td>Username:</td><td> <input type="[url=""]text[/url]" name="[url=""]uname[/url]" id=[url=""]uname[/url] maxlength="[url=""]40[/url]" placeholder="[url=""]Enter your UserName[/url]" autofocus required> </td></tr> <tr><td>Password:</td> <td> <input type="[url=""]password[/url]" name="[url=""]passwrd[/url]" id=[url=""]passwrd[/url] maxlength="[url=""]50[/url]" placeholder="[url=""]Password[/url]" required> </td></tr> <tr><td colspan="[url=""]3[/url]" align="[url=""]center[/url]"> <button type="[url=""]button[/url]" onclick="[url=""]submit_click()[/url]">Logon</button> <a href="[url="view-source:http://localhost/prince/register.html"]register.html[/url]"><input type=[url=""]submit[/url] value="[url=""]RegisterSelf[/url]"> <a href="[url="view-source:http://localhost/prince/client.html"]client.html[/url]"><input type=[url=""]submit[/url] value="[url=""]RegisterClient[/url]"> </td></tr> </table> <center> <div id="[url=""]loadingNode[/url]";></div> </center> </body> </html>
  11. I have followed the procedure at http://community.linuxmint.com/tutorial/view/486 to install LAMP on my Mint 13 laptop with a view to developing locally & once working emigrate to my server but ...... the following simple HTML only displays the title(No image). The image does exist in the images folder & it makes no difference if I refer to it with ./images/prince.jpg or images/prince.jpg. Please tell me how I got the install wrong. <!DOCTYPE html> <html> <title>Jim Beam</title> <meta name="author" content="Alf C Stockton"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="Mon, 22 Jul 2000 11:12:01 GMT" /> <meta name="viewport" content="width=device-width,initial-scale=1"> <script language="Javascript" src="./js/prince.js"></script> </head> <body> <center> <img src="./images/prince.jpg" alt="Jim Beam" usemap="#prince" /> <map name="prince"> <area shape="rect" coords="300,170,350,200" onclick="javascript:gotoFirst();" /> <area shape="rect" coords="530,245,540,255" onclick="javascript:gotoSecond();" /> <area shape="rect" coords="520,180,540,200" onclick="javascript:gotoThird();" /> </map> </body> </html> BTW Something very similar works fine on my website at http://www.stockton.co.za/doc/jones
  12. Use $Result = mysql_query($SQL); not $Result = mysql_query($SQL, $link);
  13. My php script looks like:- global $UserNum, $UserName, $Password, $JackpotLevel, $Mailshot, $IPAddress, $LastLogon, $ip; $date = date('Y-m-d H:i:s'); $ip = '127.0.0.1'; echo "DingALing = ".$UserNum." ".$UserName." ".$Password." ".$JackpotLevel." ".$Mailshot." ".$IPAddress." ".$LastLogon."<br />"; $SQL = sprintf("INSERT INTO users(Name, Password, JackpotLevel, Mailshot, IPAddress) VALUES ('%s', '%s', '%d', '%d', '%s');", $UserName, $Password, $JackpotLevel, $Mailshot, $ip); $Result = mysql_query($SQL, $link); if (!$Result) die('Invalid query: '.$SQL." ".mysql_error()." ".$Result); I get the following error DingALing = root@asdfghjkl N0B17ch 100000 yes Invalid query: INSERT INTO users(Name, Password, JackpotLevel, Mailshot, IPAddress) VALUES ('root@asdfghjkl', 'N0B17ch', '100000', '0', '127.0.0.1'); but if I now attempt the insert from the command line I get the following success. mysql> describe users; +--------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+----------------+ | UserNum | int(4) | NO | PRI | NULL | auto_increment | | Name | varchar(35) | YES | | NULL | | | Password | varchar(15) | NO | | NULL | | | JackpotLevel | int(4) | NO | | NULL | | | Mailshot | smallint(2) | YES | | NULL | | | IPAddress | varchar(30) | YES | | NULL | | | lastlogin | datetime | YES | | NULL | | +--------------+-------------+------+-----+---------+----------------+ 7 rows in set (0.00 sec) mysql> select * from users; Empty set (0.00 sec) mysql> INSERT INTO users(Name, Password, JackpotLevel, Mailshot, IPAddress) VALUES ('root@asdfghjkl', 'N0B17ch', '100000', '0', '127.0.0.1'); Query OK, 1 row affected (0.00 sec) mysql> select * from users; +---------+----------------+----------+--------------+----------+-----------+-----------+ | UserNum | Name | Password | JackpotLevel | Mailshot | IPAddress | lastlogin | +---------+----------------+----------+--------------+----------+-----------+-----------+ | 1 | root@asdfghjkl | N0B17ch | 100000 | 0 | 127.0.0.1 | NULL | +---------+----------------+----------+--------------+----------+-----------+-----------+ 1 row in set (0.00 sec) Please tell me what I have done wrong.
  14. What is the difference between $foo = Bar::getInstance(), and $foo = &Bar::getInstance(), assuming Bar::getInstance() returns an instance of the class named “Bar”? Does &Bar return the address of rather than the instance?
  15. My user needs me to update the database on their server from data contained in a text file but do not want me to upload the text file to the server but rather read the file from wherever it exists. Across the intranet. Uploading the file means that whomsoever needs to do this update requires write permission to a folder on the server & my user does not want that. Suggestions on how I should solve this problem would be greatly appreciated. BTW My code works fine if I upload the file and do the update in place on the server.
  16. Sorry, that was sloppy of me. I'll fix it and test again. Thanks.
  17. That is exactly what I want to do, gizmola.
  18. We need to check that todays backup file exists & if not email responsible person.
  19. Is there a way for me to connect to a directory on a NAS server running a windows share from PHP. I can connect from the command line using mount, but I want the connect within my PHP script. Can this be done & if so how?
  20. I have php 5.3.2 cli and Apache working fine on my Ubuntu 10.4 but now I need to add access to Oracle database(which in fact I have in and running on the same machine). How do I add the Oracle (oci8) extension? From what I have read it looks like a recompile, is this true?
  21. An example in this folder is:- -rw-r--r-- 1 alf alf 20 2005-03-30 10:36 info.php which as far as I know should be adequate?
  22. I have obviouslt done something wrong for I get the following errors/warnings when running a simple script:- Warning: include(/var/www/www.stockton.co.za/doc/kiosk/includes/body-background.inc) [function.include]: failed to open stream: Permission denied in /var/www/www.stockton.co.za/doc/kiosk/MostRecent.php on line 10 Warning: include() [function.include]: Failed opening '/var/www/www.stockton.co.za/doc/kiosk/includes/body-background.inc' for inclusion (include_path='/var/www/www.stockton.co.za/doc/kiosk/includes') in /var/www/www.stockton.co.za/doc/kiosk/MostRecent.php on line 10 Warning: include(includes/error-handler.inc) [function.include]: failed to open stream: Permission denied in /var/www/www.stockton.co.za/doc/kiosk/MostRecent.php on line 11 Warning: include() [function.include]: Failed opening 'includes/error-handler.inc' for inclusion (include_path='/var/www/www.stockton.co.za/doc/kiosk/includes') in /var/www/www.stockton.co.za/doc/kiosk/MostRecent.php on line 11 Warning: include(includes/get-input.inc) [function.include]: failed to open stream: Permission denied in /var/www/www.stockton.co.za/doc/kiosk/MostRecent.php on line 12 Warning: include() [function.include]: Failed opening 'includes/get-input.inc' for inclusion (include_path='/var/www/www.stockton.co.za/doc/kiosk/includes') in /var/www/www.stockton.co.za/doc/kiosk/MostRecent.php on line 12 Fatal error: Call to undefined function mssql_connect() in /var/www/www.stockton.co.za/doc/kiosk/MostRecent.php on line 14 this from the code :- <?php ini_set('include_path', dirname(__FILE__) .'/includes'); // require_once(dirname(__FILE__) . "/includes/body-background.php"); include(dirname(__FILE__) .'/includes/body-background.inc'); include('includes/error-handler.inc'); include('includes/get-input.inc'); Please tell me what I have done wrong. This with Apache2 on Ubuntu 10.4 and php 5.3.
  23. I have created an Oracle database on my Windows XP system but cannot connect from a php script <?php if (!$db = @ocilogon("big", "big", "s7s")) { $error = ocierror(); printf("Error was: %s", $error["message"]); die(); } $stmt = ociparse($db,"SELECT count(*) FROM members"); ociexecute($stmt); ?> When I created the database the connection I used was s7s but whether or not I include that name or just use the ID/password that script will not connect. Please tell me what else I need to do to get this to work.
  24. C:\Documents and Settings\User>dir c:\oracle\product\10.1.0\Db_1\database Volume in drive C is Programs Volume Serial Number is F8A5-02EE Directory of c:\oracle\product\10.1.0\Db_1\database 2009/07/30 01:21 PM <DIR> . 2009/07/30 01:21 PM <DIR> .. 2009/07/23 03:58 PM <DIR> archive 2009/07/27 06:57 PM 106 core_orcl_1096_1156_2009_7_27_15_52_24.log 2009/07/26 01:27 PM 106 core_orcl_1104_1176_2009_7_26_11_53_59.log 2009/07/26 01:29 PM 106 core_orcl_1308_1388_2009_7_26_13_29_12.log 2009/07/28 07:26 PM 106 core_orcl_1908_2060_2009_7_28_12_21_18.log 2009/07/23 08:27 PM 106 core_orcl_2436_2508_2009_7_23_17_27_39.log 2009/07/23 05:26 PM 106 core_orcl_2532_2628_2009_7_23_16_7_43.log 2009/07/25 06:57 PM 106 core_orcl_2888_3620_2009_7_25_10_45_40.log 2009/07/28 12:19 PM 106 core_orcl_436_460_2009_7_28_12_12_44.log 2009/07/26 05:01 PM 106 core_orcl_752_1108_2009_7_26_13_36_16.log 2009/07/28 08:29 AM 106 core_orcl_972_1120_2009_7_28_6_44_56.log 2009/07/24 06:48 PM 106 core_orcl_980_1132_2009_7_24_17_39_10.log 2009/07/23 04:01 PM 2,048 hc_orcl.dat 2009/07/23 03:54 PM 31,744 oradba.exe 2009/07/23 04:02 PM 1,536 PWDorcl.ora 2009/07/30 01:09 PM 2,048 PWDsqm.ora
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.