Jump to content

ChrisA

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by ChrisA

  1. This is all HTML, so please see an SEO tutorial, eg. http://guides.seomoz.org/beginners-guide-to-search-engine-optimization http://www.websitepublisher.net/seo-guide/
  2. I would definitely keep revisions if possible. Sounds like you would be better off having two tables - one with songID and title, then a separate one with songID, lyrics and revisionNumber? If you store it all in one table, you'll end up duplicating at least the song title in many rows (see db normalization).
  3. Is this a particular curve with a formula, that you could perhaps fit to the points you have? Then use the formula to calculate your points? Or would cubic interpolation be good enough?
  4. Fair enough. I would probably search the chopped string for the last '<', to see if it is after the last '>'. If it is, then you've probably half chopped a html tag. e.g. if(strlen($row['news']) > 200) { $news = substr($row['news'],0,200); $news .= " <a href=\"/news/id=$row[id]\">... read more</a>"; } // check if the last < is after the last > if (strrpos($news, '<') > strrpos($news, '>')) { // if so, chop off the bit from the last < onwards $news = substr($news, 0, strrpos($news, '<')); } Another option would be to strip html tags from the string before you chop it? Then you wouldn't have any issue with half chopped tags...
  5. Cubic spline looks like some fairly hardcore maths to code up. Whats the background to the interpolation required? Is is in 1D, or 2D? As an aside, for anything other than basic linear interpolation, you would need to input more two input points. Anything more complicated meeds to know a larger area which it can use to interpolate.
  6. A more robust solution would be to use PHP DOMDocument capabilities to edit the string so that you only count visible characters, and only remove plain text, not html tags. Unfortunately, its rather more complicated to set this up, but as I say, it will provide you with a robust method. Google search may provide a tutorial to follow.
  7. You need to limit your update to the particular row you're considering in the current cycle of the loop. $unique $q=mysql_query("SELECT * FROM table WHERE something='$unique' ORDER BY Field2Update ASC"); $p=0; while($r=mysql_fetch_array($q)){ $p++; print $p; mysql_query("UPDATE table SET Field2Update ='$p' WHERE something='$unique' AND Field2Update = '".$r['Field2Update']."'"); } I've also added 'ORDER BY Field2Update ASC' to your select query to ensure your rows come out in the order you are expecting them. I've assumed the value for Field2Update is available from the select query as $r['Field2Update'].
  8. This bit of your code doesn't seem to make sense: // Test for unique id. $query = "SELECT id FROM ihear_models WHERE id != $id"; $result = mysql_query($query); if (mysql_num_rows($result) == 0){ ..... } else { // Already registered. REMOVING } echo '<h1 id="mainhead">Error!</h1> <p class="error">The model has already been registered.</p>'; } You search for rows where the id field is NOT equal to the id you received, then check if you found 0 rows... If you're trying to update a row, I would think you're more likely to want to search for the row where the id's are equal, then check you found one row?: // Test for unique id. $query = "SELECT id FROM ihear_models WHERE id = $id"; $result = mysql_query($query); if (mysql_num_rows($result) == 1){ ..... } else { 0 or 2+ found echo '<h1 id="mainhead">Error!</h1> <p class="error">Not found, or multiple found...</p>'; }
  9. First thing I would do is put some echo statements in to find out where it is going wrong. eg: <?php // Back-end for user registration echo 1; session_start(); echo 2; include("config.php"); echo 3; include("openDatabase.php"); echo 4; Is something going wrong in one of your include files (which you include again a little further in your script)?
  10. Dan - You don't want the 'echo's inside your if/else statement, it should be: <?php if ($row_RS_UserDetails['User_cbaff'] == 'NA') { $cbhop = $row_RS_ReferralDetails['User_ClickBank']; } else { $cbhop = $row_RS_UserDetails['User_cbaff']; } ?> <?php echo $cbhop; ?>
  11. Could you do something like this: SELECT events.name , events.time , events.eventid , photos.thumb_file , (venues.zipcode IN ('10017','10261',...)) AS ziporder FROM events INNER JOIN performers ON (events.eventid = performers.eventid) INNER JOIN venues ON (events.venueid = venues.venueid) LEFT JOIN photos ON (performers.performerid = photos.performerid) WHERE events.child_category_id = '38' GROUP BY performers.performer_name ORDER BY ziporder DESC I.e. put the 'zipcodes IN (...)' bit in as a select expression, then order by that expression. All the ones in the list should be 1, so they'll be before the ones not in the list.. Or is that more than you can do with a select expression?
×
×
  • 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.