Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. Don't forget to add the arguments to the function call: <?php $request['RequestedShipment'] = array( 'ShipTimestamp' => date('c'), 'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION 'ServiceType' => 'FEDEX_EXPRESS_SAVER', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ... 'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... 'TotalWeight' => array('Value' => 1.0, 'Units' => 'LB'), // valid values LB and KG 'Shipper' => addShipper(), ////////////////////**** FUNCTION CALL *****////////////////////////// 'Recipient' => addRecipient(), 'ShippingChargesPayment' => addShippingChargesPayment(), 'SpecialServicesRequested' => addSpecialServices(), 'LabelSpecification' => addLabelSpecification(), 'RateRequestTypes' => array('ACCOUNT'), // valid values ACCOUNT and LIST 'PackageCount' => 1, 'RequestedPackageLineItems' => array( '0' => addPackageLineItem1() ) ); [/code]
  2. Did you dump $items to make sure it contained the index?
  3. Anytime you hit the IMDb web page looking for data, copying it for re-use, it is screen scraping. The only way around that is an API. IMDb also has a policy against image leeching, and some fake API's will use a proxy service to get around that policy. There are legitimate API's out there that use the data files provided by IMDb, but are far and few between. Seek and ye shall find. Hint: dean clatworthy
  4. Either the files do not exist, or the permissions on the folder/files do not let the server access them. Check the paths for the files, if they are there, change the permissions to let the server have access.
  5. Where is mysqli_stmt_init?
  6. I'm not sure that is being returned from the PHP parser. What MVC or CMS are you using? I assume it is Joomla, because of the Mod name.
  7. Have you tried using mysqli_stmt_error? This will tell you exactly what went wrong.
  8. Yes, post_id is set in his query string. At the top of your script, place the following code: echo '<pre>' . print_r($_GET,true) . '</pre>';
  9. He wants you to write the word JOIN instead of using comma's, sometimes you run into a "unknown column name" with the comma syntax. Like: SELECT e.name AS event, t.name AS town, v.name AS vehicle, vt.name AS vehicleType, vt.style AS vehicleStyle, p.base AS price FROM EVENTS AS e JOIN ( towns AS t JOIN vehicles AS v JOIN vehicle_type AS vt JOIN price AS p ) ON ( e.town_id = t.id ) WHERE v.id IN ( SELECT vehicle_id FROM vehicle_event WHERE event_id = e.id ) AND v.type = vt.id AND v.price_id = p.id
  10. If it were me, I would change the ext to .php and use the header content-type to force it back to javascript. Alternatively you could make the server parse all .js files as PHP, which is horrible IMHO. Especially if you only have 1 file that needs parsing. .htaccess AddType application/x-httpd-php .js You may even have to make that: AddType application/x-httpd-php5 .js if you are on a host like GoDaddy
  11. while($rowzz = mysql_fetch_array($display2)) { if(!empty($rowzz['axes'])) { echo ' <tr> <td id="text3"> <input type="radio" name="axes" size="1" value="' .$rowzz['axes']. '">' .$rowzz['axes']. '<br> </td> </tr> '; } }
  12. or, above the public directory.
  13. So, lets dissect your problem, then find a good solution. We must go through the database Normalization, as there should never be duplicate data stored. It just causes confusion, and complicates the exchange of data. Relationships = A = 1 to 1 (ie 1 town to 1 vehicle) B = 1 to many (ie 1 town to many vehicles) C = many to many (ie many towns to many vehicles) 1. Towns to vehicle = B? 1 town to many vehicles 2. Towns to events = A? 1 town to 1 event 3. events to vehicles = C? many events to many vehicles So, Here is how I would do it. Database Dump, (with some sample data) -- -- Table structure for table `events` -- CREATE TABLE IF NOT EXISTS `events` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `town_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `events` -- INSERT INTO `events` (`id`, `name`, `time`, `town_id`) VALUES (1, 'Wedding ', '2012-01-23 02:24:57', 2), (2, 'Car Show', '2012-01-23 02:24:57', 3), (3, 'Party', '2012-01-23 02:24:57', 4), (4, 'Tea Party', '2012-01-23 02:24:57', 1); -- -------------------------------------------------------- -- -- Table structure for table `price` -- CREATE TABLE IF NOT EXISTS `price` ( `id` int(11) NOT NULL AUTO_INCREMENT, `base` float(10,2) NOT NULL, `modifier` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data for table `price` -- INSERT INTO `price` (`id`, `base`, `modifier`) VALUES (1, 120.99, 2), (2, 250.99, 2); -- -------------------------------------------------------- -- -- Table structure for table `towns` -- CREATE TABLE IF NOT EXISTS `towns` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `postcode` int(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `towns` -- INSERT INTO `towns` (`id`, `name`, `postcode`) VALUES (1, 'New York', 0), (2, 'Chicago', 0), (3, 'Las Vegas', 0), (4, 'Houston', 0); -- -------------------------------------------------------- -- -- Table structure for table `vehicles` -- CREATE TABLE IF NOT EXISTS `vehicles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `type` int(11) NOT NULL, `price_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Dumping data for table `vehicles` -- INSERT INTO `vehicles` (`id`, `name`, `type`, `price_id`) VALUES (1, '2012 Crown Victoria', 3, 1), (2, '2011 Chevy Box Truck', 2, 1), (3, 'Lamborghini Gallardo', 4, 2); -- -------------------------------------------------------- -- -- Table structure for table `vehicle_event` -- CREATE TABLE IF NOT EXISTS `vehicle_event` ( `vehicle_id` int(11) NOT NULL, `event_id` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `vehicle_event` -- INSERT INTO `vehicle_event` (`vehicle_id`, `event_id`) VALUES (2, 3), (2, 4), (1, 2), (1, 4), (4, 2), (4, 3), (3, 1), (3, 3); -- -------------------------------------------------------- -- -- Table structure for table `vehicle_type` -- CREATE TABLE IF NOT EXISTS `vehicle_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `style` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `vehicle_type` -- INSERT INTO `vehicle_type` (`id`, `name`, `style`) VALUES (1, 'Sedan', 'Convertible'), (2, 'Van', 'Styleside'), (3, 'Sedan', 'Coupe'), (4, 'Sports', 'Exotic'); Here is the query SELECT e.name AS event, t.name AS town, v.name AS vehicle, vt.name AS vehicleType, vt.style AS vehicleStyle, p.base AS price FROM EVENTS AS e JOIN ( towns AS t, vehicles AS v, vehicle_type AS vt, price AS p ) ON ( e.town_id = t.id ) WHERE v.id IN ( SELECT vehicle_id FROM vehicle_event WHERE event_id = e.id ) AND v.type = vt.id AND v.price_id = p.id There is really to much to explain, and not enough space to do it, read that as, I can't explain it well enough for you to comprehend it. I would suggest you watching .
  14. When you are working with joins, it is important that you know what each type of join does. It is equally important to know how each joining clause works (USING, ON). While you have discovered the underlying problem (USING clause must contain a column that exists in all tables. You should also be aware of mixing JOINing types. After we get that out of the way, there lies only one question. How is the town table tied to the data you wish to retrieve from the other tables?
  15. It is not an error in the query. You need to loop through the results to get them all. $q=mysql_query("SELECT * FROM papercontent LIMIT 5",$c); //run the query. echo "<center><table width = '40%' border = '1'><tr><th> <center><u>Latest Announcements</u></center>"; //print the first part of the table. while($content=mysql_fetch_row($q)) { //while there are rows left in the database (fetch_row pulls a numeric array, fetch_assoc pulls an associative array) echo "<tr><td>{$content[0]}</td></tr></td>"; //print a new row, with the first column of the database row. } echo '</table>'; //close the table after all rows are finished.
  16. Does the client Log In? I would suggest that you create a folder for each client in your image folder. Then create a new unique name for the image (be careful of collisions). Maybe a random string, then hashed. Insert the file name into the database, tying it back to the user's table. If you put 3 images into each folder, that would create a mess of folders, I would keep them all in one.
  17. What is the error? json_last_error
  18. FTP inside of PHP
  19. No, it will produce an array that looks like: ]Array ( [55408] => Array ( [url] => a [name] => b [55412] => Array ( [url] => e [name] => f ) Because the key of zipcode can only hold one index name url, and one index name name. In order to build the array like you expected it to, you would have to build it as. <?php for($i = 0; $i < 10; $i++) { $places[$zip['code']][$i]['url'] = $row['url']; $places[$zip['code']][$i]['name'] = $row['name']; } That way you create the additional keys needed.
  20. If you care to look at the manual, you will see at the bottom of the "others" page, the one with Canada/Eastern on it. There is a warning.
  21. You should also look up the default timezone in the manual, so you can input a correct timezone. They are listed there.
  22. OK, I'll attempt this, even though I am not 100% sure what the data holds. <?php $battleno = $_POST['battleno']; //integer? $asname = $_POST['asname']; //array of names that matches the count of the amon array BEFORE taking out empty values? $amon = $_POST['amon']; //amon array. $combined = array_combine($asname,$amon); //combine the arrays, so that asname is keys, and amon is values. foreach ($combined as $asn => $am) { if(!empty($am)) { $parts[] = "('$battleno' , '$asn' , '$am')"); } //if amon is not empty, add it to the query. } $query = "INSERT INTO `assetlist` (`battleid` , `asset` , `amount`) VALUES " . implode(', ',$parts); mysql_query($sql) or trigger_error($query . ' has encountered an error: <br />' . mysql_error());
  23. Pass it to array_filter without a callback. Read the note under the callback parameter.
  24. Blacknight's code will error out. The advice is sound though. Using the same theory, it should be closer to: $places = array(); while($row = mysql_fetch_array($qry_result)) { $places[$row['zip']][$row['server_url']] = $row['name']; } echo "<table id=query_result align=left>"; foreach ($places as $place => $d) { echo "<tr>"; echo "<th><b>$place</b></th>"; echo "</tr>"; foreach ($d as $n => $r) { echo "<tr>"; echo "<td><a href=$n rel=ajaxDiv>$r</a></td>"; echo "</tr>"; } } The reason the original will not work is, //$n is both url and name, $r is both the value of url and the value of name indexes. //This will leave you two rows for every value you wanted to show, //and will error out because $r is NOT an array, so it doesn't have indexes. foreach ($d as $n => $r) { echo "<tr>"; echo "<td><a href=$r[url] rel=ajaxDiv>$r[name]</a></td>"; echo "</tr>"; }
  25. It is very likely that is how they have it. Although, there are multiple ways you can do it. 1. AJAX, this method will submit data to the server without reloading the page. 2. PHP is able to send the data to a second page, check it, then re-direct back to the main page, behind the scenes. 3. PHP can also use if/else clauses to do the same affect. So there is not 1 defined way of doing anything in PHP. Although, everyone will have their own opinions of what 'right' is. However, when thinking of designing anything that relates to databases, and/or a user base, there are fundamentals that must be addressed. 1. security a. user information protection. b. site protection. 2. data a. integrity b. validation. There are other things, but I personally think those are the MOST important. There is one VERY important thing about MySQL that many fail to learn until it causes a full re-write of their code base. And that is normalization. , it would be wise to watch these 9 videos.
×
×
  • 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.