Jump to content

cutielou22

Members
  • Content count

    58
  • Joined

  • Last visited

Community Reputation

1 Neutral

About cutielou22

  • Rank
    Regular Member
  • Birthday 07/22/1993

Contact Methods

  • Website URL
    http://mandyjosmith.com

Profile Information

  • Gender
    Female
  • Location
    USA
  • Interests
    Programming, music, games, tv.
  1. cutielou22

    Javascript Pop Up Alert

    It also automatically chooses the last one no matter which one is picked from the list to delete. It also does not actually delete a selection if added. It goes right to the next one. (THIS HOWEVER DID WORK BEFORE) <<For when choosing "Yes".
  2. cutielou22

    Javascript Pop Up Alert

    I am working with the code from this: https://codepen.io/adventuresinmissions/pen/nrhHF I have made my own slight changes, but I am having a problem. I am getting data from a mysql table. If the page has more than one element (or row) from the table shown it will pop up the popup for each - if hitting "No" or "Cancel". I just want it to show one pop up and go away. Not go to the next pop up/row. Hope that makes sense. The Code I am Using on the Page: ECHO<<<END <script> jQuery(document).ready(function($){ //open popup $('.cd-popup-trigger$count').on('click', function(event){ event.preventDefault(); $('.cd-popup').addClass('is-visible'); }); //close popup $('.cd-popup').on('click', function(event){ if( $(event.currentTarget).is('.cd-popup-close') || $(event.currentTarget).is('.cd-popup') ) { event.preventDefault(); $(this).removeClass('is-visible'); } }); //close popup when clicking the esc keyboard button $(document).keyup(function(event){ if(event.which=='27'){ $('.cd-popup').removeClass('is-visible'); } }); }); </script> <style> .img-replace { /* replace text with an image */ display: inline-block; overflow: hidden; text-indent: 100%; color: transparent; white-space: nowrap; } .cd-popup { position: fixed; left: 0; top: 0; height: 100%; width: 100%; background-color: rgba(94, 110, 141, 0.9); opacity: 0; visibility: hidden; -webkit-transition: opacity 0.3s 0s, visibility 0s 0.3s; -moz-transition: opacity 0.3s 0s, visibility 0s 0.3s; transition: opacity 0.3s 0s, visibility 0s 0.3s; } .cd-popup.is-visible { opacity: 1; visibility: visible; -webkit-transition: opacity 0.3s 0s, visibility 0s 0s; -moz-transition: opacity 0.3s 0s, visibility 0s 0s; transition: opacity 0.3s 0s, visibility 0s 0s; } .cd-popup.show_button { opacity: 1; visibility: visible; -webkit-transition: opacity 0.3s 0s, visibility 0s 0s; -moz-transition: opacity 0.3s 0s, visibility 0s 0s; transition: opacity 0.3s 0s, visibility 0s 0s; display: block; height: 60px; line-height: 60px; text-transform: uppercase; color: #FFF; -webkit-transition: background-color 0.2s; -moz-transition: background-color 0.2s; transition: background-color 0.2s; } .cd-popup-container { position: relative; width: 90%; max-width: 400px; margin: 4em auto; background: #FFF; border-radius: .25em .25em .4em .4em; text-align: center; box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); -webkit-transform: translateY(-40px); -moz-transform: translateY(-40px); -ms-transform: translateY(-40px); -o-transform: translateY(-40px); transform: translateY(-40px); /* Force Hardware Acceleration in WebKit */ -webkit-backface-visibility: hidden; -webkit-transition-property: -webkit-transform; -moz-transition-property: -moz-transform; transition-property: transform; -webkit-transition-duration: 0.3s; -moz-transition-duration: 0.3s; transition-duration: 0.3s; } .cd-popup-container p { padding: 3em 1em; } .cd-popup-container .cd-buttons:after { content: ""; display: table; clear: both; } .cd-popup-container .cd-buttons li { float: left; width: 50%; list-style: none; } .cd-popup-container .cd-buttons a { display: block; height: 60px; line-height: 60px; text-transform: uppercase; color: #FFF; -webkit-transition: background-color 0.2s; -moz-transition: background-color 0.2s; transition: background-color 0.2s; } .cd-popup-container .cd-buttons li:first-child a { background: #fc7169; border-radius: 0 0 0 .25em; } .no-touch .cd-popup-container .cd-buttons li:first-child a:hover { background-color: #fc8982; } .cd-popup-container .cd-buttons li:last-child a { background: #b6bece; border-radius: 0 0 .25em 0; } .no-touch .cd-popup-container .cd-buttons li:last-child a:hover { background-color: #c5ccd8; } .cd-popup-container .cd-popup-close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; } .cd-popup-container .cd-popup-close::before, .cd-popup-container .cd-popup-close::after { content: ''; position: absolute; top: 12px; width: 14px; height: 3px; background-color: #8f9cb5; } .cd-popup-container .cd-popup-close::before { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); left: 8px; } .cd-popup-container .cd-popup-close::after { -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); right: 8px; } .is-visible .cd-popup-container { -webkit-transform: translateY(0); -moz-transform: translateY(0); -ms-transform: translateY(0); -o-transform: translateY(0); transform: translateY(0); } @media only screen and (min-width: 1170px) { .cd-popup-container { margin: 8em auto; } } </style> END; $stmt = $mysqli->prepare("SELECT state_name FROM states WHERE state_code = ?"); $stmt->bind_param('s', $state_code); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($state_name); $stmt->fetch(); $stmt->close(); $stmt2 = $mysqli->prepare("SELECT toll, crime_rate, traffic, population, city, state_code, latitude, longitude, last_updated FROM states_cities WHERE `zip` = ?"); $stmt2->bind_param('i', $zip); $stmt2->execute(); $stmt2->store_result(); $stmt2->bind_result($toll, $crime_rate, $traffic, $population, $city, $state, $lat_to, $lon_to, $last_updated); $stmt2->fetch(); $stmt2->close(); echo "<h1>$city, <a href=\"state_details.php?state=$state_code\">$state_name</a></h1>"; if ($rank >= 10) { $stmt3 = $mysqli->prepare("SELECT latitude, longitude FROM states_cities WHERE zip = ?"); $stmt3->bind_param('i', $user_zip); $stmt3->execute(); $stmt3->store_result(); $stmt3->bind_result($lat_from, $lon_from); $stmt3->fetch(); $stmt3->close(); $travel_time = get_distance($lat_to, $lat_from, $lon_to, $lon_from); echo "Distance: $travel_time[distance] | Travel Time: $travel_time[time]"; } else { $travel_time = ""; } if($rank == 20) { if ((!empty($toll))) { //Add form to EDIT FORM city information } else { //Add form to ADD FORM city information to site } } if ($rank >= 18) { echo "<center><a href=\"attractions/index.php?state=$state_code\">Add Attraction</a> | <a href=\"stores/index.php?state=$state_code\">Add Store</a></center>"; } $stmt = $mysqli->prepare("SELECT name, price, free, parking_fee, discount, hours_daily, hours_weekend, address, city, zip, attract_id FROM states_attractions WHERE (city = ? OR zip = ?) AND `state` = ?"); $stmt->bind_param('sis', $city, $zip, $state_code); $stmt->execute(); $stmt->store_result(); $num_attracts = $stmt->num_rows; $stmt->bind_result($name, $price, $free, $parking_fee, $discount, $hours_daily, $hours_weekend, $address, $city, $zip, $attract_id); if ($num_attracts >= 1) { echo "<h2>Attractions</h2>"; //$count = 0; while ($stmt->fetch()) { //$count++; if ((!empty($parking_fee)) || ($parking_fee != "0.00")) { $total = $price + $parking_fee; $show_fee = " + $$parking_fee ($$total)"; } else { $show_fee = ""; } if ($rank >= 18) { $show_admin = " | <a href=\"attractions/edit.php?id=$attract_id\">EDIT</a> | <a href=\"\" class=\"cd-popup-trigger\"><font color=\"red\">DELETE</font></a>"; echo " <div class=\"cd-popup\" role=\"alert\"> <div class=\"cd-popup-container\"> <p>Are you sure you want to delete this attraction?</p> <ul class=\"cd-buttons\"> <li><a href=\"attractions/delete.php?id=$attract_id\">Yes</a></li> <li><a href=\"#0\" class=\"cd-popup-close\">No</a></li> </ul> <a href=\"#0\" class=\"cd-popup-close img-replace\">Close</a> </div> <!-- cd-popup-container --> </div> <!-- cd-popup -->"; } else { $show_admin = ""; } if ($rank >= 10) { $show_user = " | <a href=\"addtotrip.php?id=$attract_id\">ADD TO TRIP</a>"; } else { $show_user = ""; } if (!empty($discount)) {$show_discount = " Discount: $discount";} else {$show_discount = "";} if ($free == "yes") {$final_price = "FREE";} else {$final_price = "$$price";} $url_address = urlencode($address); $url_city = urlencode($city); echo "<div class=\"link_desc\">$name<sub>$final_price$show_fee $show_discount | Daily Hours: $hours_daily | Weekend Hours: $hours_weekend | <a href=\"http://maps.google.com/maps?q=$url_address,+$url_city,+$zip\" target=\"_blank\">$address, $city, $zip</a>$show_user$show_admin</sub></div>"; } } $stmt->close();
  3. cutielou22

    XML Help (API Script)

    I have got it working!!!! Yay! Thanks guys for the help. Sorry for late reply. In my code I changed: $id = $event->id; //what I can't get working Changed To (Working Code): - yes, it was that simple. lol $id = $event["id"];
  4. cutielou22

    XML Help (API Script)

    gizmola, haha I guess I don't understand what xml or json is. That is probably clear at this point. My bad. On songkick it gives you the option to use either xml or json for the api. The github file you found I did try to use a reference, but was unhelpful. I could just use the files from it yes and not do it the way I am now - however I prefer not do that. The little snippet you did add I will try and see what happens for me. I will play around with it some more and get back to you on my progress. Thanks for the help!
  5. cutielou22

    XML Help (API Script)

    Nope. Nothing. ‚ÄčI do appreciate the idea though. Thank you. I just want to make sure you know the "Songkick API repsonse:" I put in my main topic post - is NOT coding by me - it's the information I am trying to get from the Songkick api onto my site. The coding actually on my site is the code above that. Not sure if that was clear.
  6. cutielou22

    XML Help (API Script)

    It's a very large vardump. A piece of vardump: object(SimpleXMLElement)#5 (2) { ["@attributes"]=> array(4) { ["status"]=> string(2) "ok" ["perPage"]=> string(2) "50" ["page"]=> string(1) "1" ["totalEntries"]=> string(2) "16" } ["results"]=> object(SimpleXMLElement)#4 (1) { ["event"]=> array(16) { [0]=> object(SimpleXMLElement)#10 (7) { ["@attributes"]=> array(7) { ["type"]=> string( "Festival" ["popularity"]=> string( "0.154244" ["displayName"]=> string(33) "Revolution Rock 2017 (CANCELLED) " ["status"]=> string(9) "cancelled" ["ageRestriction"]=> string(0) "" ["uri"]=> string(125) "http://www.songkick.com/festivals/396898-revolution-rock/id/30185829-revolution-rock-2017?utm_source=12028&utm_medium=partner" ["id"]=> string( "30185829" } ["performance"]=> array(9) { [0]=> object(SimpleXMLElement)#24 (2) { ["@attributes"]=> array(4) { ["billing"]=> string( "headline" ["displayName"]=> string(17) "A Day to Remember" ["billingIndex"]=> string(1) "1" ["id"]=> string( "58734649" } ["artist"]=> object(SimpleXMLElement)#38 (2) { ["@attributes"]=> array(3) { ["displayName"]=> string(17) "A Day to Remember" ["uri"]=> string(92) "http://www.songkick.com/artists/470482-a-day-to-remember?utm_source=12028&utm_medium=partner" ["id"]=> string(6) "470482" } ["identifier"]=> object(SimpleXMLElement)#39 (1) { ["@attributes"]=> array(2) { ["href"]=> string(85) "http://api.songkick.com/api/3.0/artists/mbid:db008806-16f6-48fc-8521-3d953709689d.xml" ["mbid"]=> string(36) "db008806-16f6-48fc-8521-3d953709689d" } } } } [1]=> object(SimpleXMLElement)#25 (2) { ["@attributes"]=> array(4) { ["billing"]=> string( "headline" ["displayName"]=> string(9) "Shinedown" ["billingIndex"]=> string(1) "2" ["id"]=> string( "58734644" } For "id" it does show a result. Example below. Does that mean it should be working then. ??? ["id"]=> string(6) "246187"
  7. cutielou22

    XML Help (API Script)

    Not sure if I am putting this in the right thread. I am new to xml and working with api's. I am working on a songkick api script. All of it is working correctly except I can't get the id. I have tried multiple things and none of them worked sadly. $artist_id = $_GET['id']; $api_key = "##########################"; $request_url = "http://api.songkick.com/api/3.0/artists/" . $artist_id . "/calendar.xml?apikey=" . $api_key; $xml = simplexml_load_file($request_url); foreach ($xml->results->event as $event) { $skdate = $event->start["date"]; $date = date("M d, Y", strtotime($skdate)); $id = $event->id; //what I can't get working $venue = $event->venue["displayName"]; $city = $event->location["city"]; $street = $event->location["street"]; $zipcode = $event->location["zipcode"]; $phone = $event->location["phone"]; $website = $event->location["website"]; $capacity = $event->location["capacity"]; $description = $event->location["description"]; $artists = $event->xpath("./performance/artist/@displayName"); echo "<a href=\"details.php?id=$id\" class=\"show_events\"> <span id=\"date\">$date</span> <span id=\"header\">$venue</span> $city<br>"; echo implode(', ',$artists); echo "</a>"; } Songkick API repsonse: { "resultsPage": { "results": { "event": [ { "id":11129128, "type":"Concert", "uri":"http://www.songkick.com/concerts/11129128-wild-flag-at-fillmore?utm_source=PARTNER_ID&utm_medium=partner", "displayName":"Wild Flag at The Fillmore (April 18, 2012)", "start":{"time":"20:00:00", "date":"2012-04-18", "datetime":"2012-04-18T20:00:00-0800"}, "performance":[{"artist":{"uri":"http://www.songkick.com/artists/29835-wild-flag?utm_source=PARTNER_ID&utm_medium=partner", "displayName":"Wild Flag","id":29835,"identifier":[]}, "displayName":"Wild Flag", "billingIndex":1, "id":21579303, "billing":"headline"}], "location":{"city":"San Francisco, CA, US","lng":-122.4332937,"lat":37.7842398}, "venue":{"id":6239, "displayName":"The Fillmore", "uri":"http://www.songkick.com/venues/6239-fillmore?utm_source=PARTNER_ID&utm_medium=partner", "lng":-122.4332937, "lat":37.7842398, "metroArea":{"uri":"http://www.songkick.com/metro_areas/26330-us-sf-bay-area?utm_source=PARTNER_ID&utm_medium=partner", "displayName":"SF Bay Area","country":{"displayName":"US"},"id":26330,"state":{"displayName":"CA"}}}, "status":"ok", "popularity":0.012763 }, .... ]}, "totalEntries":24, "perPage":50, "page":1, "status":"ok" } } I would just like to know how to get the id working - it is just left blank.
  8. cutielou22

    Implode array not working

    Thanks - I guess? You still didn't answer my question. You just gave me another problem (which I still don't completely understand - but not worried about that right now). I just want to understand arrays and how to deal with them. If you guys are saying I should treat each item as a individual trade with same lot_num that is fine (and not group them together). I know how to code that. That will be easy to do - my problem is putting the array into my database (which you guys are saying is bad right?).
  9. cutielou22

    Implode array not working

    I am having trouble with an array. Don't know to much about them. I have a form on create.php where they can choose multiple items for there trade. On the create.pro.php is where I want it to put all the checked items from create.php together separated by commas into my database. (That way I can explode them later to get them separately - correct?) create.php $stmt = $mysqli->prepare("SELECT id, owner, item_id, uses_left FROM useritems WHERE owner = ? ORDER BY item_id"); $stmt->bind_param('s', $userid); $stmt->execute(); $stmt->store_result(); $countitems = $stmt->num_rows; $stmt->bind_result($id, $owner, $item_id, $uses_left); ECHO <<<END <center> <p><a href="index.php">Home</a> | <a href="index.php?type=me">My Trades</a> | <a href="create.php">Create Trade</a> | <a href="offers.php\">My Offers</a> | <a href="search.php">Search</a></p> <b>Note:</b> Spirits can not be traded therefore will not be shown in the items below. <form action="create.pro.php" method="post"> <center><table cellspacing="0" cellpadding="0" width="800"> END; while ($stmt->fetch()){ $stmt2 = $mysqli->prepare("SELECT name, type, value, rarity, image, description, retired FROM items WHERE itemid = ? AND type != 'spirit' AND magic_num = ?"); $stmt2->bind_param('si', $item_id, $uses_left); $stmt2->execute(); $stmt2->store_result(); $stmt2->bind_result($name, $type, $value, $rarity, $image, $description, $retired); $stmt2->fetch(); $stmt2->close(); $y = $x % 5; if ($y == 0) { echo "<tr>"; } if (!empty($name)){ echo " <td> <img src=\"$baseurl/images/items/$image\"><br> <input type=\"checkbox\" name=\"use_item\" value=\"$itemid\"> <b>$name</b><br> </td> "; } if ($y == 4) { echo "</tr>"; } $x++; } $stmt->close(); echo "</table> <p align=\"center\">Include sP: <input type=\"text\" name=\"include_amount\" size=\"20\"></p> <p align=\"center\">Wishlist: <input type=\"text\" name=\"wishlist\" size=\"40\"></p> <input type=\"submit\" name=\"submit\" class=\"mybutton\" value=\"Create Trade\"></center> </form> </center>"; create.pro.php (where the form leads to - this is the page I need help with) $array = array($_POST['use_item']); $items = implode(", ", $array); $include_amount = $_POST['include_amount']; $wishlist = $_POST['wishlist']; $stmt = $mysqli->prepare("INSERT INTO trades (items, sPoints, wishlist, owner) VALUES (?, ?, ?, ?)"); $stmt->bind_param('siss', $items, $include_amount, $wishlist, $userid); $stmt->execute(); $stmt->store_result(); $stmt->fetch(); $stmt->close(); die(header("Location: index.php?note=Trade+created.")); Thanks for any help!
  10. cutielou22

    Bracket Question

    $_POST['item_id'] is there - it is just not shown in the top snippet. <input type=\"hidden\" name=\"item_id\" value=\"$item_id\"> So for $_POST['use_item'][3] - the "3" is the variable in the [] brackets right? And this is how I will get the id.
  11. cutielou22

    Bracket Question

    I am working on a item helper script. It consists of users selecting from multiple radio buttons for multiple items and updating them all at once. My question is the code below is used for each item the user has (used in "while ($stmt->fetch()){" statement") . With the way I have it set up, how will I make it so it updates the correct item for the right option? Also. how do I grab the bracket variable use_item[$id] ? <tr width=\"100%\"> <td> <p>$name</p> </td> <td> <center><input name=\"use_item[$id]\" type=\"radio\" id=\"use_item[$id]\" value=\"keep\"$check_keep></center> </td> <td width=\"50\"> <center><input name=\"use_item[$id]\" type=\"radio\" id=\"use_item[$id]\" value=\"stock\"$check_stock></center> </td> <td width=\"50\"> <center><input name=\"use_item[$id]\" type=\"radio\" id=\"use_item[$id]\" value=\"discard\"$check_discard></center> </td> <td width=\"50\"> <center><input name=\"use_item[$id]\" type=\"radio\" id=\"use_item[$id]\" value=\"donate\"$check_donate></center> </td> <td width=\"50\"> <center><input name=\"use_item[$id]\" type=\"radio\" id=\"use_item[$id]\" value=\"gallery\"$check_gallery></center> </td> <td width=\"50\"> <center><input name=\"use_item[$id]\" type=\"radio\" id=\"use_item[$id]\" value=\"gallery3\"$check_gallery3></center> </td> <td width=\"50\"> <center><input name=\"use_item[$id]\" type=\"radio\" id=\"use_item[$id]\" value=\"deposit\"$check_deposit></center> </td> </tr> The form takes them to the page that updates using the information they choose from above. A small snippet below. if(isset($_POST['submit'])){ $use = $_POST['use_item']; foreach($use as $use_item){ $item = $_POST['item_id']; /////// UPDATING MYSQLI INSERTED HERE ////////////////// } } Thank you for your time. Hopefully I posted enough information for your help.
  12. cutielou22

    Fatal error when using mysqli prepare()

    You should be using bind_param. Instead of . . $stmt->bind("ss",$description,$name) or die( "could not bind parameters"); Use . . . $stmt->bind_param("ss",$description,$name) or die( "could not bind parameters");
  13. cutielou22

    INSERT INTO Problem

    Not sure what is going on I tried everything (well, that I could think of) . . . any ideas are welcome (hopefully new ones - getting frustrated :/) if ($mysqli->prepare("INSERT INTO solcontest_entries (title, image,content, user, contest) VALUES ($title, $image, $content, $userid, $contest")) { $stmt2 = $mysqli->prepare("INSERT INTO `solcontest_entries` (title, image, content, user, contest) VALUES (?, ?, ?, ?, ?)"); $stmt2->bind_param('sssss', $title, $image, $content, $userid, $contest); $stmt2->execute(); $stmt2->store_result(); $stmt2->fetch(); $stmt2->close(); } else { die(mysqli_error($mysqli)); } Error I get from die mysqli_error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' of the site's lead ad, user_61609201, contest_1' at line 1" I have also tried $mysqli->query no change occured. I added the "if else die" statement because it was giving no errors, but not adding it to the database. It gives the error where $content is supposed to be inserted. Various combos and singles I tried for the variable: //$content = cleansafely($_POST['content']); //$content = mysqli_real_escape_string ($mysqli, $_POST['content']); //$content = cleansafely($content); $content = $_POST['content']; If any more information is needed please let me know.
×

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.