Jump to content

Minklet

Members
  • Posts

    88
  • Joined

  • Last visited

    Never

Everything posted by Minklet

  1. I have a join of 3 tables, I need to count the results for pagination. It works perfectly if I type it into phpmyadmin, but tells me I have an error in my syntax when I put the exact same query into PHP. SELECT COUNT (*) FROM our_audio AS e JOIN wp_site_posts AS p ON e.post_id = p.post_id AND e.site_id = p.blog_id JOIN wp_blogs AS b ON e.site_id = b.blog_id 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 '*) FROM our_audio AS e JOIN wp_site_posts AS p ON e.post_id = p.post_id AND e.si' at line 1 in /var/www/vhosts/subverb.net/subdomains/dev/httpdocs/podcast.php on line 64 Obviously it's hard to debug because I can't see why it would work if it was wrong?
  2. This does what I want it to do when it comes to kicking it out of the database http://snook.ca/archives/php/how_i_added_tag But he adds them manually. If I added all my genres as an array, then assigned it to a variable when I retrieved the info, then could I use if (in_array('rock', $genres)){ echo 'checked' } for each checkbox? Would that work?
  3. Thats exactly what I'm already doing at the moment...but like I said, when editing the entry, how do I get the relevant check boxes to check? And when the person then unchecks a previously checked box I have to delete that row. Unless on submit I delete all rows for that mix_id, then repopulate the whole lot again, which is possible. But I still have the problem of echo ing out the checked checkboxes, or they'll have to reenter them everytime. Also, I still think it would be better to store them in the same table as an array because I want to echo out every genre attributed to EACH mix in the table, and (as far as I can make out) I would have to have a 2nd select query inside the while{} for the first, which isnt possible.
  4. I have an audio mix submitting form on my website. The first part of the form takes the details from the user and inserts a new row in the first table 'mix', auto incrementing to generate a mix_id primary key. The second part then uses a series of check boxes to select which genres the mix contains and a foreach for the resulting array to insert, into the 2nd table 'genres_for_mix', a new row for each genre id (foreign key for the genres table) that is selected and the mix_id that it concerns. Now I'm starting to think this is a bad way to do this because: 1. I don't know how to echo this out when a user edit's the mix to make all the relevant checkboxes selected. 2. When a user deselects a choice, it would be quite long winded to delete the nessesary row. So instead I'm thinking that it would be much wiser to user the serialise functions to put the array into the database However, I still don't know how to make the right checkboxes selected when I echo out the edit form. Do I use something like inarray()? If so how? Also, it's really important that I can query the database for mixes that are associated with a specific genre. Without unserialising the array and therefore echo'ing out all the results, I don't know how to query this. Would I just use a 'WHERE genre_field LIKE 'genre_id'? Can anyone help me with this please?
  5. I need to echo out a database value that contains an embed code for soundcloud (music hosting site), into a value of a text input. How do I do this without the object getting rendered? This is an example of an embed code. <object height="81" width="100%"> <param value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" name="movie"> <param value="always" name="allowscriptaccess"> <embed height="81" width="100%" type="application/x-shockwave-flash" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" allowscriptaccess="always"> </object> The value has to stay exactly the same so that it can pass a regular expression for validation. Is this possible?
  6. Ah thankyou very much! I haven't tried it but I'm sure it works, really much appreciated.
  7. Thanks for the replies Thankyou! Yeah I have recently changed the logo to include 'beta' and accidentally saved it as jpg. I will change it back, you're right it looks very grainy. I will experiment with that...but the only way to make the columns small enough to fit next to each other is to make them about 30pixels smaller, which throws the entire design off and leaves a massive gap in the middle! I just can't work out where it is coming from, because there is nothing there.
  8. Minklet

    IE7 bugs

    If someone could look at this http://subverb.net/ and tell me why in compatitbility mode the widgets go down in one column? I can't find it at all. As far as I can tell it isn't the IE problem of doubling margins because I have changed the float and margin values and tried the css hack I found online. It's driving me insane?! Also, I have a newwindow javascript command to open the player when you click on the red play button in the latest mixes widget...but it just opens it like a regular link. I really don't want this to happen. Why is it doing that? Any help would be greatly appreciated. Thanks
  9. http://subverb.net There are bugs in IE6 and 7 that I'm trying to iron out (the widgets have the wrong sized margins/padding and so go in one column and the popup links for mixes do not open in a new window). If anyone can aid me with those, or point me in the right direction I'd be thankful. The site is missing a few things, but is mostly ready to go. Anyone fancy giving a critique?
  10. Sadly neither of those worked.
  11. I posted this in the Regex forum, but the regex I have works fine, so this seems to be more of a php problem I checked with firebug and compared the POST value to the string in the one that works and they are exactly the same. I can't figure out what the problem is at all
  12. Similarly, this regex to allow an embed code for youtube also will not work when it comes from a form field. This doesnt work: $embed = $_POST['mixembedlink']; if (preg_match('/<object width=\"([0-9]*)\" height=\"([0-9]*)\"><param name=\"movie\" value=\"(.*)\"><\/param><param name=\"allowFullScreen\" value=\".*\"><\/param><param name=\"allowscriptaccess\" value=\".*\"><\/param><embed src=\".*\" type=\".*\" allowscriptaccess=\".*\" allowfullscreen=\".*\" width=\"[0-9]*\" height=\"[0-9]*\"><\/embed><\/object>/',$embed,$preg_out)) {; $width = $preg_out[1]; $height = $preg_out[2]; $url = $preg_out[3]; echo 'WORKING'; } else { echo 'NOT WORKING!'; } This however does work: $embed = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/1mt3vZHDiM8?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/1mt3vZHDiM8?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>'; if (preg_match('/<object width=\"([0-9]*)\" height=\"([0-9]*)\"><param name=\"movie\" value=\"(.*)\"><\/param><param name=\"allowFullScreen\" value=\".*\"><\/param><param name=\"allowscriptaccess\" value=\".*\"><\/param><embed src=\".*\" type=\".*\" allowscriptaccess=\".*\" allowfullscreen=\".*\" width=\"[0-9]*\" height=\"[0-9]*\"><\/embed><\/object>/',$embed,$preg_out)) {; $width = $preg_out[1]; $height = $preg_out[2]; $url = $preg_out[3]; echo 'WORKING'; } else { echo 'NOT WORKING!'; } Can anyone shed some light on why this is? The form names are exactly right. I think i've checked and renamed them about 10 times each.
  13. Well, it depends on the field in question doesn't it? If it's the facebook field, then yes it is. Sorry if you didnt understand what I meant. There is a problem with this regex. It won't validate if the url comes from a form field, even if you use the exact string that I entered into the form. i.e this works: $allowed = 'http://soundcloud.com'; $url = 'http://soundcloud.com/theshiverman/summer-beats-july-2010'; echo $_POST['mixdownloadlink']; function isrighturl($allowed, $url){ $allowed = preg_quote($allowed, '/:.'); $regex = "/".$allowed.'\/[0-9a-zA-Z_\/\-]{1,99}'."/"; $keywords = preg_match_all($regex, $url, $matches); $matches = count($matches[0]); if($matches == 1){ return true; } else{ return false; } } if(isrighturl($allowed, $url) == 1){ echo "URL is OK"; } else{ echo "URL isnt right"; } Whereas entering the same url (http://soundcloud.com/theshiverman/summer-beats-july-2010) into the mixdownloadlink field on the form and using this: $allowed = 'http://soundcloud.com'; $url = $_POST['mixdownloadlink']; function isrighturl($allowed, $url){ $allowed = preg_quote($allowed, '/:.'); $regex = "/".$allowed.'\/[0-9a-zA-Z_\/\-]{1,99}'."/"; $keywords = preg_match_all($regex, $url, $matches); $matches = count($matches[0]); if($matches == 1){ return true; } else{ return false; } } if(isrighturl($allowed, $url) == 1){ echo "URL is OK"; } else{ echo "URL isnt right"; } Doesnt work. Is this just me bring tired? I can't see what the problem is.
  14. In case anyone else has a similiar question, a friend forwarded me this: http://pastebin.com/EGxeMf8N
  15. Because I am letting them input account url's from various domains(soundcloud, mixcloud, divshare) etc, I think it would be easier for the user to just cut and paste the whole lot. Seems a bit more idiot proof than asking them to only copy from after .com Why is this a bad idea?
  16. I'm sorry if this has been asked before, however the search terms I could think of are a little ambiguous and the majority of results asked for the regex is to take parts of a url. I would like users to be able to add their accounts to particular websites in specific text inputs. i.e. you can only put http://www.facebook.com/yourprofile into the Facebook field. So basically I want a regex that only allows http://www.domain.com[whatever else is needed] .I'm sure this is easy to do, but I'm a real novice at regex (I'm trying!). I currently have this, which allows urls of any domain, but I don't want to give users that privilege: if (preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', ($_POST['website']))) { $website = escape_data($_POST['website']); $mw = "'$website'"; } else if (empty($_POST['website'])) { $mw = 'NULL'; } else { $mw = FALSE; echo '<p><font color="red" size="+1">Please enter a valid website URL, or clear the entry</font></p>'; } Any help would be massively appreciated. Thankyou
  17. Ignore the '; at the end of the info declaration, that was a typo.
  18. I have altered this script to be able to delete a record from an upcoming gig table. Its fairly simple This is the ajax script: <script type="text/javascript"> jQuery(function() { jQuery(".delbutton").click(function(){ var member_id = jQuery("#member_id").val(); var element = jQuery(this); var d = new Date(); var del_id = element.attr("id"); var info = 'id=' + del_id + '&member_id=' + member_id + '&del=1&sht=' + d.getTime();'; if(confirm("Sure you want to delete this update? There is NO undo!")) { jQuery("#flash").show(); jQuery("#flash").fadeIn(400).html('<img src="http://tiggin.com/ajax-loader.gif"> <span class="loading">Loading Comment...</span>'); jQuery.ajax({ type: "POST", url: "insertgig.php", data: info, success: function(html){ jQuery("#display").html(html); jQuery("#flash").hide(); } }); } return false; }); }); </script> This is the php that builds and displays the table on the main page: <table width="90%"> <tr><td width="22%"><strong id="first">Date</strong></td><td width="23%"><strong>Event</strong></td><td width="23%"><strong>Venue</strong></td><td width="30"><strong>Event Link</strong></td></tr> <?php while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo '<tr><td width="22%">' . $row['date_of_gig'] . '</td><td width="23%">' . $row['promoter'] . '</td><td width="23%">' . $row['venue'] . '</td><td width="27%">'; if ($row['event_link'] != NULL) { echo '<a href="' . $row['event_link'] . '" title="Event Page" target="_blank" ><img style="border: none;" src="http://www.subverb.net/images/profile_facebookevent.jpg" alt="Facebook Icon" /></a>'; } echo '</td><td width="5%"><a href="#" id="' . $row["entry_id"] . '" class="delbutton"><img src="images/del.png" alt="delete"/></a> </td></tr>'; } echo '</table>'; ?> and this is the processing script, as you can see there is another ajax script that is used to add records by ajax, hence the if($_POST['del'] == 1) to check which query to execute. require_once('mysqli_connect.php'); if(isset($_SESSION['member_id'])) { if ($_POST['member_id'] == $_SESSION['member_id']) { if(isset($_POST['del']) && $_POST['del'] == 1) { $entry_id = $_POST['id']; $member_id = $_POST['member_id']; $query = "DELETE FROM upcoming_gigs WHERE entry_id = '$entry_id'"; $result = mysqli_query ($dbc, $query) or trigger_error ("query: $query\n<br />MySQL Error: " . mysqli_error($dbc)); } else { $date = $_POST['date']; $venue = $_POST['venue']; $promoter = $_POST['promoter']; $eventlink = $_POST['eventlink']; $member_id = $_POST['member_id']; $query = "INSERT INTO upcoming_gigs (date_of_gig, venue, event_link, promoter, member_id) VALUES ('$date', '$venue', '$event', '$promoter', '$member_id')"; $result = mysqli_query ($dbc, $query) or trigger_error ("query: $query\n<br />MySQL Error: " . mysqli_error($dbc)); } $result= mysqli_query($dbc, "SELECT * FROM upcoming_gigs WHERE member_id = '$member_id' ORDER BY date_of_gig asc") or trigger_error ("query: $query\n<br />MySQL Error: " . mysqli_error($dbc));; $sht = date('U'); ?> <table width="90%"> <tr><td width="22%"><strong id="first">Date</strong></td><td width="23%"><strong>Event</strong></td><td width="23%"><strong>Venue</strong></td><td width="30"><strong>Event Link</strong></td></tr> <?php while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo '<tr><td width="22%">' . $row['date_of_gig'] . '</td><td width="23%">' . $row['promoter'] . '</td><td width="23%">' . $row['venue'] . '</td><td width="27%">'; if ($row['event_link'] != NULL) { echo '<a href="' . $row['event_link'] . '" title="Event Page" target="_blank" ><img style="border: none;" src="http://www.subverb.net/images/profile_facebookevent.jpg" alt="Facebook Icon" /></a>'; } echo '</td><td width="5%"><a href="#" id="' . $row["entry_id"] . '" class="delbutton"><img src="images/del.png" alt="delete"/></a> </td></tr>'; } echo '</table>'; } else { echo 'There was an error, or you do not have permission to edit this information. Please contact admin@subverb.net or start a help thread in the forum if this problem persists. Sorry for the inconvenience.'; } } else { echo 'There was an error, or you do not have permission to edit this information. Please contact admin@subverb.net or start a help thread in the forum if this problem persists. Sorry for the inconvenience.'; } ?> So anyway...once the delete script is executed once and the table is populated by the html kicked out by the processing page, clicking the delete link doesnt do anything. Nothing at all, firebug doesnt give me any errors, or any indication that anything is happening. I can't figure this out because the class names are exactly the same, in fact the source code of the page s exactly the same. Any reason why this is?
  19. Apologies, it was me being stupid and forgetting the +'s after each variable.
  20. Sorry, type="POST", not get. I changed that about to try a few things and didnt change it back. Same error. Why can't you edit posts on this forum?
  21. I am using a load and insert ajax query, which is here:http://www.9lessons.info/2009/05/insert-and-load-record-using-jquery-and.html Which works nicely, but I can't get it to work for multiple text inputs. I have scoured google for about 10hours and can't find something simple. I'd consider myself fairly good at figuring things out, but Ajax seems to have about a hundred different ways of doing the exact same thing and none of which I can see how to implement. This is what I have: var element = $(this); var promoter = $("#promoter").val(); var venue = $("#venue").val(); var eventlink = $("#eventlink").val(); var date = $("#date").val(); var dataString = 'content='+ promoter'&venue='+ venue'&eventlink='+ eventlink'&date='+ date'; $.ajax({ type: "GET", url: "demo_insert.php", data: dataString, cache: false, success: function(html){ and the html: <form method="post" name="form" action=""> <table cellpadding="0" cellspacing="0" width="500px"> <tr><td align="left"><div align="left"><h3>What are you doing?</h3></div></td></tr> <tr> <td style="padding:4px; padding-left:10px;" class="comment_box"> <input type="text" style="width:40px;font-size:14px; font-weight:bold" name="promoter" id="promoter" maxlength="15" /> <input type="text" style="width:40px;font-size:14px; font-weight:bold" name="venue" id="venue" maxlength="15" /> <input type="text" style="width:40px;font-size:14px; font-weight:bold" name="date" id="date" maxlength="15" /> <input type="text" style="width:40px;font-size:14px; font-weight:bold" name="eventlink" id="eventlink" maxlength="15" /> <input type="submit" value="Update" id="v" name="submit" class="comment_button" /> </td> </tr> </table> </form> I'm getting a 'missing ; before statement' error in firebug pointing to my datastring variable. This is driving me insane, if I could actually find some solid answers on google rather than a constant stream of contradictory examples I would be set. Any help please?
  22. It's actually nothing to do with the sql query. I've just tried putting a string into the variables and it is still coming up with 'website'. If it's not the database username then I have no idea what it is. It echo's the correct values when it is inside the if ($result) braces, so it seems to be a scope thing...is this a php setting?
  23. Array ( [member_id] => 1 [member_firstname] => Michael [member_lastname] => Mallett [member_dateregistered] => 2010-08-05 11:05:25 [password] => cca961192cdfac00b66a8e2ad9337ad9250ab11f [username_id] => Shiverman [activate_code] => [photo] => [fb_userid] => [fb_proxiedemail] => [about] => [soundcloud_link] => [facebook_link] => [divshare_link] => [mixcloud_link] => [myspace_link] => [postbocks_links] => [personal_website] => [member_type] => 1 [status] => 1 => Mike@Generalpie.com [active] => ) So it's kicking out the right values...
×
×
  • 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.