Jump to content

HoTDaWg

Members
  • Posts

    275
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Toronto

HoTDaWg's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. dont you have to put in the: <script language="javascript"> ... </script> thing in your echo statement? like: <script language="javascript"><a href="#" onclick="return confirm('Are you sure?')">link</a></script> i dont know javascript, but thats just my assumption
  2. put up connections/dbconn.php the script itself looks fine as far as my understanding goes.
  3. hi there, i have gain theoretical knowledge from a PHP book, and i have also made my own Blog entirely from scratch! (IM SO PROUD:) lol) but now i want to gain more practical knowledge by looking at the code of others. The problem is that a lot of the applications i look @ are way to complex for me to understand and wrap my head around. do you guys know of any smaller-scale PHP applications that are perhaps easier to follow? any help would greatly be appreciated, thanks, HoTDaWg
  4. I had that problem myself about a week ago. the nl2br function will make the structure from your post the same when you output it back onto the page. in addition, to prevent uses from being able to type aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa and exceeding the width of the textarea i used a custom function i came accross this site the other day, I use it myself and should work great for you too. <?php //taken from http://www.codingforums.com/archive/index.php/t-168890.html //just include this function at the top of the page or another file function wraptext($str, $limit) { $break = "<br>"; $limit = ( int ) $limit; return ($limit > 0 ? preg_replace('/(\S{' . ( $limit + 1 ) . ',})/e', 'wordwrap( \'\1\', ' . $limit . ', \'' . $break . '\', TRUE )', $str ) : $str); } $string = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; // and call upon it before you insert your post data into the database $finalcomment = wraptext($newcomment,50); //this function will seperate lengthy sets of characters ?> i hope this helps believe me it took me so long to find a solution for that problem HoTDaWg
  5. make sure you are using the code tags! change your line from: <?php $d['Email'] = $d['Email'] ? "<a href='mailto:{$d['Email']}'>{$d['Email']}</a>" ? "-"; ?> to: <?php $d['Email'] = $d['Email'] ? "<a href='mailto:{$d['Email']}'>{$d['Email']}</a>" : "-"; ?>
  6. hi there, heres the code im using for my inner join <?php $query = "SELECT * FROM blog_history INNER JOIN blog_links" . " USING(history_shared == link_id) WHERE blog_history.history_type='3'" . " LIMIT $skip,$results_per_page ORDER BY blog_history.history_id DESC"; ?> here is the structure for these two tables: blog_history CREATE TABLE IF NOT EXISTS `blog_history` ( `history_id` int(50) NOT NULL AUTO_INCREMENT, `history_type` varchar(250) DEFAULT NULL, `history_date` varchar(250) DEFAULT NULL, `history_shared` varchar(250) DEFAULT NULL, PRIMARY KEY (`history_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; blog_links CREATE TABLE IF NOT EXISTS `blog_links` ( `link_id` int(50) NOT NULL AUTO_INCREMENT, `link_type` varchar(50) DEFAULT NULL, `link_title` varchar(500) DEFAULT NULL, `link_link` varchar(7000) DEFAULT NULL, `link_description` varchar(1500) DEFAULT NULL, `link_date` varchar(100) DEFAULT NULL, PRIMARY KEY (`link_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; any ideas where i went wrong in the query structure guys? any help would be greatly appreciated, thanks, HoTDaWg
  7. okay so $_POST is an ARRAY by naming each of your textboxes as td_venue[] you are creating an ARRAY within the $_POST array if that makes sense, i know it can be confusing. so by referring to $_POST['td_venue'] you are referring to all of the returned checkboxes from the form. so by using the foreach loop you can do certain things to all of the CHECKED checkboxes of the user. Foreach allows you to distinguish what to do with each of the checkboxes. i hope this helps HoTDaWg
  8. im not quite sure what you're asking but i hope this helps <?php //to insert the data into the database. foreach ($_POST['td_venue'] => $key as $value){ //escape the string here, however you see fit. $query = "INSERT INTO tablename VALUES ('$value') "; $result = mysql_query($query); if ($result) { echo $value . ' was added.'; } } ?> change this accordingly i hope it gives you an idea as to what the code should look like.
  9. <?php function MyFunction($thevariable){ global $variable2; echo $thevariable . '<br>'; echo $variable2; } $variable2 = 'this value is global.'; MyFunction('hi'); ?> hope this gets ya started bud.
  10. change: <?php while ($results = $mysql_fetch_assoc($query_db)) { ?> to: <?php while ($results = mysql_fetch_assoc($query_db)) { not sure if itll fix the problem, not even sure THAT is line 26, but thats gotta be an error. did you even look at line 26:S?
  11. this isnt the perfect solution but id just: <?php $string = 'd/m/y'; $newstring = explode('/',$string); array_reverse($newstring); $finalstring = implode('/',$newstring); ?> hope this helps! HoTDaWg
  12. hi there i get a feeling this is a really stupid question and i apologize for not trying harder to figure it out, i just cant get my head around it and my deadline is slowly winding down. im trying to replace a string such as "8 2009" (or "12 2009") to just "8" here is what i have been experimenting with, but i cant seem to get it right: <?php $thatmonth = "8 2009"; preg_replace('/^[\d]+[\s\d]+$/','/^[\d]+$/',$thatmonth) ?> any help would be greatly appreciated, thanks HoTDaWg
  13. yes thank you so much... you've saved me from a whole lotta headaches!
  14. <?php $connection = mysqli_connect('localhost','username','password','db_name') $query = "SELECT * FROM video_cat_tbl"; $result = mysqli_query($connection,$query); while($row = mysqli_fetch_array($result){ { echo $row['video_cat'] . '<br>'; $query2 = "SELECT * FROM video_tbl WHERE video_cat_id ='".$row['video_cat_id']."' LIMIT 2"; $result2 = mysqli_query($connection, $query2); while($row2 = mysqli_fetch_array($result2)){ echo $row2['video_title'] . '<br>'; } } ?> Based on your description, here is my interpretation. HoTDaWg
×
×
  • 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.