Jump to content

tronicsmasta

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Everything posted by tronicsmasta

  1. what result are you getting?? blank info in the database, php/database errors???
  2. there are a bunch of javascript validations out there where as the user types in the box its checking if its correct... but you should always recheck via server side scripting.
  3. can i see a few lines before and a few lines after your require() line? i think your trying to include from the wrong place... i have to see a few lines though...
  4. if i am not mistaken, godaddy will use the same server for all your domains, but different servers for your databases.... notice each time you make a database you get a location of something like 371637sdhv838.mysql.godaddy.com <-- not the same format but you get the idea... you can try to add a new user to your second database but their mysql servers do not allow outside connections.... and i think you cant even connect to the database if your not under the same domain... ie: bluemoon_db on jjksdfkjf.godaddy.com from domain bluemoonisgreat.com wont beable to connect to newcastle_db on j3hgjek.godaddy.com from domain newcastleisbetter.com because of the connection limitations they set for security purposes... try a new user but i still dont think it will work. you can always temporarily move 1 site to another in a subdirectory pull the info you want, insert it into your other database as different table names and use that modified database... i can help you merge them if you like.
  5. Just thought this might be a useful script for someone... I needed it to build a categories list of over 10,000 videos with over 900 categories... It builds a unique category listing from one db of videos, builds an array, trims each element of white spaces, sorts it ascending, and inserts it into another table... I am sure there is some redundant code lol Would like some feed back <?php //connect to the db require_once('dbconnect.php'); //clear table $sql_truncate = "TRUNCATE TABLE categories;"; $result = mysql_query($sql_truncate) or die(mysql_error()); //reset auto increment to 0 again $sql_alter = "ALTER TABLE categories AUTO_INCREMENT = 0;"; $result = mysql_query($sql_alter) or die(mysql_error()); //select categories from orginal table $sql = "SELECT DISTINCT category FROM videos ORDER BY category ASC;"; //build array $cat_array = array(); //populate array based on sql query of unique categories if ($result = mysql_query($sql)) { //count the results $numrows = mysql_num_rows($result); //add a nice header with row count $output .= "<h4>Categories ($numrows)</h4>"; //run query and build an array and add to your array... possible redundant while ($row = mysql_fetch_assoc($result)) { $cat_array[] = $row['cat']; } } //create new temporary array for next foreach... $cat_array_trim = array(); //this foreach loop trims the white spaces from beginning and end of each element of the array //this must be done before sorting foreach ($cat_array as &$cat) { //add the new trimmed element to the new temporary array $cat_array_trim[] = trim($cat); } //reset the original array and sort it at the same time... $cat_array = asort($cat_array_trim); //now for each array element, add it to the database foreach ($cat_array_trim as &$cat) { //addslashes takes this "This is my friend's cat!" and makes it mysql safe "This is my friend\'s cat!" $cat = addslashes($cat); //insert query $sql_insert = "INSERT INTO categories (`id`, `category`, `type`) VALUES (NULL, '$cat', '');"; $result = mysql_query($sql_insert) or die(mysql_error()); //output results just to double check your handy work $output .= "Insert $cat into the db!<br />"; } //this shows your handy work... good job! echo $output; //close the db require_once('dbclose.php'); ?>
  6. hello, I am trying to use mod_rewrite to make urls friendly... but at this time the majority of the code relies on SID being a # and CID being a number eg: domain.com?sid=10&cid=205 I would like to take a word in the URI and change it to 10 eg: myword = 10 eg: domain.com/myword/205 is actually domain.com?sid=10&cid=205 so far my #'s in the URI are working just fine .htaccess RewriteEngine On RewriteRule ^/?([0-9]+)/([0-9]+)$ [NC] index.html?sid=$1&cid=$2 ideas?? thank yOU! Quinton
  7. I am curious on why you put all those HTML tags into your database in the first place... $dbstring = "<div><font size="4">Brand New Item With Tags</font></div><div><font size="4"></font></div><div><font size="4">This item is a Brand New Abercrombie and Fitch Women&#039;s&nbsp;Yellow Hoody size Medium.</font></div><div><font size="4"></font></div><div><font size="4">Authentic vintage inspired sportswear and sexy effortless style combine to create a signture American brand with timeless appeal.</font></div><div><font size="4"></font></div><div><font size="4">Size diamentions are as follows: front underarm chest 48 cm, shoulder to waist 61cm, underarm to sleave 56cm</font></div><div><font size="4">This style is tight fitting so please pay close attention to the measurements for a good fit.</font></div><div><font size="4"></font></div><div><font size="4">Please feel free to ask any questions about this sweater.</font></div>"; $decodedwithHTML = html_entity_decode($dbstring, ENT_QUOTES ); $completelydecoded = strip_tags($decoded); --= edit for mistake =--
  8. Hey guys... Its been a while I would like to implement a feature similar to myspace where the user can choose a URL shortcut at the end of the main domain... eg. domain.com/username I wasn't sure if it was a DNS function or if I really have to have php create new folders under that username and have an index file for each user.... that is a terrible idea and a waste of time and space lol ideas? thanks in advance, Quinton
  9. one other quick question.... how can i return an array from a function or multiple variables from a function eg: From what I read the return function ends the function thus $bar wont be returned.... how can i do this ?!? echo $err; $multivar = func("blah"); function func($func) { $foo = "bar"; $bar = $func; return($foo); return($bar); }
  10. include('dbconect.php'); $query = mysql_query("SELECT * FROM config") or die("Query failed: ".mysql_error()); the . has to be after the "
  11. i knew that... i was having a brain fart at 9:00am without my coffee lol thanks!
  12. hey guys... i have looked around and can't seem to find this answer... How can i return a variable for use from a function? eg: error(60); echo $err; //I want to use it here... function error($err) { print "Error $err"; return($err); //i want to use $err after i call the function } Thanks for the help!
  13. Well it makes a difference if you know what you are googling! thanks soooo much!
  14. Hey guys, Does anyone know of a small script where I can generate a small horizontal inbox usage meter just like in PHPBB inbox or SMF?!? I am writing my own website from scratch and I need something similar that I can customize for the users inbox... any ideas? Thanks!!!! Q ???
  15. SELECT comments.username, comments.date, comments.comment, users.avatar FROM comments LEFT JOIN users ON users.username = comments.username WHERE comments.channel = '01' ORDER BY comments.date DESC; haha error in my database... whoops... fixed! Thanks to that guy who asked the question about joining earlier!
  16. hmmm I tried this: SELECT comments.username, comments.date, comments.comment, users.avatar FROM comments LEFT JOIN users ON comments.username = users.username WHERE comments.channel = '01' ORDER BY comments.date DESC; I get the right entry but avatar comes back null in phpMyAdmin... any ideas?
  17. I have put a second query in a while loop before... idk why this isnt working... but after removing the @ symbol that still leaves $avatar empty... hmmf... what does that @ symbol do anyway? surpresses warnings right? I tried cleaning it up a bit... here is the updated version: $display = ""; while ($row = mysql_fetch_array($result)) { $username = stripslashes($row['username']); $comment = stripslashes($row['comment']); $date = $row['date']; $display .= "<ul> <li>$username - <span id=\"comment_date\">$date</span><br/><br/> <table> <td> <tr width=\"100\"><img src=\""; $sqlA = "SELECT * FROM users WHERE username = '$username'"; $resultA = mysql_query($sqlA,$connection); while ($rowA = mysql_fetch_array($resultA)) { $avatar = $rowA['avatar']; $display .= "$avatar"; } $display .= "\" width=\"100\" height=\"100\"></tr>"; $display .= "<tr width=\"430\"> $comment</tr> </td> </table> </li> </ul>"; } //end list all comments echo $display;
  18. Hey guys, I need to join these tables comments (table) date username comment channel with: users (table) username avatar There is more to these tables but what I have listed is only what I need... What I want to do is get the username date comments from the comments table where channel = 01 and the avatar from the users table that matches the username... Now the what I am trying to query is SELECT comments.username, comments.date, comments.comment, users.avatar FROM comments, users WHERE users.username = comments.username AND comments.channel = 01 ORDER BY date DESC Now mysql returns 0 rows. but when i run this: SELECT comments.username, comments.date, comments.comment, users.avatar FROM comments, users WHERE users.username = comments.username ORDER BY date DESC I get 2 entries from my comments table because there are 2 comments entries with that username but all I am trying to get from the users table is the avatar... any ideas how i can do this? I also tried: (//NOTE: $start and $limit are part of my pagination) $sql = "SELECT * FROM comments WHERE channel = '$channel' ORDER BY date DESC LIMIT $start, $limit;"; //create list of results $result = @mysql_query($sql,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $username = stripslashes($row['username']); $comment = stripslashes($row['comment']); $date = $row['date']; $sqlA = "SELECT avatar FROM users WHERE username = '$username'"; $resultA = @mysql_query($sqlA,$connection); $rowA = mysql_fetch_array($resultA); $avatar = $rowA['avatar']; echo "<ul>"; echo "<li>"; echo "$username - <span id=\"comment_date\">$date</span><br/><br/>"; echo "<table> <td> <tr width=\"100\"><img src=\"$avatar\" width=\"100\" height=\"100\"></tr> <tr width=\"430\"> $comment - avatar: $avatar</tr> </td> </table>"; echo "</li>"; echo "</ul>"; } //end list all comments but the avatar shows up with an X and avatar: is blank... but when i run $sqlA by itself... no problems I get that avatar... hope this is clear... thank you!
  19. Hey guys, I need to join these tables comments (table) date username comment channel with: users (table) username avatar There are more to these tables but what I have listed is only what I need... What I want to do is get the username date comments from the comments table where channel = 01 and the avatar from the users table that matches the username... Now the what I am trying to query is SELECT comments.username, comments.date, comments.comment, users.avatar FROM comments, users WHERE users.username = comments.username AND comments.channel = 01 ORDER BY date DESC Now mysql returns 0 rows. but when i run this: SELECT comments.username, comments.date, comments.comment, users.avatar FROM comments, users WHERE users.username = comments.username ORDER BY date DESC I get 2 entries from my comments table because there are 2 comments entries with that username but all I am trying to get from the users table is the avatar... any ideas how i can do this? I also tried: while ($row = mysql_fetch_array($result)) { $username = stripslashes($row['username']); $comment = stripslashes($row['comment']); $date = $row['date']; $sqlA = "SELECT avatar FROM users WHERE username = '$username'"; $resultA = @mysql_query($sqlA,$connection); $rowA = mysql_fetch_array($resultA); $avatar = $rowA['avatar']; echo "<ul>"; echo "<li>"; echo "$username - <span id=\"comment_date\">$date</span><br/><br/>"; echo "<table> <td> <tr width=\"100\"><img src=\"$avatar\" width=\"100\" height=\"100\"></tr> <tr width=\"430\"> $comment - avatar: $avatar</tr> </td> </table>"; echo "</li>"; echo "</ul>"; } //end list all comments but the avatar shows up with an X and avatar: is blank... but when i run $sqlA by itself... no problems I get that avatar... hope this is clear... thank you!
  20. eg: if (browser = IE) { echo "<br>"; } if (browser = Mozilla) { echo "whatever i need here"; } echo "$_SERVER['HTTP_USER_AGENT']"; // Outputs for Mozilla -- Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14 // or IE -- Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
×
×
  • 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.