Jump to content

straygrey

Members
  • Posts

    37
  • Joined

  • Last visited

About straygrey

  • Birthday 05/13/1939

Contact Methods

  • Website URL
    http://www.stockton.co.za

Profile Information

  • Gender
    Not Telling
  • Location
    Gauteng, South Africa

straygrey's Achievements

Member

Member (2/5)

0

Reputation

  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.
×
×
  • 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.